[Dehs-devel] SVN devscripts commit: r369 - in trunk: . debian

Julian Gilbey jdg at costa.debian.org
Fri Mar 31 09:20:07 UTC 2006


Author: jdg
Date: 2006-03-31 09:20:06 +0000 (Fri, 31 Mar 2006)
New Revision: 369

Modified:
   trunk/conf.default.in
   trunk/debc.1
   trunk/debi.1
   trunk/debi.pl
   trunk/debian/changelog
   trunk/debian/postinst
   trunk/debrelease.1
   trunk/debrelease.sh
   trunk/uscan.pl
Log:
* debrelease, debc, debi: support searching for .changes and .debs in a
  directory other than the parent of the currnent source directory with
  --debs-dir command line and DEBRELEASE_DEBS_DIR configuration file
  options (Closes: #309362)
* uscan: *really* fix the uninitialized value bug (Closes: #356959)

Modified: trunk/conf.default.in
===================================================================
--- trunk/conf.default.in	2006-03-30 21:58:35 UTC (rev 368)
+++ trunk/conf.default.in	2006-03-31 09:20:06 UTC (rev 369)
@@ -101,7 +101,8 @@
 
 ##### debc
 # 
-# No variables currently
+# debc recognises the DEBRELEASE_DEBS_DIR variable; see debrelease
+# below for more information.
 
 ##### deb-reversion
 # 
@@ -148,7 +149,8 @@
 
 ##### debi
 # 
-# No variables currently
+# debc recognises the DEBRELEASE_DEBS_DIR variable; see debrelease
+# below for more information.
 
 ##### debpkg
 # 
@@ -160,6 +162,11 @@
 # the recognised values are "dupload" (default) and "dput".  Check the
 # debrelease(1) manpage for any recent changes to this variable
 # DEBRELEASE_UPLOADER=dupload
+# 
+# This specifies the directory, relative to the top of the source
+# tree, in which the .changes and .debs files are to be found.  Note
+# that this also affects debc and debi.
+# DEBRELEASE_DEBS_DIR=..
 
 ##### debrsign
 # 

Modified: trunk/debc.1
===================================================================
--- trunk/debc.1	2006-03-30 21:58:35 UTC (rev 368)
+++ trunk/debc.1	2006-03-31 09:20:06 UTC (rev 369)
@@ -68,6 +68,12 @@
 to mimic the behaviour of \fBdpkg-buildpackage\fR when determining the
 name of the \fI.changes\fR file.
 .TP
+\fB\-\-debs\-dir\fR \fIDIR\fR
+Look for the \fI.changes\fR and \fI.deb\fR files in directory
+\fIDIR\fR instead of the parent of the source directory.  This should
+either be an absolute path or relative to the top of the source
+directory.
+.TP
 \fB\-\-check-dirname-level\fR \fIN\fR
 See the above section "Directory name checking" for an explanation of
 this option.
@@ -89,6 +95,16 @@
 file settings.  Environment variable settings are ignored for this
 purpose.  The currently recognised variables are:
 .TP
+.B DEBRELEASE_DEBS_DIR
+This specifies the directory in which to look for the \fI.changes\fR
+and \fI.deb\fR files, and is either an absolute path or relative to
+the top of the source tree.  This corresponds to the
+\fB\-\-debs\-dir\fR command line option.  This directive could be
+used, for example, if you always use \fBpbuilder\fR or
+\fBsvn-buildpackage\fR to build your packages.  Note that it also
+affects \fBdebrelease\fR(1) in the same way, hence the strange name of
+the option.
+.TP
 .BR DEVSCRIPTS_CHECK_DIRNAME_LEVEL ", " DEVSCRIPTS_CHECK_DIRNAME_REGEX
 See the above section "Directory name checking" for an explanation of
 these variables.  Note that these are package-wide configuration

Modified: trunk/debi.1
===================================================================
--- trunk/debi.1	2006-03-30 21:58:35 UTC (rev 368)
+++ trunk/debi.1	2006-03-31 09:20:06 UTC (rev 369)
@@ -70,6 +70,12 @@
 to mimic the behaviour of \fBdpkg-buildpackage\fR when determining the
 name of the \fI.changes\fR file.
 .TP
+\fB\-\-debs\-dir\fR \fIDIR\fR
+Look for the \fI.changes\fR and \fI.deb\fR files in directory
+\fIDIR\fR instead of the parent of the source directory.  This should
+either be an absolute path or relative to the top of the source
+directory.
+.TP
 \fB\-\-check-dirname-level\fR \fIN\fR
 See the above section "Directory name checking" for an explanation of
 this option.
@@ -91,6 +97,16 @@
 file settings.  Environment variable settings are ignored for this
 purpose.  The currently recognised variables are:
 .TP
+.B DEBRELEASE_DEBS_DIR
+This specifies the directory in which to look for the \fI.changes\fR
+and \fI.deb\fR files, and is either an absolute path or relative to
+the top of the source tree.  This corresponds to the
+\fB\-\-debs\-dir\fR command line option.  This directive could be
+used, for example, if you always use \fBpbuilder\fR or
+\fBsvn-buildpackage\fR to build your packages.  Note that it also
+affects \fBdebrelease\fR(1) in the same way, hence the strange name of
+the option.
+.TP
 .BR DEVSCRIPTS_CHECK_DIRNAME_LEVEL ", " DEVSCRIPTS_CHECK_DIRNAME_REGEX
 See the above section "Directory name checking" for an explanation of
 these variables.  Note that these are package-wide configuration

Modified: trunk/debi.pl
===================================================================
--- trunk/debi.pl	2006-03-30 21:58:35 UTC (rev 368)
+++ trunk/debi.pl	2006-03-31 09:20:06 UTC (rev 369)
@@ -45,6 +45,8 @@
       --noconf          must be the first option given
     -a<arch>          Search for .changes file made for Debian build <arch>
     -t<target>        Search for .changes file made for GNU <target> arch
+    --debs-dir DIR    Look for the changes and debs files in DIR instead of
+                      the parent of the current package directory
     --check-dirname-level N
                       How much to check directory names:
                       N=0   never
@@ -74,6 +76,8 @@
       --noconf          must be the first option given
     -a<arch>          Search for changes file made for Debian build <arch>
     -t<target>        Search for changes file made for GNU <target> arch
+    --debs-dir DIR    Look for the changes and debs files in DIR instead of
+                      the parent of the current package directory
     --check-dirname-level N
                       How much to check directory names:
                       N=0   never
@@ -107,6 +111,8 @@
 EOF
 
 # Start by setting default values
+my $debsdir = '..';
+my $debsdir_warning;
 my $check_dirname_level = 1;
 my $check_dirname_regex = 'PACKAGE(-.*)?';
 
@@ -119,6 +125,7 @@
 } else {
     my @config_files = ('/etc/devscripts.conf', '~/.devscripts');
     my %config_vars = (
+		       'DEBRELEASE_DEBS_DIR' => '..',
 		       'DEVSCRIPTS_CHECK_DIRNAME_LEVEL' => 1,
 		       'DEVSCRIPTS_CHECK_DIRNAME_REGEX' => 'PACKAGE(-.*)?',
 		       );
@@ -139,6 +146,13 @@
     # Check validity
     $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'} =~ /^[012]$/
 	or $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'}=1;
+    # We do not replace this with a default directory to avoid accidentally
+    # 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!";
+    }
 
     foreach my $var (sort keys %config_vars) {
 	if ($config_vars{$var} ne $config_default{$var}) {
@@ -148,17 +162,19 @@
     $modified_conf_msg ||= "  (none)\n";
     chomp $modified_conf_msg;
 
+    $debsdir = $config_vars{'DEBRELEASE_DEBS_DIR'};
     $check_dirname_level = $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'};
     $check_dirname_regex = $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_REGEX'};
 }
 
 # Command line options next
-my ($opt_help, $opt_version, $opt_a, $opt_t);
+my ($opt_help, $opt_version, $opt_a, $opt_t, $opt_debsdir);
 my ($opt_ignore, $opt_level, $opt_regex, $opt_noconf);
 GetOptions("help" => \$opt_help,
 	   "version" => \$opt_version,
 	   "a=s" => \$opt_a,
 	   "t=s" => \$opt_t,
+	   "debs-dir=s" => \$opt_debsdir,
 	   "ignore-dirname" => \$opt_ignore,
 	   "check-dirname-level=s" => \$opt_level,
 	   "check-dirname-regex=s" => \$opt_regex,
@@ -177,6 +193,19 @@
 $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";
+}
+
 # dirname stuff
 if ($opt_ignore) {
     die "$progname: --ignore-dirname has been replaced by --check-dirname-level and\n--check-dirname-regex; run $progname --help for more details\n";
@@ -203,7 +232,7 @@
     # Look for .changes file via debian/changelog
     until (-r 'debian/changelog') {
 	$chdir = 1;
-	chdir '..' or die "$progname: can't chdir ..: $!\n";
+	chdir .. or die "$progname: can't chdir ..: $!\n";
 	if (cwd() eq '/') {
 	    die "$progname: cannot find readable debian/changelog anywhere!\nAre you in the source code tree?\n";
 	}
@@ -263,7 +292,7 @@
     my $sversion = $changelog{'Version'};
     $sversion =~ s/^\d+://;
     my $pva="$changelog{'Source'}_${sversion}_${arch}";
-    $changes="../$pva.changes";
+    $changes="$debsdir/$pva.changes";
 }
 
 chdir dirname($changes)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-03-30 21:58:35 UTC (rev 368)
+++ trunk/debian/changelog	2006-03-31 09:20:06 UTC (rev 369)
@@ -2,10 +2,15 @@
 
   * bts: actually support the --sendmail option rather than just say we
     do!
+  * debrelease, debc, debi: support searching for .changes and .debs in a
+    directory other than the parent of the currnent source directory with
+    --debs-dir command line and DEBRELEASE_DEBS_DIR configuration file
+    options (Closes: #309362)
   * mass-bug: new script (Closes: #355505)
   * pts-subscribe.1: improve the wording of the manpage (Closes: #360027)
+  * uscan: *really* fix the uninitialized value bug (Closes: #356959)
 
- -- Julian Gilbey <jdg at debian.org>  Thu, 30 Mar 2006 22:58:28 +0100
+ -- Julian Gilbey <jdg at debian.org>  Fri, 31 Mar 2006 10:19:43 +0100
 
 devscripts (2.9.16) unstable; urgency=low
 

Modified: trunk/debian/postinst
===================================================================
--- trunk/debian/postinst	2006-03-30 21:58:35 UTC (rev 368)
+++ trunk/debian/postinst	2006-03-31 09:20:06 UTC (rev 369)
@@ -191,6 +191,21 @@
 # PTS_UNTIL='now + 30 days'
 EOF
 	fi
+
+	if dpkg --compare-versions "$2" lt 2.9.17
+	then
+	# Added in devscripts 2.9.17:
+	    cat >> /etc/devscripts.conf <<EOF
+
+##### debrelease/debc/debi option added in version 2.9.17
+# 
+# This specifies the directory, relative to the top of the source
+# tree, in which the .changes and .debs files are to be found.  Note
+# that this option affects all of debrelease, debc and debi.
+# DEBRELEASE_DEBS_DIR=..
+EOF
+	fi
+
     fi
 fi
 

Modified: trunk/debrelease.1
===================================================================
--- trunk/debrelease.1	2006-03-30 21:58:35 UTC (rev 368)
+++ trunk/debrelease.1	2006-03-31 09:20:06 UTC (rev 369)
@@ -79,6 +79,12 @@
 \fIpackage_version_*+*.changes\fR as the changes file, allowing for the
 changes files produced by \fBdpkg-cross\fR.
 .TP
+\fB\-\-debs\-dir\fR \fIDIR\fR
+Look for the \fI.changes\fR and \fI.deb\fR files in directory
+\fIDIR\fR instead of the parent of the source directory.  This should
+either be an absolute path or relative to the top of the source
+directory.
+.TP
 \fB\-\-check-dirname-level\fR \fIN\fR
 See the above section "Directory name checking" for an explanation of
 this option.
@@ -108,6 +114,15 @@
 it specifies which uploader program should be used.  It corresponds to
 the \fB\-\-dupload\fR and \fB\-\-dput\fR command line options.
 .TP
+.B DEBRELEASE_DEBS_DIR
+This specifies the directory in which to look for the \fI.changes\fR
+and \fI.deb\fR files, and is either an absolute path or relative to
+the top of the source tree.  This corresponds to the
+\fB\-\-debs\-dir\fR command line option.  This directive could be
+used, for example, if you always use \fBpbuilder\fR or
+\fBsvn-buildpackage\fR to build your packages.  Note that it also
+affects \fBdebc\fR(1) and \fBdebi\fR(1).
+.TP
 .BR DEVSCRIPTS_CHECK_DIRNAME_LEVEL ", " DEVSCRIPTS_CHECK_DIRNAME_REGEX
 See the above section "Directory name checking" for an explanation of
 these variables.  Note that these are package-wide configuration

Modified: trunk/debrelease.sh
===================================================================
--- trunk/debrelease.sh	2006-03-30 21:58:35 UTC (rev 368)
+++ trunk/debrelease.sh	2006-03-31 09:20:06 UTC (rev 369)
@@ -38,6 +38,8 @@
     -t<target>        Search for .changes file made for GNU <target> arch
     -S                Search for source-only .changes file instead of arch one
     --multi           Search for multiarch .changes file made by dpkg-cross
+    --debs-dir DIR    Look for the changes and debs files in DIR instead of
+                      the parent of the current package directory
     --check-dirname-level N
                       How much to check directory names before cleaning trees:
                       N=0   never
@@ -80,9 +82,10 @@
 
 # Boilerplate: set config variables
 DEFAULT_DEBRELEASE_UPLOADER=dupload
+DEFAULT_DEBRELEASE_DEBS_DIR=..
 DEFAULT_DEVSCRIPTS_CHECK_DIRNAME_LEVEL=1
 DEFAULT_DEVSCRIPTS_CHECK_DIRNAME_REGEX='PACKAGE(-.*)?'
-VARS="DEBRELEASE_UPLOADER DEVSCRIPTS_CHECK_DIRNAME_LEVEL DEVSCRIPTS_CHECK_DIRNAME_REGEX"
+VARS="DEBRELEASE_UPLOADER DEBRELEASE_DEBS_DIR DEVSCRIPTS_CHECK_DIRNAME_LEVEL DEVSCRIPTS_CHECK_DIRNAME_REGEX"
 
 if [ "$1" = "--no-conf" -o "$1" = "--noconf" ]; then
     shift
@@ -114,6 +117,14 @@
 	dupload|dput) ;;
 	*) DEBRELEASE_UPLOADER=dupload ;;
     esac
+
+    # We do not replace this with a default directory to avoid accidentally
+    # uploading a broken package
+    DEBRELEASE_DEBS_DIR="`echo \"$DEBRELEASE_DEBS_DIR\" | sed -e 's%/\+%/%g; s%\(.\)/$%\1%;'`"
+    if ! [ -d "$DEBRELEASE_DEBS_DIR" ]; then
+	debsdir_warning="config file specified DEBRELEASE_DEBS_DIR directory $DEBRELEASE_DEBS_DIR does not exist!"
+    fi
+
     case "$DEVSCRIPTS_CHECK_DIRNAME_LEVEL" in
 	0|1|2) ;;
 	*) DEVSCRIPTS_CHECK_DIRNAME_LEVEL=1 ;;
@@ -143,6 +154,7 @@
 
 sourceonly=
 multiarch=
+debsdir="$DEBRELEASE_DEBS_DIR"
 
 while [ $# -gt 0 ]
 do
@@ -155,6 +167,21 @@
     --multi) multiarch=yes ;;
     --dupload) DEBRELEASE_UPLOADER=dupload ;;
     --dput) DEBRELEASE_UPLOADER=dput ;;
+    --debs-dir=*)
+	debsdir="`echo \"$1\" | sed -e 's/^--debs-dir=//; s%/\+%/%g; s%\(.\)/$%\1%;'`"
+	if ! [ -d "$debsdir" ]; then
+	    echo "$PROGNAME: directory $debsdir does not exist!" >&2
+	    exit 1
+	fi
+	;;
+    --debs-dir)
+	shift
+	debsdir="`echo \"$1\" | sed -e 's%/\+%/%g; s%\(.\)/$%\1%;'`"
+	if ! [ -d "$debsdir" ]; then
+	    echo "$PROGNAME: directory $debsdir does not exist!" >&2
+	    exit 1
+	fi
+	;;
     --check-dirname-level=*)
 	level="`echo \"$1\" | sed -e 's/^--check-dirname-level=//'`"
         case "$level" in
@@ -204,6 +231,16 @@
     shift
 done
 
+# check sanity of debdir
+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
 
 # Look for .changes file via debian/changelog
 CHDIR=
@@ -253,14 +290,14 @@
 sversion=`echo "$version" | perl -pe 's/^\d+://'`
 pva="${package}_${sversion}_${arch}"
 pvs="${package}_${sversion}_source"
-changes="../$pva.changes"
-schanges="../$pvs.changes"
-mchanges=$(ls "../${package}_${sversion}_*+*.changes" "../${package}_${sversion}_multi.changes" 2>/dev/null | head -1)
+changes="$debsdir/$pva.changes"
+schanges="$debsdir/$pvs.changes"
+mchanges=$(ls "$debsdir/${package}_${sversion}_*+*.changes" "$debsdir/${package}_${sversion}_multi.changes" 2>/dev/null | head -1)
 
 if [ -n "$multiarch" ]; then
     if [ -z "$mchanges" -o ! -r "$mchanges" ]; then
 	echo "$PROGNAME: could not find/read any multiarch .changes file with name" >&2
-	echo "../${package}_${sversion}_*.changes" >&2
+	echo "$debsdir/${package}_${sversion}_*.changes" >&2
 	exit 1
     fi
     changes=$mchanges

Modified: trunk/uscan.pl
===================================================================
--- trunk/uscan.pl	2006-03-30 21:58:35 UTC (rev 368)
+++ trunk/uscan.pl	2006-03-31 09:20:06 UTC (rev 369)
@@ -660,9 +660,13 @@
 	($base, $filepattern, $lastversion, $action) = split ' ', $line, 4;
 
 	if ($base =~ m%/([^/]*\([^/]*\)[^/]*)$%) {
-	    # only three fields; action might be multiword, though
-	    $action = $lastversion . (defined $action ? " $action" : "");
-	    $lastversion = $filepattern;
+	    # at most three fields; action might be multiword, though
+	    if (defined $lastversion) {
+		$action = $lastversion . (defined $action ? " $action" : "");
+	    }
+	    if (defined $filepattern) {
+		$lastversion = $filepattern;
+	    }
 	    $filepattern = $1;
 	    $base =~ s%/[^/]+$%/%;
 	}




More information about the Dehs-devel mailing list