Просмотр исходного кода

dpkg-buildpackage: Detect missing gain-root-command even if running as root

Give a proper error message instead of a failed to execute the command
message later on.
Guillem Jover лет назад: 12
Родитель
Сommit
be3bb946ce
2 измененных файлов с 10 добавлено и 8 удалено
  1. 2 0
      debian/changelog
  2. 8 8
      scripts/dpkg-buildpackage.pl

+ 2 - 0
debian/changelog

@@ -5,6 +5,8 @@ dpkg (1.17.6) UNRELEASED; urgency=low
   * Add new --check-command and --check-option options to dpkg-buildpackage,
     and DEB_CHECK_COMMAND environment variable as a default value, to
     specify a package checker to use before the signing process.
+  * Detect a missing gain-root-command even if dpkg-buildpackage is running
+    as root.
 
   [ Updated scripts translations ]
   * German (Helge Kreutzmann).

+ 8 - 8
scripts/dpkg-buildpackage.pl

@@ -297,15 +297,15 @@ if ($< == 0) {
     warning(_g('using a gain-root-command while being root')) if (@rootcommand);
 } else {
     push @rootcommand, 'fakeroot' unless @rootcommand;
+}
 
-    if (!find_command($rootcommand[0])) {
-	if ($rootcommand[0] eq 'fakeroot') {
-	    error(_g("fakeroot not found, either install the fakeroot\n" .
-	             'package, specify a command with the -r option, ' .
-	             'or run this as root'));
-	} else {
-	    error(_g("gain-root-commmand '%s' not found"), $rootcommand[0]);
-	}
+if (@rootcommand and not find_command($rootcommand[0])) {
+    if ($rootcommand[0] eq 'fakeroot' and $< != 0) {
+        error(_g("fakeroot not found, either install the fakeroot\n" .
+                 'package, specify a command with the -r option, ' .
+                 'or run this as root'));
+    } else {
+        error(_g("gain-root-commmand '%s' not found"), $rootcommand[0]);
     }
 }