summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2022-10-08 08:08:06 +0000
committerNiels Thykier <niels@thykier.net>2022-10-08 08:13:47 +0000
commit7edc224dd044f1ed49990b185da602c23e23b712 (patch)
treeaa12ced6da26e4ddf06a0bb83b9626f1cbe2f40b
parent26d7d3926aaa6803511673fd110e2afe03195760 (diff)
dh: Hoist nocheck and nodoc into DEB_BUILD_OPTIONS from _PROFILES
This makes `dh` builds "just work(tm)" for users out of the box even if they forget to be WET ("Write Everything Twice") about their environment variables. The hoisting does trigger a warning to aid the user understand why it magically works with `dh` based packages but fails horribly in fire and flames for non-`dh` packages. Personally, I still think we should permanently move `nocheck` and `nodoc` into `DEB_BUILD_PROFILES`. However, for now let us settle with making 90% of all source packages in testing work out of the box if you try to be DRY ("Don't Repeat Yourself") with environment variables. Closes: https://bugs.debian.org/979401 Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/changelog6
-rwxr-xr-xdh11
2 files changed, 17 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index c79d773a..70393e99 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -38,6 +38,12 @@ debhelper (13.10) UNRELEASED; urgency=medium
* dh_assistant: Provide a new `detect-hook-targets` command.
* dh: Recommend using `dh_assistant detect-hook-targets` for
checking whether hook targets are correct.
+ * dh: Hoist `nodoc` and `nocheck` from `DEB_BUILD_PROFILES`
+ into `DEB_BUILD_OPTIONS` when they are present in the former
+ and absent in the latter. Emit a warning when doing so to
+ aid the user, so they know why this does not work when they
+ are later building a package that does not use dh.
+ (Closes: #979401)
[ Translations ]
* Update Portuguese translation (Américo Monteiro)
diff --git a/dh b/dh
index 8e233821..a42ce9d1 100755
--- a/dh
+++ b/dh
@@ -750,6 +750,9 @@ if (! exists($Debian::Debhelper::DH::SequenceState::sequences{$sequence})) {
parse_dh_cmd_options(@ARGV_orig);
+_hoist_profile_into_dbo('nodoc');
+_hoist_profile_into_dbo('nocheck');
+
# Figure out at what point in the sequence to start for each package.
my (%logged, %startpoint, $completed_sequences);
@@ -844,6 +847,14 @@ sub reject_obsolete_params {
}
}
+sub _hoist_profile_into_dbo {
+ my ($name) = @_;
+ if (is_build_profile_active($name) && !get_buildoption($name)) {
+ $ENV{'DEB_BUILD_OPTIONS'} //= '';
+ $ENV{'DEB_BUILD_OPTIONS'} .= ' ' . $name;
+ warning("Copying ${name} into DEB_BUILD_OPTIONS: It was in DEB_BUILD_PROFILES and but not in DEB_BUILD_OPTIONS");
+ }
+}
=head1 SEE ALSO