[devscripts] 02/02: Only validate --debs-dir/DEBRELEASE_DEBS_DIR if it's used

James McCoy jamessan at debian.org
Fri Aug 8 02:58:18 UTC 2014


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit cce56393692a5d91e183ecd393140af6b338aabf
Author: James McCoy <jamessan at debian.org>
Date:   Thu Aug 7 22:53:44 2014 -0400

    Only validate --debs-dir/DEBRELEASE_DEBS_DIR if it's used
    
    Closes: #544366
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog   |  6 ++++++
 scripts/debi.pl    | 30 +++++++++++++-----------------
 scripts/debsign.sh | 20 +++++++-------------
 3 files changed, 26 insertions(+), 30 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 24eb5cf..c6e6d5b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,16 @@
 devscripts (2.14.7) UNRELEASED; urgency=low
 
+  [ Cyril Brulebois ]
   * deb-reversion: update change_version(), fixing the missing call_hook
     statement in the udeb case. That was overlooked when the changelog
     massaging was made conditional, and causes hooks to be ignored for
     udebs.
 
+  [ James McCoy ]
+  * debsign/debi/debc: Delay checking for the existence of the
+    --debs-dir/DEBRELEASE_DEBS_DIR directory until we get to code that
+    actually uses said directory.  (Closes: #544366)
+
  -- Cyril Brulebois <kibi at debian.org>  Fri, 08 Aug 2014 01:27:12 +0200
 
 devscripts (2.14.6) unstable; urgency=medium
diff --git a/scripts/debi.pl b/scripts/debi.pl
index b9b85a3..56379b6 100755
--- a/scripts/debi.pl
+++ b/scripts/debi.pl
@@ -119,7 +119,7 @@ the GNU General Public License, version 2 or later.
 EOF
 
 # Start by setting default values
-my $debsdir = '..';
+my $debsdir;
 my $debsdir_warning;
 my $check_dirname_level = 1;
 my $check_dirname_regex = 'PACKAGE(-.+)?';
@@ -159,9 +159,7 @@ if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
     # installing a broken package
     $config_vars{'DEBRELEASE_DEBS_DIR'} =~ s%/+%/%;
     $config_vars{'DEBRELEASE_DEBS_DIR'} =~ s%(.)/$%$1%;
-    if (! -d $config_vars{'DEBRELEASE_DEBS_DIR'}) {
-	$debsdir_warning = "config file specified DEBRELEASE_DEBS_DIR directory $config_vars{'DEBRELEASE_DEBS_DIR'} does not exist!";
-    }
+    $debsdir_warning = "config file specified DEBRELEASE_DEBS_DIR directory $config_vars{'DEBRELEASE_DEBS_DIR'} does not exist!";
 
     foreach my $var (sort keys %config_vars) {
 	if ($config_vars{$var} ne $config_default{$var}) {
@@ -207,19 +205,6 @@ my ($targetarch, $targetgnusystem);
 $targetarch = $opt_a ? "-a$opt_a" : "";
 $targetgnusystem = $opt_t ? "-t$opt_t" : "";
 
-if ($opt_debsdir) {
-    $opt_debsdir =~ s%/+%/%;
-    $opt_debsdir =~ s%(.)/$%$1%;
-    if (! -d $opt_debsdir) {
-	$debsdir_warning = "--debs-dir directory $opt_debsdir does not exist!";
-    }
-    $debsdir = $opt_debsdir;
-}
-
-if ($debsdir_warning) {
-    die "$progname: $debsdir_warning\n";
-}
-
 if (defined $opt_level) {
     if ($opt_level =~ /^[012]$/) { $check_dirname_level = $opt_level; }
     else {
@@ -249,6 +234,17 @@ chomp $arch;
 my $chdir = 0;
 
 if (! defined $changes) {
+    if ($opt_debsdir) {
+	$opt_debsdir =~ s%/+%/%;
+	$opt_debsdir =~ s%(.)/$%$1%;
+	$debsdir_warning = "--debs-dir directory $opt_debsdir does not exist!";
+	$debsdir = $opt_debsdir;
+    }
+
+    if (! -d $debsdir) {
+	die "$progname: $debsdir_warning\n";
+    }
+
     # Look for .changes file via debian/changelog
     until (-r 'debian/changelog') {
 	$chdir = 1;
diff --git a/scripts/debsign.sh b/scripts/debsign.sh
index 672e1a8..1fc5ff2 100755
--- a/scripts/debsign.sh
+++ b/scripts/debsign.sh
@@ -277,9 +277,6 @@ else
     # We do not replace this with a default directory to avoid accidentally
     # signing a broken package
     DEBRELEASE_DEBS_DIR="$(echo "${DEBRELEASE_DEBS_DIR%/}" | sed -e 's%/\+%/%g')"
-    if ! [ -d "$DEBRELEASE_DEBS_DIR" ]; then
-	debsdir_warning="config file specified DEBRELEASE_DEBS_DIR directory $DEBRELEASE_DEBS_DIR does not exist!"
-    fi
 
     # set config message
     MODIFIED_CONF=''
@@ -300,6 +297,7 @@ fi
 maint="$DEBSIGN_MAINT"
 signkey="$DEBSIGN_KEYID"
 debsdir="$DEBRELEASE_DEBS_DIR"
+debsdir_warning="config file specified DEBRELEASE_DEBS_DIR directory $DEBRELEASE_DEBS_DIR does not exist!"
 
 signcommand=''
 if [ -n "$DEBSIGN_PROGRAM" ]; then
@@ -342,6 +340,7 @@ do
 	--debs-dir)
 	    shift
 	    opt_debsdir="$(echo "${1%/}" | sed -e 's%/\+%/%g')"
+	    debsdir_warning="could not find directory $opt_debsdir!"
 	    ;;
 	--no-conf|--noconf)
 		echo "$PROGNAME: $1 is only acceptable as the first command-line option!" >&2
@@ -356,16 +355,6 @@ do
 done
 
 debsdir=${opt_debsdir:-$debsdir}
-# check sanity of debsdir
-if ! [ -d "$debsdir" ]; then
-    if [ -n "$debsdir_warning" ]; then
-        echo "$PROGNAME: $debsdir_warning" >&2
-        exit 1
-    else
-        echo "$PROGNAME: could not find directory $debsdir!" >&2
-        exit 1
-    fi
-fi
 
 if [ -z "$signcommand" ]; then
     echo "Could not find a signing program!" >&2
@@ -627,6 +616,11 @@ for valid format" >&2;
 # out its name from debian/changelog
 case $# in
     0)	# We have to parse debian/changelog to find the current version
+	# check sanity of debsdir
+	if ! [ -d "$debsdir" ]; then
+	    echo "$PROGNAME: $debsdir_warning" >&2
+	    exit 1
+	fi
 	if [ -n "$remotehost" ]; then
 	    echo "$PROGNAME: Need to specify a .changes, .dsc or .commands file location with -r!" >&2
 	    exit 1

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list