[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



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


Reply to: