Debian Bug report logs - #1031679
lintian: d/rules: should suggest using `execute_before/_after_dh_command` instead of `override_dh_command`

version graph

Package: lintian; Maintainer for lintian is Debian Lintian Maintainers <[email protected]>; Source for lintian is src:lintian (PTS, buildd, popcon).

Reported by: Gioele Barabucci <[email protected]>

Date: Mon, 20 Feb 2023 11:27:02 UTC

Severity: wishlist

Found in version lintian/2.116.3

Reply or subscribe to this bug.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to [email protected], Debian Lintian Maintainers <[email protected]>:
Bug#1031679; Package lintian. (Mon, 20 Feb 2023 11:27:04 GMT) (full text, mbox, link).


Acknowledgement sent to Gioele Barabucci <[email protected]>:
New Bug report received and forwarded. Copy sent to Debian Lintian Maintainers <[email protected]>. (Mon, 20 Feb 2023 11:27:04 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: Gioele Barabucci <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: lintian: d/rules: should suggest using `execute_before/_after_dh_command` instead of `override_dh_command`
Date: Mon, 20 Feb 2023 12:24:10 +0100
Package: lintian
Version: 2.116.3
Severity: wishlist

Lintian should warn about the use of `override_dh_command` to inject 
commands before or after the execution of `dh_command`. In such 
situations one should use `execute_before_dh_command` and 
`execute_after_dh_command`.

Many debian/rules files use `override_dh_command` to inject commands 
before or after the execution of the default dh_command. For example:

    override_dh_clean:
        dh_clean:
        touch this_strange_file

Since debhelper 12.8 (compat 10, Debian 11) one should use the more 
expressive `execute_before_dh_command` and `execute_after_dh_command`. 
For example:

    execute_after_dh_clean:
        touch this_strange_file

Real-life examples of such uses of `override_dh_command`: 
https://salsa.debian.org/debian/pkg-collectd/-/blob/694f2c9/debian/rules#L278-310

In addition to simplifying the code of `d/rules` and making it more 
expressive, the use of `execute_before/_after` ensures that all 
dh_command-specific BUILD_OPTIONS-/BUILD_PROFILE-related actions are 
taken into account without having to reimplement them inside 
`override_dh_command`.

Regards,

-- 
Gioele Barabucci



Information forwarded to [email protected], Debian Lintian Maintainers <[email protected]>:
Bug#1031679; Package lintian. (Mon, 20 Feb 2023 14:51:02 GMT) (full text, mbox, link).


Message #8 received at [email protected] (full text, mbox, reply):

From: Christoph Berg <[email protected]>
To: Gioele Barabucci <[email protected]>, [email protected]
Subject: Re: Bug#1031679: lintian: d/rules: should suggest using `execute_before/_after_dh_command` instead of `override_dh_command`
Date: Mon, 20 Feb 2023 15:48:00 +0100
Re: Gioele Barabucci
>     execute_after_dh_clean:
>         touch this_strange_file

The downside of this is that it makes backporting to buster-and-older
harder since it doesn't have the required debhelper version yet.

Christoph



Information forwarded to [email protected], Debian Lintian Maintainers <[email protected]>:
Bug#1031679; Package lintian. (Mon, 20 Feb 2023 14:57:02 GMT) (full text, mbox, link).


Acknowledgement sent to Jelmer Vernooij <[email protected]>:
Extra info received and forwarded to list. Copy sent to Debian Lintian Maintainers <[email protected]>. (Mon, 20 Feb 2023 14:57:02 GMT) (full text, mbox, link).


Message #13 received at [email protected] (full text, mbox, reply):

From: Jelmer Vernooij <[email protected]>
To: Christoph Berg <[email protected]>, [email protected]
Cc: Gioele Barabucci <[email protected]>
Subject: Re: Bug#1031679: lintian: d/rules: should suggest using `execute_before/_after_dh_command` instead of `override_dh_command`
Date: Mon, 20 Feb 2023 14:54:25 +0000
On Mon, Feb 20, 2023 at 03:48:00PM +0100, Christoph Berg wrote:
> Re: Gioele Barabucci
> >     execute_after_dh_clean:
> >         touch this_strange_file
> 
> The downside of this is that it makes backporting to buster-and-older
> harder since it doesn't have the required debhelper version yet.

It might make sense to only give this warning for packages that are
already on >= 13?

Jelmer



Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 08:47:11 2025; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.