The following commit has been merged in the master branch:
commit 8316452eb9a102b9f24901d691eb05589ad7ebae
Author: James Vega <[email protected]>
Date:   Sat Apr 2 21:09:29 2011 -0400

    mk-build-deps: Add MKBUILDDEPS_ROOTCMD configuration variable
    
    Signed-off-by: James Vega <[email protected]>

diff --git a/conf.default.in b/conf.default.in
index 3e290c1..7e2b3a6 100644
--- a/conf.default.in
+++ b/conf.default.in
@@ -481,6 +481,9 @@
 #
 # Remove package files after install?
 # MKBUILDDEPS_REMOVE_AFTER_INSTALL=yes
+#
+# Tool used to gain root privileges to install the deb
+# MKBUILDDEPS_ROOTCMD=''
 
 ##### namecheck
 #
diff --git a/debian/changelog b/debian/changelog
index c5076d3..53883d3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,11 @@ devscripts (2.10.72) UNRELEASED; urgency=low
     patch.  (Closes: #616630)
   * pts-subscribe: Do not perform arithmetic comparison of --until argument.
     Thanks to Stefano Rivera for the patch.  (Closes: #620194)
+  * mk-build-deps:
+    + Add --root-cmd option to install the build-dep .deb.  Thanks to Felipe
+      Sateler for the patch.  (Closes: #615135)
+    + Add MKBUILDDEPS_ROOTCMD configuration variable.
+    + Show modified configuration variables in usage.
 
   [ Ron Lee ]
   * cowpoke: add a --return option that copies the build results back to a
diff --git a/debian/postinst b/debian/postinst
index c6d3882..d2613a1 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -708,6 +708,17 @@ EOF
 
 EOF
        fi
+
+       if dpkg --compare-versions "$2" lt 2.10.72
+       then
+           cat >> /etc/devscripts.conf << EOF
+#### mk-build-deps option added in 2.10.72
+#
+# Tool used to gain root privileges to install the deb
+# MKBUILDDEPS_ROOTCMD=''
+
+EOF
+       fi
     fi
 fi
 
diff --git a/scripts/mk-build-deps.pl b/scripts/mk-build-deps.pl
index 6f303e4..d3c8c4a 100755
--- a/scripts/mk-build-deps.pl
+++ b/scripts/mk-build-deps.pl
@@ -108,6 +108,7 @@ use Getopt::Long;
 use File::Basename;
 use Pod::Usage;
 use Dpkg::Control;
+use Text::ParseWords;
 
 my $progname = basename($0);
 my $opt_install;
@@ -121,8 +122,9 @@ my @deb_files;
 
 my @config_files = ('/etc/devscripts.conf', '~/.devscripts');
 my %config_vars = (
-                   'MKBUILDDEPS_TOOL' => 'apt-get',
-                   'MKBUILDDEPS_REMOVE_AFTER_INSTALL' => 'no'
+                   'MKBUILDDEPS_TOOL' => '/usr/bin/apt-get',
+                   'MKBUILDDEPS_REMOVE_AFTER_INSTALL' => 'no',
+                   'MKBUILDDEPS_ROOTCMD' => '',
                    );
 my %config_default = %config_vars;
 
@@ -140,9 +142,11 @@ my $shell_out = `/bin/bash -c '$shell_cmd'`;
 
 # Check validity
 $config_vars{'MKBUILDDEPS_TOOL'} =~ /./
-       or $config_vars{'MKBUILDDEPS_TOOL'}='/usr/bin/apt-get';
+       or $config_vars{'MKBUILDDEPS_TOOL'}=$config_default{'MKBUILDDEPS_TOOL'};
 $config_vars{'MKBUILDDEPS_REMOVE_AFTER_INSTALL'} =~ /^(yes|no)$/
-       or $config_vars{'MKBUILDDEPS_REMOVE_AFTER_INSTALL'}='no';
+       or 
$config_vars{'MKBUILDDEPS_REMOVE_AFTER_INSTALL'}=$config_default{'MKBUILDDEPS_REMOVE_AFTER_INSTALL'};
+$config_vars{'MKBUILDDEPS_ROOTCMD'} =~ /./
+       or 
$config_vars{'MKBUILDDEPS_ROOTCMD'}=$config_default{'MKBUILDDEPS_ROOTCMD'};
 
 $install_tool = $config_vars{'MKBUILDDEPS_TOOL'};
 
@@ -150,6 +154,29 @@ if ($config_vars{'MKBUILDDEPS_REMOVE_AFTER_INSTALL'} =~ 
/yes/) {
        $opt_remove=1;
 }
 
+sub usage {
+    my ($exitval) = @_;
+
+    my $verbose = $exitval ? 0 : 1;
+    pod2usage({ -exitval => 'NOEXIT', -verbose => $verbose });
+
+    if ($verbose) {
+       my $modified_conf_msg;
+       foreach my $var (sort keys %config_vars) {
+           if ($config_vars{$var} ne $config_default{$var}) {
+               $modified_conf_msg .= "  $var=$config_vars{$var}\n";
+           }
+       }
+       $modified_conf_msg ||= "  (none)\n";
+       chomp $modified_conf_msg;
+       print <<EOF;
+Default settings modified by devscripts configuration files:
+$modified_conf_msg
+EOF
+    }
+
+    exit $exitval;
+}
 
 GetOptions("help|h" => \$opt_help,
            "version|v" => \$opt_version,
@@ -161,9 +188,10 @@ GetOptions("help|h" => \$opt_help,
            "build-indep|A" => \$opt_indep,
            "root-cmd|s=s" => \$root_cmd,
            )
-    or pod2usage({ -exitval => 1, -verbose => 0 });
+    or usage(1);
+
+usage(0) if ($opt_help);
 
-pod2usage({ -exitval => 0, -verbose => 1 }) if ($opt_help);
 if ($opt_version) { version(); exit 0; }
 
 if (!@ARGV) {
@@ -172,7 +200,7 @@ if (!@ARGV) {
     }
 }
 
-pod2usage({ -exitval => 1, -verbose => 0 }) unless @ARGV;
+usage(1) unless @ARGV;
 
 system("command -v equivs-build >/dev/null 2>&1");
 if ($?) {
@@ -246,8 +274,6 @@ while ($control = shift) {
     }
 }
 
-use Text::ParseWords;
-
 if ($opt_install) {
     for my $package (@packages) {
        my $file = glob "${package}_*.deb";

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to