Package: devscripts
Version: 2.10.71
Severity: wishlist

I just realized mk-build-deps has the very useful -i option. However,
this requires mk-build-deps to run as root. Since generating the
build-deps package without installing it makes little sense, I aliased
mk-build-deps to 'mk-build-deps -i -r'. However, this fails because it
needs root privileges and the aliasing doesn't work under sudo.
Please add an option to make mk-build-deps automatically gain root
privileges. A patch is attached.


-- Package-specific info:

--- /etc/devscripts.conf ---

--- ~/.devscripts ---
DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i"
DEBUILD_PRESERVE_ENVVARS="DISPLAY"
DEBUILD_LINTIAN=yes
DEBUILD_LINTIAN_OPTS="-iI --pedantic"
DEBCHANGE_RELEASE_HEURISTIC=changelog
DEBCHANGE_MULTIMAINT_MERGE=yes

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.37-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages devscripts depends on:
ii  dpkg-dev                      1.15.8.10  Debian package development tools
ii  libc6                         2.11.2-11  Embedded GNU C Library: Shared lib
ii  perl                          5.10.1-17  Larry Wall's Practical Extraction 

Versions of packages devscripts recommends:
ii  at                 3.1.12-1              Delayed job execution and batch pr
ii  bsd-mailx [mailx]  8.1.2-0.20100314cvs-1 simple mail user agent
ii  chromium-browser [ 9.0.597.98~r74359-1   Chromium browser
ii  curl               7.21.3-1              Get a file from an HTTP, HTTPS or 
ii  cvs                1:1.12.13-12          Concurrent Versions System
ii  dctrl-tools        2.18                  Command-line tools to process Debi
ii  debian-keyring [de 2011.01.24            GnuPG keys of Debian Developers
ii  dput               0.9.6.1               Debian package upload tool
ii  epiphany-browser [ 2.30.6-1              Intuitive GNOME web browser
ii  equivs             2.0.8                 Circumvent Debian package dependen
ii  fakeroot           1.14.5-2              Gives a fake root environment
ii  git [git-core]     1:1.7.4.1-1           fast, scalable, distributed revisi
ii  gnupg              1.4.11-3              GNU privacy guard - a free PGP rep
ii  heirloom-mailx [ma 12.4-2                feature-rich BSD mail(1)
ii  iceweasel [www-bro 3.5.16-4              Web browser based on Firefox
ii  libauthen-sasl-per 2.1500-1              Authen::SASL - SASL Authentication
ii  libcrypt-ssleay-pe 0.57-2                Support for https protocol in LWP
ii  libjson-perl       2.27-1                Perl module to parse and convert t
ii  libparse-debcontro 2.005-2               Easy OO parsing of Debian control-
ii  libsoap-lite-perl  0.712-2               Perl implementation of a SOAP clie
ii  libterm-size-perl  0.2-4+b1              Perl extension for retrieving term
ii  libtimedate-perl   1.2000-1              collection of modules to manipulat
ii  liburi-perl        1.58-1                module to manipulate and access UR
ii  libwww-perl        5.837-1               simple and consistent interface to
ii  libyaml-syck-perl  1.17-1                Perl module providing a fast, ligh
ii  lintian            2.4.3                 Debian package checker
ii  lsb-release        3.2-27                Linux Standard Base version report
ii  lynx-cur [www-brow 2.8.8dev.8-1          Text-mode WWW Browser with NLS sup
ii  lzma               4.43-14               Compression method of 7z format in
ii  man-db             2.5.9-4               on-line manual pager
ii  mercurial          1.7.5-1               scalable distributed version contr
ii  openssh-client [ss 1:5.8p1-2             secure shell (SSH) client, for sec
ii  patch              2.6.1-1               Apply a diff file to an original
ii  patchutils         0.3.2-1               Utilities to work with patches
ii  sensible-utils     0.0.6                 Utilities for sensible alternative
ii  strace             4.5.20-2              A system call tracer
ii  subversion         1.6.12dfsg-4          Advanced version control system
ii  tla                1.3.5+dfsg-16         GNU Arch revision control system
ii  unzip              6.0-4                 De-archiver for .zip files
ii  wdiff              0.6.3-1               Compares two files word by word
ii  wget               1.12-2.1              retrieves files from the web
ii  xz-utils           5.0.0-2               XZ-format compression utilities

Versions of packages devscripts suggests:
ii  build-essential        11.5              Informational list of build-essent
pn  cvs-buildpackage       <none>            (no description available)
pn  devscripts-el          <none>            (no description available)
pn  gnuplot                <none>            (no description available)
pn  libfile-desktopentry-p <none>            (no description available)
ii  libnet-smtp-ssl-perl   1.01-3            Perl module providing SSL support 
ii  mutt                   1.5.20-9+squeeze1 text-based mailreader supporting M
pn  svn-buildpackage       <none>            (no description available)
pn  w3m                    <none>            (no description available)

-- no debconf information
>From 1769a424e491d3a16ac3c911cf654455a33c1a77 Mon Sep 17 00:00:00 2001
From: Felipe Sateler <fsate...@debian.org>
Date: Fri, 25 Feb 2011 20:41:24 -0300
Subject: [PATCH 1/2] Add an option to gain root privileges

If the install switch is provided and the new option used, the tool is
used to gain root privilegeAdd an option to gain root privileges
---
 scripts/mk-build-deps.pl |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/scripts/mk-build-deps.pl b/scripts/mk-build-deps.pl
index 192b084..23c357a 100755
--- a/scripts/mk-build-deps.pl
+++ b/scripts/mk-build-deps.pl
@@ -84,6 +84,11 @@ Show a summary of options.
 
 Show version and copyright information.
 
+=item B<-s>, B<--root-cmd>
+
+Use the specified tool to gain root privileges before installing.
+Ignored if not used with the install switch.
+
 =back
 
 =head1 AUTHOR
@@ -110,6 +115,7 @@ my $opt_remove=0;
 my ($opt_help, $opt_version, $opt_arch, $opt_dep, $opt_indep);
 my $control;
 my $install_tool;
+my $root_cmd;
 my @packages;
 my @deb_files;
 
@@ -153,6 +159,7 @@ GetOptions("help|h" => \$opt_help,
            "arch|a=s" => \$opt_arch,
            "build-dep|B" => \$opt_dep,
            "build-indep|A" => \$opt_indep,
+           "root-cmd|s=s" => \$root_cmd,
            )
     or pod2usage({ -exitval => 1, -verbose => 0 });
 
@@ -247,8 +254,14 @@ if ($opt_install) {
        push @deb_files, $file;
     }
 
-    system 'dpkg', '--unpack', @deb_files;
-    system shellwords($install_tool), '-f', 'install';
+    if($root_cmd) {
+        system shellwords($root_cmd), 'dpkg', '--unpack', @deb_files;
+        system shellwords($root_cmd), shellwords($install_tool), '-f', 
'install';
+    }
+    else {
+        system 'dpkg', '--unpack', @deb_files;
+        system shellwords($install_tool), '-f', 'install';
+    }
 
     if ($opt_remove) {
        foreach my $file (@deb_files) {
-- 
1.7.4.1

>From 60be0a8e3a35652e34e942c7c56f3d513fa03767 Mon Sep 17 00:00:00 2001
From: Felipe Sateler <fsate...@debian.org>
Date: Fri, 25 Feb 2011 20:51:45 -0300
Subject: [PATCH 2/2] Abort mk-build-deps if installation of package fails

---
 scripts/mk-build-deps.pl |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/scripts/mk-build-deps.pl b/scripts/mk-build-deps.pl
index 23c357a..6f303e4 100755
--- a/scripts/mk-build-deps.pl
+++ b/scripts/mk-build-deps.pl
@@ -256,11 +256,15 @@ if ($opt_install) {
 
     if($root_cmd) {
         system shellwords($root_cmd), 'dpkg', '--unpack', @deb_files;
+        die("dpkg call failed\n") if ( ($?>>8) != 0 );
         system shellwords($root_cmd), shellwords($install_tool), '-f', 
'install';
+        die("install call failed\n") if ( ($?>>8) != 0 );
     }
     else {
         system 'dpkg', '--unpack', @deb_files;
+        die("dpkg call failed\n") if ( ($?>>8) != 0 );
         system shellwords($install_tool), '-f', 'install';
+        die("install call failed\n") if ( ($?>>8) != 0 );
     }
 
     if ($opt_remove) {
-- 
1.7.4.1

Reply via email to