#901678 debhelper: Dh_Lib:get_buildoptions() does not honor DEB_BUILD_MAINT_OPTIONS

Package:
debhelper
Source:
debhelper
Submitter:
Drew Parsons
Date:
2021-12-13 06:51:04 UTC
Severity:
normal
Tags:
#901678#5
Date:
2018-06-15 14:01:54 UTC
From:
To:
There seems to be an inconsistency in the handling of BUILD_OPTIONS by
dpkg-buildpackage, in regards to the alternative DEB_BUILD_OPTIONS and
DEB_BUILD_MAINT_OPTIONS handled by dpkg-buildflags.

lintian warning debian-rules-sets-DEB_BUILD_OPTIONS instructs us to
use DEB_BUILD_MAINT_OPTIONS in debian/rules, not DEB_BUILD_OPTIONS
(which can be set by the user).

But dpkg-buildpackage only uses DEB_BUILD_OPTIONS and ignores
DEB_BUILD_MAINT_OPTIONS.

Should dpkg-buildpackage be updated to use DEB_BUILD_MAINT_OPTIONS?

#901678#10
Date:
2018-06-15 14:32:06 UTC
From:
To:
Hi!

Perhaps I'm misunderstanding the request, but this is inside-out,
dpkg-buildpackage always calls debian/rules (and never the other way
around) so whatever is set from within that file will not be visible
to the outter process. dpkg-buildpckage does not (and cannot) really
care what you do with either of the variables in debian/rules. :)

Barring some misunderstanding from my part, I'm planning on closing
this report in a bit.

Thanks,
Guillem

#901678#15
Date:
2018-06-15 22:48:16 UTC
From:
To:
The problem is this:  in debian/rules I have DEB_BUILD_OPTIONS=nocheck,
which is used (I don't know by what exactly) to prevent the build
system from automatically running test.

But lintian complains that it should be set to DEB_BUILD_MAINT_OPTIONS
instead.

But when I change it to DEB_BUILD_MAINT_OPTIONS=nocheck (or "export
DEB_BUILD_MAINT_OPTIONS=nocheck"), the tests are run.
DEB_BUILD_MAINT_OPTIONS is being ignored at build time.

Is it dh and debhelper that the bug needs to be sent to?

#901678#20
Date:
2018-06-16 16:44:25 UTC
From:
To:
Hi!

Take into account, though, that this will not affect things like the
build dependency satisfiability, or build profiles and similar, because
as I mention above, that's set too late and in an inner level than what
dpkg-checkbuilddeps or dpkg-buildpackage would be checking.

I was actually going over the dpkg-dev code to make sure, and that
does not handle noopt correctly when set from DEB_BUILD_MAINT_OPTIONS,
which I've fixed now locally. That's why I've cloned instead of just
reassigning.

The one you report seems to be a bug in debhelper. But I think the
usual pattern is to just add an override for the dh_auto_test command
instead?

Thanks,
Guillem

#901678#33
Date:
2018-06-17 16:44:00 UTC
From:
To:
Control: tags -1 moreinfo

Indeed, overriding dh_auto_test is probably what you are looking for.

As for debhelper supporting DEB_BUILD_MAINT_OPTIONS.  It is possible,
but are we sure it makes sense for packagers to DEB_BUILD_MAINT_OPTIONS
for things like nocheck, nostrip, noautodbgsym, parallel=n, etc.?

Thanks,
~Niels

#901678#40
Date:
2018-06-17 17:33:08 UTC
From:
To:

I don't get it.  What is the point of DEB_BUILD_MAINT_OPTIONS (and the
lintian warning about DEB_BUILD_OPTIONS) if no tool is actually using
it?

Drew

#901678#45
Date:
2018-06-17 18:35:00 UTC
From:
To:
Drew Parsons:

The primary use of DEB_BUILD_MAINT_OPTIONS that I know of is to make
dpkg-buildflags enable hardening or other special-case compiler flags.
E.g. DEB_BUILD_MAINT_OPTIONS=hardening=+all.

That use-case is completely handled/covered by dpkg-buildflags.

Thanks,
~Niels

#901678#50
Date:
2018-06-17 19:06:57 UTC
From:
To:
I see.  The idea is that dpkg-buildflags uses DEB_BUILD_MAINT_OPTIONS
to adjust CFLAGS and friends.  nocheck has no place there.

The debhelper check in /usr/share/lintian/checks/rules.pm checks for
DEB_BUILD_OPTIONS in debian/rules and issues a warning on it (l.219).

An override for that warning is automatically placed if
DEB_BUILD_OPTIONS contains nocheck, but only when override_dh_auto_test
is used (l.447).

I'm not sure if the tests in my upstream build script can be handled
with override_dh_auto_test. In that case, I should use a package
lintian-override to override the lintian warning.

Drew