Hi Niels,

I'm reviving a part of the old discussion...

On 01/05/26 10:08 pm, Niels Thykier wrote:
> Nilesh Patra:
>> Hi Niels,
>>> Note: `lintian` can use `dh_assistant` to determine the compat level
>>> instead of implementing the logic itself for checking various fields and
>>> files (the `export DH_COMPAT` checks for `debian/rules` might still be
>>> necessary).  Though, this implies debhelper/13.15+ as a dependency for
>>> it to recognize `X-DH-Compat`.
>>
>> What is the better field to use to detect compat level?  Is it 
>> `declared-compat-level` or `active-compat-level`?
> 
> For `lintian`'s case, you probably want `declared-compat-level`. That is 
> the compat version "declared" directly in the packaging files/metadata.
> 
> The `active-compat-level` is the compat level used if you execute a 
> command in the current environment (that is, it takes things like the 
> `DH_COMPAT` environment variable into account. But that is unlikely to 
> be set nor mean anything for `lintian`).
Currently dh_assistant ignores `DH_COMPAT` set in d/rules, as far as local 
experiments
show.

Lintian at the moment has "debhelper-compat > DH_COMPAT in d/rules > d/compat" 
precedence
for setting compat as per [1][2][3].
However I think this should be discouraged, and dh_assistant does not take this 
into account either.

So, I think we should take compat from debhelper-compat and d/compat only and 
use DH_COMPAT
as a fallback to emit the compat level. I've done so in this MR [4].

Does this make sense - or should DH_COMPAT always come at a higher priority? 
Additionally could you
take a look at the MR and let me know if this is making sense with compat level 
selections?

[1] 
https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Check/Debhelper.pm?ref_type=heads
[2] 
https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Check/Debhelper.pm?ref_type=heads#L537
[3] 
https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Check/Debhelper.pm?ref_type=heads#L558
[4] https://salsa.debian.org/lintian/lintian/-/merge_requests/749

Best,
Nilesh

Reply via email to