[debhelper-devel] [debhelper] 01/01: R³ support: DPKG_GAIN_ROOT_CMD => DEB_GAIN_ROOT_CMD

Niels Thykier nthykier at moszumanska.debian.org
Tue Jan 2 17:42:59 UTC 2018


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit a9a69a80c8527a2ed49c3a147d7aff2ca8d63f8e
Author: Niels Thykier <niels at thykier.net>
Date:   Tue Jan 2 17:40:59 2018 +0000

    R³ support: DPKG_GAIN_ROOT_CMD => DEB_GAIN_ROOT_CMD
    
    We are renaming DPKG_GAIN_ROOT_CMD to DEB_GAIN_ROOT_CMD for
    consistency with other dpkg variables.
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog               | 2 ++
 dh_testroot                    | 6 +++---
 lib/Debian/Debhelper/Dh_Lib.pm | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d79284d..b697f20 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -59,6 +59,8 @@ debhelper (11.1) UNRELEASED; urgency=medium
   * d/control: Add a Breaks against cmake (<< 3.8~) to ensure that
     cmake response to the /run change in compat 11.  Thanks to
     Adrian Bunk for the suggestion.  (Closes: #886127)
+  * Dh_Lib.pm/dh_testroot: Support the DEB_GAIN_ROOT_CMD environment
+    that replaces DPKG_GAIN_ROOT_CMD.
 
  -- Niels Thykier <niels at thykier.net>  Sun, 17 Dec 2017 07:59:18 +0000
 
diff --git a/dh_testroot b/dh_testroot
index 91ac26a..60bd15f 100755
--- a/dh_testroot
+++ b/dh_testroot
@@ -32,7 +32,7 @@ B<dh_testroot> returns successfully.
 =item Any other value than the above
 
 B<dh_testroot> asserts that it is either run as root (or under
-L<fakeroot(1)>) or the builder has provided the B<DPKG_GAIN_ROOT_CMD>
+L<fakeroot(1)>) or the builder has provided the B<DEB_GAIN_ROOT_CMD>
 environment variable (e.g. via dpkg-buildpackage -r).
 
 =back
@@ -66,8 +66,8 @@ exit 0 if $< == 0;
 if ($requirements eq 'legacy-root') {
 	error("You must run this as root (or use fakeroot).");
 } else {
-	my $env = $ENV{'DPKG_GAIN_ROOT_CMD'};
-	error("Package needs targetted root but builder has not provided a gain-root command via \${DPKG_GAIN_ROOT_CMD}")
+	my $env = $ENV{DEB_GAIN_ROOT_CMD} // $ENV{DPKG_GAIN_ROOT_CMD};
+	error("Package needs targetted root but builder has not provided a gain-root command via \${DEB_GAIN_ROOT_CMD}")
 		if not $env;
 }
 
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index eded957..82f0761 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -1496,7 +1496,7 @@ sub should_use_root {
 
 # Returns the "gain root command" as a list suitable for passing as a part of the command to "doit()"
 sub gain_root_cmd {
-	my $raw_cmd = $ENV{DPKG_GAIN_ROOT_CMD};
+	my $raw_cmd = $ENV{DEB_GAIN_ROOT_CMD} // $ENV{DPKG_GAIN_ROOT_CMD};
 	return if not defined($raw_cmd) or $raw_cmd =~ m/^\s*+$/;
 	return split(' ', $raw_cmd);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list