Hi Russ,
On Tue, Aug 18, 2015 at 01:03:34PM -0700, Russ Allbery wrote:
> Lior Kaplan <kap...@zend.com> writes:
> 
> > Package: git-buildpackage
> > Version: 0.6.32
> > Severity: normal
> 
> > $ git-pbuilder create
> > /usr/bin/git-pbuilder: line 243: sudo: command not found
> 
> > git-pbuilder needs sudo to work, but sudo isn't a mandatory package
> > (priority optional). Please add a dependency to make sure it wouldn't
> > fail.
> 
> It may be worth noting that this is an optional feature; I'm not sure how
> many people use that interface.  (I actually don't myself; I just use it
> for building.)  Also, just having sudo installed isn't enough.  You also
> have to have the sudo rules set up to allow the user to run cowbuilder,
> and since that gives the user root on the local host without a whole lot
> of work, I'm not sure if it's something we want to set up by default.

I've applied the attached patch in git-buildpackage. Can this go
upstream?
Cheers
 -- Guido
>From 4be0df7cd46f26413c7dae2e7db3a355afa65b1e Mon Sep 17 00:00:00 2001
Message-Id: <4be0df7cd46f26413c7dae2e7db3a355afa65b1e.1440077355.git....@sigxcpu.org>
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <a...@sigxcpu.org>
Date: Thu, 20 Aug 2015 11:42:54 +0200
Subject: [PATCH] Check for sudo

Closes: #796046
---
 bin/git-pbuilder | 6 ++++++
 debian/control   | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/bin/git-pbuilder b/bin/git-pbuilder
index 31bf3b1..379227d 100644
--- a/bin/git-pbuilder
+++ b/bin/git-pbuilder
@@ -239,6 +239,12 @@ if [ -n "$action" ]; then
         OPTIONS+=( --configfile "$HOME/.pbuilderrc" )
     fi
 
+    if ! which sudo >/dev/null 2>&1; then
+        echo 'sudo not found in $PATH; you need to install the sudo package'
+        echo 'and allow the current user to invoke the builder via sudo' >&2
+        exit 1
+    fi
+
     # Run the builder.
     if [ no = "$GIT_PBUILDER_AUTOCONF" ] ; then
         sudo "$BUILDER" "$action" "${OPTIONS[@]}" "$@"
diff --git a/debian/control b/debian/control
index 47ccf29..e642b11 100644
--- a/debian/control
+++ b/debian/control
@@ -50,7 +50,7 @@ Depends: ${python:Depends},
 Recommends: pristine-tar (>= 0.5),
  cowbuilder | pbuilder | sbuild,
  python-requests
-Suggests: python-notify, unzip
+Suggests: python-notify, unzip, sudo
 Description: Suite to help with Debian packages in Git repositories
  This package contains the following tools:
   * gbp import-{dsc,dscs}: import existing Debian source packages into a git
-- 
2.1.4

Reply via email to