[debhelper-devel] [Git][debian/debhelper][master] 2 commits: Drop support for DPKG_GAIN_ROOT_COMMAND

Niels Thykier gitlab at salsa.debian.org
Sun Jan 28 21:15:21 UTC 2018


Niels Thykier pushed to branch master at Debian / debhelper


Commits:
4692a8d4 by Niels Thykier at 2018-01-28T17:08:28+00:00
Drop support for DPKG_GAIN_ROOT_COMMAND

Signed-off-by: Niels Thykier <niels at thykier.net>

- - - - -
a15dba1b by Niels Thykier at 2018-01-28T21:13:22+00:00
Rely on DEB_RULES_REQUIRES_ROOT for R³ support

Signed-off-by: Niels Thykier <niels at thykier.net>

- - - - -


11 changed files:

- debian/changelog
- dh_testroot
- lib/Debian/Debhelper/Dh_Lib.pm
- t/Test/DH.pm
- t/buildsystems/buildsystem_tests.t
- t/dh_installdocs/dh_installdocs.t
- t/dh_installinit/dh_installinit.t
- t/dh_installsystemd/dh_installsystemd.t
- t/dh_installsystemd/dh_installsystemd_tmpfiles.t
- t/dh_installsystemd/dh_systemd.t
- t/maintscript.t


Changes:

=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -23,6 +23,9 @@ debhelper (11.1.4) UNRELEASED; urgency=medium
   * d/control: Bump (Build-)Dependency on dpkg to ensure that
     dpkg provides DEB_RULES_REQUIRES_ROOT and DEB_GAIN_ROOT_CMD
     as a part of its Rules-Requires-Root support.
+  * Dh_Lib.pm: Rely on DEB_RULRES_REQUIRES_ROOT instead of the
+    field to determine whether or not tools may "root-only"
+    actions (such as chown'ing).
 
  -- Niels Thykier <niels at thykier.net>  Sun, 21 Jan 2018 08:18:20 +0000
 


=====================================
dh_testroot
=====================================
--- a/dh_testroot
+++ b/dh_testroot
@@ -66,7 +66,7 @@ exit 0 if $< == 0;
 if ($requirements eq 'legacy-root') {
 	error("You must run this as root (or use fakeroot).");
 } else {
-	my $env = $ENV{DEB_GAIN_ROOT_CMD} // $ENV{DPKG_GAIN_ROOT_CMD};
+	my $env = $ENV{DEB_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;
 }


=====================================
lib/Debian/Debhelper/Dh_Lib.pm
=====================================
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -22,9 +22,6 @@ use constant {
 	'DH_BUILTIN_VERSION' => \'<DH_LIB_VERSION>', #'# Hi emacs.
 	# Default Package-Type / extension (must be aligned with dpkg)
 	'DEFAULT_PACKAGE_TYPE' => 'deb',
-
-	# Kill-switch for R³ (for backports)
-	'DH_ENABLE_RRR_SUPPORT' => 1,
 };
 
 use constant {
@@ -1363,7 +1360,7 @@ sub is_cross_compiling {
 # As a side effect, populates %package_arches and %package_types
 # with the types of all packages (not only those returned).
 my (%package_types, %package_arches, %package_multiarches, %packages_by_type,
-    %package_sections, $sourcepackage, %rrr, %package_cross_type);
+    %package_sections, $sourcepackage, %package_cross_type);
 
 # Returns source package name
 sub sourcepackage {
@@ -1406,11 +1403,6 @@ sub getpackages {
 		if (/^Source:\s*(.*)/i) {
 			$sourcepackage = $1;
 			next;
-		} elsif (/^Rules-Requires-Root:\s*(.*)/i) {
-			for my $keyword (split(' ', $1)) {
-				$rrr{$keyword} = 1;
-			}
-			next;
 		} elsif (/^Section:\s(.*)$/i) {
 			$source_section = $1;
 			next;
@@ -1419,7 +1411,6 @@ sub getpackages {
 		last if (!$_ or eof); # end of stanza.
 	}
 	error("could not find Source: line in control file.") if not defined($sourcepackage);
-	$rrr{'binary-targets'} = 1 if not %rrr;
 
 	while (<$fd>) {
 		chomp;
@@ -1512,32 +1503,36 @@ sub getpackages {
 # - Takes an optional keyword; if passed, this will return true if the keyword is listed in R^3 (Rules-Requires-Root)
 # - If the optional keyword is omitted or not present in R^3 and R^3 is not 'binary-targets', then returns false
 # - Returns true otherwise (i.e. keyword is in R^3 or R^3 is 'binary-targets')
-sub should_use_root {
-	my ($keyword) = @_;
-	return 1 if not DH_ENABLE_RRR_SUPPORT;
-	getpackages() if not %rrr;
-
-	return 0 if exists($rrr{'no'});
-	return 1 if exists($rrr{'binary-targets'});
-	return 0 if not defined($keyword);
-	return 1 if exists($rrr{$keyword});
-	return 0;
+{
+	my %rrr;
+	sub should_use_root {
+		my ($keyword) = @_;
+		my $rrr_env = $ENV{'DEB_RULES_REQUIRES_ROOT'} // 'binary-targets';
+		$rrr_env =~ s/^\s++//;
+		$rrr_env =~ s/\s++$//;
+		return 0 if $rrr_env eq 'no';
+		return 1 if $rrr_env eq 'binary-targets';
+		return 0 if not defined($keyword);
+
+		%rrr = map { $_ => 1 } split(' ', $rrr_env) if not %rrr;
+		return 1 if exists($rrr{$keyword});
+		return 0;
+	}
 }
 
 # 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{DEB_GAIN_ROOT_CMD} // $ENV{DPKG_GAIN_ROOT_CMD};
+	my $raw_cmd = $ENV{DEB_GAIN_ROOT_CMD};
 	return if not defined($raw_cmd) or $raw_cmd =~ m/^\s*+$/;
 	return split(' ', $raw_cmd);
 }
 
 sub root_requirements {
-	return 'legacy-root' if not DH_ENABLE_RRR_SUPPORT;
-
-	getpackages() if not %rrr;
-
-	return 'none' if exists($rrr{'no'});
-	return 'legacy-root' if exists($rrr{'binary-targets'});
+	my $rrr_env = $ENV{'DEB_RULES_REQUIRES_ROOT'} // 'binary-targets';
+	$rrr_env =~ s/^\s++//;
+	$rrr_env =~ s/\s++$//;
+	return 'none' if $rrr_env eq 'no';
+	return 'legacy-root' if $rrr_env eq 'binary-targets';
 	return 'targeted-promotion';
 }
 


=====================================
t/Test/DH.pm
=====================================
--- a/t/Test/DH.pm
+++ b/t/Test/DH.pm
@@ -26,6 +26,8 @@ $ENV{PATH} = "$ROOT_DIR:$ENV{PATH}" if $ENV{PATH} !~ m{\Q$ROOT_DIR\E/?:};
 $ENV{PERL5LIB} = join(':', "${ROOT_DIR}/lib", (grep { defined } $ENV{PERL5LIB}))
     if not $ENV{PERL5LIB} or $ENV{PERL5LIB} !~ m{\Q$ROOT_DIR\E(?:/lib)?/?:};
 $ENV{DH_AUTOSCRIPTDIR} = "$ROOT_DIR/autoscripts";
+# Nothing in the tests requires root.
+$ENV{DEB_RULES_REQUIRES_ROOT} = 'no';
 
 # Drop DEB_BUILD_PROFILES and DEB_BUILD_OPTIONS so they don't interfere
 delete($ENV{DEB_BUILD_PROFILES});
@@ -87,7 +89,7 @@ sub run_dh_tool {
 sub uid_0_test_is_ok {
     return $ROOT_OK if defined($ROOT_OK);
     my $ok = 0;
-    if (Debian::Debhelper::Dh_Lib::DH_ENABLE_RRR_SUPPORT or $< == 0) {
+    if ($< == 0) {
         $ok = 1;
     } else {
         system('fakeroot true 2>/dev/null');


=====================================
t/buildsystems/buildsystem_tests.t
=====================================
--- a/t/buildsystems/buildsystem_tests.t
+++ b/t/buildsystems/buildsystem_tests.t
@@ -252,6 +252,7 @@ $ENV{DEB_BUILD_OPTIONS} = "parallel=5";
 
 $tmp = write_debian_rules(<<'EOF');
 #!/usr/bin/make -f
+export DEB_RULES_REQUIRES_ROOT:=no
 override_dh_auto_build:
 	$(MAKE)
 %:


=====================================
t/dh_installdocs/dh_installdocs.t
=====================================
--- a/t/dh_installdocs/dh_installdocs.t
+++ b/t/dh_installdocs/dh_installdocs.t
@@ -22,9 +22,7 @@ if (uid_0_test_is_ok()) {
 	plan skip_all => 'fakeroot required';
 }
 
-my $NEEDS_ROOT = { 'needs_root' => 1 };
-my $NEEDS_ROOT_NODOC_PROFILE = {
-	'needs_root' => 1,
+my $NODOC_PROFILE = {
 	'env' => {
 		'DEB_BUILD_PROFILES' => 'nodoc',
 	},
@@ -33,14 +31,14 @@ my $NEEDS_ROOT_NODOC_PROFILE = {
 my $doc = "debian/docfile";
 
 each_compat_subtest {
-	ok(run_dh_tool($NEEDS_ROOT, 'dh_installdocs', '-pbar', $doc));
+	ok(run_dh_tool('dh_installdocs', '-pbar', $doc));
 	ok(-e "debian/bar/usr/share/doc/bar/docfile");
 	remove_tree(qw(debian/foo debian/bar debian/baz));
 };
 
 each_compat_subtest {
 	#regression in debhelper 9.20160702 (#830309)
-	ok(run_dh_tool($NEEDS_ROOT, 'dh_installdocs', '-pbaz', '--link-doc=foo', $doc));
+	ok(run_dh_tool('dh_installdocs', '-pbaz', '--link-doc=foo', $doc));
 
 	ok(-l "debian/baz/usr/share/doc/baz");
 	ok(readlink("debian/baz/usr/share/doc/baz") eq 'foo');
@@ -49,7 +47,7 @@ each_compat_subtest {
 };
 
 each_compat_subtest {
-	ok(run_dh_tool($NEEDS_ROOT, 'dh_installdocs', '-pfoo', '--link-doc=bar', $doc));
+	ok(run_dh_tool('dh_installdocs', '-pfoo', '--link-doc=bar', $doc));
 
 	ok(-l "debian/foo/usr/share/doc/foo");
 	ok(readlink("debian/foo/usr/share/doc/foo") eq 'bar');
@@ -61,7 +59,7 @@ each_compat_subtest {
 
 each_compat_subtest {
 	# docs are ignored, but copyright file is still there
-	ok(run_dh_tool($NEEDS_ROOT_NODOC_PROFILE, 'dh_installdocs', $doc));
+	ok(run_dh_tool($NODOC_PROFILE, 'dh_installdocs', $doc));
 	for my $pkg (qw(foo bar baz)) {
 		ok(! -e "debian/$pkg/usr/share/doc/$pkg/docfile");
 		ok(-e "debian/$pkg/usr/share/doc/$pkg/copyright");
@@ -71,7 +69,7 @@ each_compat_subtest {
 
 each_compat_subtest {
 	# docs are ignored, but symlinked doc dir is still there
-	ok(run_dh_tool($NEEDS_ROOT_NODOC_PROFILE, 'dh_installdocs', '-pfoo', '--link-doc=bar',  $doc));
+	ok(run_dh_tool($NODOC_PROFILE, 'dh_installdocs', '-pfoo', '--link-doc=bar',  $doc));
 	ok(-l "debian/foo/usr/share/doc/foo");
 	ok(readlink("debian/foo/usr/share/doc/foo") eq 'bar');
 	ok(! -e "debian/foo/usr/share/doc/bar/docfile");


=====================================
t/dh_installinit/dh_installinit.t
=====================================
--- a/t/dh_installinit/dh_installinit.t
+++ b/t/dh_installinit/dh_installinit.t
@@ -22,7 +22,7 @@ if (uid_0_test_is_ok()) {
 
 each_compat_up_to_and_incl_subtest(10, sub {
 	make_path(qw(debian/foo debian/bar debian/baz));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installinit'));
+	ok(run_dh_tool('dh_installinit'));
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	ok(find_script('foo', 'postinst'));
 	ok(run_dh_tool('dh_clean'));
@@ -32,14 +32,14 @@ each_compat_up_to_and_incl_subtest(10, sub {
 each_compat_from_and_above_subtest(11, sub {
 	make_path(qw(debian/foo debian/bar debian/baz));
 
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installinit'));
+	ok(run_dh_tool('dh_installinit'));
 	ok(! -e "debian/foo/lib/systemd/system/foo.service");
 	ok(!find_script('foo', 'postinst'));
 	ok(run_dh_tool('dh_clean'));
 
 	make_path(qw(debian/foo/lib/systemd/system/ debian/bar debian/baz));
 	install_file('debian/foo.service', 'debian/foo/lib/systemd/system/foo.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installinit'));
+	ok(run_dh_tool('dh_installinit'));
 	ok(!find_script('foo', 'postinst'));
 	ok(run_dh_tool('dh_clean'));
 });


=====================================
t/dh_installsystemd/dh_installsystemd.t
=====================================
--- a/t/dh_installsystemd/dh_installsystemd.t
+++ b/t/dh_installsystemd/dh_installsystemd.t
@@ -55,7 +55,7 @@ sub unit_is_started {
 
 # Units are installed and enabled
 each_compat_subtest {
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd'));
+	ok(run_dh_tool( 'dh_installsystemd'));
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	ok(find_script('foo', 'postinst'));
 	unit_is_enabled('foo', 'foo', 1);
@@ -66,7 +66,7 @@ each_compat_subtest {
 
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo2.service', 'debian/foo/lib/systemd/system/foo2.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd'));
+	ok(run_dh_tool('dh_installsystemd'));
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	ok(find_script('foo', 'postinst'));
 	unit_is_enabled('foo', 'foo', 1);
@@ -77,7 +77,7 @@ each_compat_subtest {
 
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo2.service', 'debian/foo/lib/systemd/system/foo2.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd', '--no-start'));
+	ok(run_dh_tool('dh_installsystemd', '--no-start'));
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	ok(find_script('foo', 'postinst'));
 	unit_is_enabled('foo', 'foo', 1);
@@ -88,8 +88,8 @@ each_compat_subtest {
 
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo2.service', 'debian/foo/lib/systemd/system/foo2.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd', '--no-start', 'debian/foo.service'));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd', '-p', 'foo', 'foo2.service'));
+	ok(run_dh_tool('dh_installsystemd', '--no-start', 'debian/foo.service'));
+	ok(run_dh_tool('dh_installsystemd', '-p', 'foo', 'foo2.service'));
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	ok(find_script('foo', 'postinst'));
 	unit_is_enabled('foo', 'foo', 1);
@@ -100,8 +100,8 @@ each_compat_subtest {
 
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo2.service', 'debian/foo/lib/systemd/system/foo2.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd', '--no-enable', 'debian/foo.service'));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd', '-p', 'foo', 'foo2.service'));
+	ok(run_dh_tool('dh_installsystemd', '--no-enable', 'debian/foo.service'));
+	ok(run_dh_tool('dh_installsystemd', '-p', 'foo', 'foo2.service'));
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	ok(find_script('foo', 'postinst'));
 	unit_is_enabled('foo', 'foo', 0, 1); # Disabled units are still masked on removal
@@ -111,7 +111,7 @@ each_compat_subtest {
 	ok(run_dh_tool('dh_clean'));
 
 	make_path('debian/foo/lib/systemd/system/');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd', '--no-restart-after-upgrade'));
+	ok(run_dh_tool('dh_installsystemd', '--no-restart-after-upgrade'));
 	my @foo_postinst = find_script('foo', 'postinst');
 	ok(@foo_postinst);
 	my $matches = @foo_postinst ? grep { m{deb-systemd-invoke start .*foo.service} } `cat @foo_postinst` : -1;
@@ -121,7 +121,7 @@ each_compat_subtest {
 	# Quoting #764730
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo.service', 'debian/foo/lib/systemd/system/foo\x2dfuse.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd'));
+	ok(run_dh_tool('dh_installsystemd'));
 	unit_is_enabled('foo', 'foo\x2dfuse', 1);
 	unit_is_started('foo', 'foo\x2dfuse', 1);
 	ok(run_dh_tool('dh_clean'));
@@ -129,12 +129,12 @@ each_compat_subtest {
 	# --name flag #870768
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo2.service', 'debian/foo/lib/systemd/system/foo2.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd', '--name=foo'));
+	ok(run_dh_tool('dh_installsystemd', '--name=foo'));
 	unit_is_enabled('foo', 'foo', 1);
 	unit_is_started('foo', 'foo', 1);
 	unit_is_enabled('foo', 'foo2', 0);
 	unit_is_started('foo', 'foo2', 0);
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd', '--name=foo2'));
+	ok(run_dh_tool('dh_installsystemd', '--name=foo2'));
 	unit_is_enabled('foo', 'foo', 1);
 	unit_is_started('foo', 'foo', 1);
 	unit_is_enabled('foo', 'foo2', 1);


=====================================
t/dh_installsystemd/dh_installsystemd_tmpfiles.t
=====================================
--- a/t/dh_installsystemd/dh_installsystemd_tmpfiles.t
+++ b/t/dh_installsystemd/dh_installsystemd_tmpfiles.t
@@ -25,8 +25,8 @@ if (uid_0_test_is_ok()) {
 each_compat_from_and_above_subtest(11, sub {
 	make_path('debian/foo/usr/lib/tmpfiles.d');
 	create_empty_file('debian/foo/usr/lib/tmpfiles.d/foo.conf');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installinit'));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_installsystemd'));
+	ok(run_dh_tool('dh_installinit'));
+	ok(run_dh_tool('dh_installsystemd'));
 	ok(-e "debian/foo/etc/init.d/foo");
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	my @postinst = find_script('foo', 'postinst');


=====================================
t/dh_installsystemd/dh_systemd.t
=====================================
--- a/t/dh_installsystemd/dh_systemd.t
+++ b/t/dh_installsystemd/dh_systemd.t
@@ -51,8 +51,8 @@ sub unit_is_started {
 
 # Units are installed and enabled
 each_compat_up_to_and_incl_subtest(10, sub {
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_enable'));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_start'));
+	ok(run_dh_tool('dh_systemd_enable'));
+	ok(run_dh_tool('dh_systemd_start'));
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	ok(-e "debian/foo.postinst.debhelper");
 	unit_is_enabled('foo', 'foo', 1);
@@ -63,8 +63,8 @@ each_compat_up_to_and_incl_subtest(10, sub {
 
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo2.service', 'debian/foo/lib/systemd/system/foo2.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_enable'));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_start'));
+	ok(run_dh_tool('dh_systemd_enable'));
+	ok(run_dh_tool('dh_systemd_start'));
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	ok(-e "debian/foo.postinst.debhelper");
 	unit_is_enabled('foo', 'foo', 1);
@@ -75,8 +75,8 @@ each_compat_up_to_and_incl_subtest(10, sub {
 
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo2.service', 'debian/foo/lib/systemd/system/foo2.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_enable'));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_start', '--no-start'));
+	ok(run_dh_tool('dh_systemd_enable'));
+	ok(run_dh_tool('dh_systemd_start', '--no-start'));
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	ok(-e "debian/foo.postinst.debhelper");
 	unit_is_enabled('foo', 'foo', 1);
@@ -87,9 +87,9 @@ each_compat_up_to_and_incl_subtest(10, sub {
 
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo2.service', 'debian/foo/lib/systemd/system/foo2.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_enable'));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_start', '--no-start', 'debian/foo.service'));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_start', '-p', 'foo', 'foo2.service'));
+	ok(run_dh_tool('dh_systemd_enable'));
+	ok(run_dh_tool('dh_systemd_start', '--no-start', 'debian/foo.service'));
+	ok(run_dh_tool('dh_systemd_start', '-p', 'foo', 'foo2.service'));
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	ok(-e "debian/foo.postinst.debhelper");
 	unit_is_enabled('foo', 'foo', 1);
@@ -100,9 +100,9 @@ each_compat_up_to_and_incl_subtest(10, sub {
 
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo2.service', 'debian/foo/lib/systemd/system/foo2.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_enable', '--no-enable', 'debian/foo.service'));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_enable', '-p', 'foo', 'foo2.service'));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_start'));
+	ok(run_dh_tool('dh_systemd_enable', '--no-enable', 'debian/foo.service'));
+	ok(run_dh_tool('dh_systemd_enable', '-p', 'foo', 'foo2.service'));
+	ok(run_dh_tool('dh_systemd_start'));
 	ok(-e "debian/foo/lib/systemd/system/foo.service");
 	ok(-e "debian/foo.postinst.debhelper");
 	unit_is_enabled('foo', 'foo', 0, 1); # Disabled units are still masked on removal
@@ -113,7 +113,7 @@ each_compat_up_to_and_incl_subtest(10, sub {
 
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo.service', 'debian/foo/lib/systemd/system/foo.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_start', '--no-restart-after-upgrade'));
+	ok(run_dh_tool('dh_systemd_start', '--no-restart-after-upgrade'));
         my $matches = grep { m{deb-systemd-invoke start .*foo.service} } `cat debian/foo.postinst.debhelper`;
 	ok($matches == 1);
 	ok(run_dh_tool('dh_clean'));
@@ -121,8 +121,8 @@ each_compat_up_to_and_incl_subtest(10, sub {
 	# Quoting #764730
 	make_path('debian/foo/lib/systemd/system/');
 	install_file('debian/foo.service', 'debian/foo/lib/systemd/system/foo\x2dfuse.service');
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_enable'));
-	ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_start'));
+	ok(run_dh_tool('dh_systemd_enable'));
+	ok(run_dh_tool('dh_systemd_start'));
 	unit_is_enabled('foo', 'foo\x2dfuse', 1);
 	unit_is_started('foo', 'foo\x2dfuse', 1);
 	ok(run_dh_tool('dh_clean'));


=====================================
t/maintscript.t
=====================================
--- a/t/maintscript.t
+++ b/t/maintscript.t
@@ -29,7 +29,7 @@ mv_conffile /etc/2 /etc/3 1.0-1
 EOF
 	close($fd) or die("close($file): $!\n");
 
-	run_dh_tool( { 'needs_root' => 1 }, 'dh_installdeb');
+	run_dh_tool('dh_installdeb');
 
 	for my $script (@scripts) {
 		my @output=`cat debian/debhelper.$script.debhelper`;
@@ -50,7 +50,7 @@ ${contents}
 EOF
 	close($fd) or die("close($file): $!\n");
 
-	my $res = run_dh_tool( { 'needs_root' => 1, 'quiet' => 1 }, 'dh_installdeb');
+	my $res = run_dh_tool( { 'quiet' => 1 }, 'dh_installdeb');
 
 	remove_tree('debian/debhelper', 'debian/tmp', 'debian/.debhelper');
 	rm_files(@scripts);



View it on GitLab: https://salsa.debian.org/debian/debhelper/compare/b035cb584224719a8e997832ffc9373718aeb7d0...a15dba1b8f9e17ffc5b31364e12f54d0fd0684e3

---
View it on GitLab: https://salsa.debian.org/debian/debhelper/compare/b035cb584224719a8e997832ffc9373718aeb7d0...a15dba1b8f9e17ffc5b31364e12f54d0fd0684e3
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/debhelper-devel/attachments/20180128/49b1e46c/attachment-0001.html>


More information about the debhelper-devel mailing list