#1011057 lintian: Add warning if a *.postinst file does not have #DEBHELPER#

Package:
lintian
Source:
lintian
Submitter:
Carles Pina i Estany
Date:
2022-06-11 15:00:08 UTC
Severity:
wishlist
Tags:
#1011057#5
Date:
2022-05-16 09:13:12 UTC
From:
To:
Dear Maintainer,

It might be useful that lintian checked that each *.postinst contains
the #DEBHELPER# string.

For example, I noticed a missing #DEBHELPER# when creating a package
that installed a systemd service but it did not start as expected.

Thank you very much,

#1011057#10
Date:
2022-06-10 03:29:21 UTC
From:
To:
Hi Carles,

Carles Pina i Estany wrote:
[…]

Lintian already has a tag named
maintainer-script-lacks-debhelper-token for exactly that. See also
https://lintian.debian.org/tags/maintainer-script-lacks-debhelper-token

The tag is though only emitted if debhelper is actually used.

If in your case the tag should have been emitted but hadn't been
emitted, please tell us which package at which version (or commit ID)
this happened.

		Regards, Axel

#1011057#17
Date:
2022-06-10 07:19:26 UTC
From:
To:
hi,

Oops...
(I'm testing and reading lintian v2.104.0)

I was running:
$ lintian package.deb # on the binary package

If I run:
$ lintian package.dsc

it does show the warning.

I had expected that if a service is installed (in
/lib/systemd/system/*.service) the postinst should have:
"^# Automatically added by dh_installsystemd"

But I see how is easier and more reliable to maintain lintian doing the
check in the source package (I did not realise of the difference, I
don't usually do packaging so all the tools are new for me :-) )

After opening the bug I started using salsa-ci/pipeline which does it in
the source package and I see the warning if I "break" the package.

To me the bug can be closed and sorry for the noise!

Cheers,

#1011057#22
Date:
2022-06-10 14:46:23 UTC
From:
To:
Carles Pina i Estany <carles@pina.cat> writes:

For the record (since I'm not sure this is obvious when you're new to
Lintian), the best way to run Lintian is on the *.changes file generated
as part of the package build.  That will check everything that will be
included in the upload.

#1011057#27
Date:
2022-06-11 13:06:21 UTC
From:
To:
Hi Carles,

Carles Pina i Estany wrote:
[…]

Yep, that's because that #DEBHELPER# token is only present in the
source package and gets replaced with some code during the package
build. So we can't check the binary (.deb) packages for it as it is
never present there.

Thanks nevertheless. Closing the bug report herewith.

Russ Allbery wrote:

Thanks for that! Just wanted to mention the same. :-)

		Regards, Axel

#1011057#28
Date:
2022-06-11 14:49:47 UTC
From:
To:
Hi,

When I created the original bug, my thinking was that, if a package
installed a systemd service, the postinst file must have:
"# Automatically added by dh_installdeb" so that it could be checked.

As you've seen, I hadn't realised that lintian checks in the source
package and binary package differ (but it makes 100% sense!).

100% got it! And I moved it to salsa-ci pipeline that does the correct
approach of course! :-)

Thanks very much for the explanations and help!