Package: devscripts
Version: 2.15.4
Severity: wishlist
Tags: patch

As you can see below, my .devscripts contains a DEBRELEASE_DEBS_DIR
field.  Most devscripts obey this option, debdiff does not.

The patch, mostly stolen from debi, lets you use either the devscripts
option or use --debs-dir, just like the other programs.

I made it a git-am patch, not sure if you take pull requests or not 
so figured this was the easiest way.

 - Craig

-- Package-specific info:

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

--- ~/.devscripts ---
DEBUILD_ROOTCMD=fakeroot
DEBUILD_DPKG_BUILDPACKAGE_OPTS="-uc -us"
DSCVERIFY_KEYRINGS=~/.gnupg/pubring.gpg
DEBRELEASE_UPLOADER=dput
DEBSIGN_KEYID=3938F96BDF50FEA5
DEBEMAIL="[email protected]"
DEBRELEASE_DEBS_DIR=../build-area/

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/6 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages devscripts depends on:
ii  dpkg-dev     1.17.25
ii  libc6        2.19-18
ii  perl         5.20.2-4
ii  python3      3.4.2-2
pn  python3:any  <none>

Versions of packages devscripts recommends:
ii  at                          3.1.16-1
ii  curl                        7.42.1-2
ii  dctrl-tools                 2.24-1
ii  debian-keyring              2015.04.10
ii  dput                        0.9.6.4
ii  dupload                     2.7.0
ii  equivs                      2.0.9
ii  fakeroot                    1.20.2-1
ii  file                        1:5.22+15-2
ii  gnupg                       1.4.19-2
ii  libdistro-info-perl         0.14
ii  libencode-locale-perl       1.03-1
ii  libjson-perl                2.61-1
ii  liblwp-protocol-https-perl  6.06-2
ii  libsoap-lite-perl           1.11-1
ii  liburi-perl                 1.64-1
ii  libwww-perl                 6.08-1
ii  lintian                     2.5.30+deb8u4
ii  man-db                      2.7.0.2-5
ii  patch                       2.7.5-1
ii  patchutils                  0.3.4-1
ii  python3-debian              0.1.27
ii  python3-magic               1:5.22+15-2
ii  sensible-utils              0.0.9
ii  strace                      4.10-1
ii  unzip                       6.0-16
ii  wdiff                       1.2.2-1
ii  wget                        1.16.3-2
ii  xz-utils                    5.1.1alpha+20120614-2+b3

Versions of packages devscripts suggests:
ii  bsd-mailx [mailx]            8.1.2-0.20141216cvs-2
ii  build-essential              11.7
pn  cvs-buildpackage             <none>
pn  debbindiff                   <none>
pn  devscripts-el                <none>
ii  gnuplot                      4.6.6-2
ii  gpgv                         1.4.19-2
ii  libauthen-sasl-perl          2.1600-1
ii  libfile-desktopentry-perl    0.07-1
ii  libnet-smtp-ssl-perl         1.01-3
pn  libterm-size-perl            <none>
ii  libtimedate-perl             2.3000-2
ii  libyaml-syck-perl            1.27-2+b2
ii  mutt                         1.5.23-3
ii  openssh-client [ssh-client]  1:6.7p1-6
pn  svn-buildpackage             <none>
ii  w3m                          0.5.3-21

-- no debconf information
>From 7730bedb165939d3be864fcf55dd0425d8128a90 Mon Sep 17 00:00:00 2001
From: Craig Small <[email protected]>
Date: Sat, 16 May 2015 13:03:12 +1000
Subject: [PATCH] debdiff: Specify directory of .dsc files

debdiff is one of the few devscripts utilities that does not
either have a --debs-dir option or use the DEBRELEASE_DEBS_DIR
option found in devscripts.conf

This patch enables both methods which means instead of having to
manually specify the .dsc files when you have a different DEBS_DIR
to .., it will Just Work like the other tools.
---
 scripts/debdiff.1  | 16 ++++++++++++++++
 scripts/debdiff.pl | 31 ++++++++++++++++++++++++++++++-
 2 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/scripts/debdiff.1 b/scripts/debdiff.1
index 46a50b5..3a39898 100644
--- a/scripts/debdiff.1
+++ b/scripts/debdiff.1
@@ -155,6 +155,12 @@ Do not unpack tarballs inside source packages.
 Do not read any configuration files.  This can only be used as the
 first option given on the command-line.
 .TP
+\fB\-\-debs\-dir\fR \fIdirectory\fR
+Look for the \fI.dsc\fR files in \fIdirectory\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
 .BR \-\-help ", " \-h
 Show a summary of options.
 .TP
@@ -210,6 +216,16 @@ If this is set to \fIyes\fR, then it is the same as the
 .B DEBDIFF_UNPACK_TARBALLS
 If this is set to \fIno\fR, then it is the same as the
 \fB\-\-no\-unpack\-tarballs\fR command line parameter being used.
+.TP
+.B DEBRELEASE_DEBS_DIR
+This specifies the directory in which to look for the \fI.dsc\fR
+and 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.
 .SH "EXIT VALUES"
 Normally the exit value will be 0 if no differences are reported and 1
 if any are reported.  If there is some fatal error, the exit code will
diff --git a/scripts/debdiff.pl b/scripts/debdiff.pl
index 54c7573..fee877d 100755
--- a/scripts/debdiff.pl
+++ b/scripts/debdiff.pl
@@ -111,6 +111,8 @@ EOF
 
 # Start by setting default values
 
+my $debsdir;
+my $debsdir_warning;
 my $ignore_dirs = 1;
 my $compare_control = 1;
 my $controlfiles = 'control';
@@ -142,6 +144,7 @@ if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
 		       'DEBDIFF_WDIFF_SOURCE_CONTROL' => 'no',
 		       'DEBDIFF_AUTO_VER_SORT' => 'no',
 		       'DEBDIFF_UNPACK_TARBALLS' => 'yes',
+		       'DEBRELEASE_DEBS_DIR' => '..',
 		       );
     my %config_default = %config_vars;
 
@@ -172,6 +175,11 @@ if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
 	or $config_vars{'DEBDIFF_AUTO_VER_SORT'}='no';
     $config_vars{'DEBDIFF_UNPACK_TARBALLS'} =~ /^(yes|no)$/
 	or $config_vars{'DEBDIFF_UNPACK_TARBALLS'}='yes';
+    # 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%;
+    $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}) {
@@ -181,6 +189,7 @@ if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
     $modified_conf_msg ||= "  (none)\n";
     chomp $modified_conf_msg;
 
+    $debsdir = $config_vars{'DEBRELEASE_DEBS_DIR'};
     $ignore_dirs = $config_vars{'DEBDIFF_DIRS'} eq 'yes' ? 0 : 1;
     $compare_control = $config_vars{'DEBDIFF_CONTROL'} eq 'no' ? 0 : 1;
     $controlfiles = $config_vars{'DEBDIFF_CONTROLFILES'};
@@ -199,6 +208,7 @@ my $type = '';
 my @excludes = ();
 my @move = ();
 my %renamed = ();
+my $opt_debsdir;
 
 
 # handle command-line options
@@ -259,6 +269,16 @@ while (@ARGV) {
     elsif ($ARGV[0] =~ s/^--controlfiles=//) {
 	$controlfiles = shift;
     }
+    elsif ($ARGV[0] eq '--debs-dir') {
+	fatal "Malformed command-line option $ARGV[0]; run $progname --help for more info"
+	    unless @ARGV >= 2;
+	shift @ARGV;
+
+	$opt_debsdir = shift;
+    }
+    elsif ($ARGV[0] =~ s/^--debs-dir=//) {
+	$opt_debsdir = shift;
+    }
     elsif ($ARGV[0] =~ /^(--dirs|-d)$/) { $ignore_dirs = 0; shift; }
     elsif ($ARGV[0] eq '--nodirs') { $ignore_dirs = 1; shift; }
     elsif ($ARGV[0] =~ /^(--quiet|-q)$/) { $quiet = 1; shift; }
@@ -296,16 +316,25 @@ while (@ARGV) {
 
 my $guessed_version = 0;
 
+if ($opt_debsdir) {
+    $opt_debsdir =~ s%^/+%/%;
+    $opt_debsdir =~ s%(.)/$%$1%;
+    $debsdir_warning = "--debs-dir directory $opt_debsdir does not exist!";
+    $debsdir = $opt_debsdir;
+}
+
 # If no file is given, assume that we are in a source directory
 # and try to create a diff with the previous version
 if(@ARGV == 0) {
     my $namepat = qr/[-+0-9a-z.]/i;
 
+    fatal $debsdir_warning unless -d $debsdir;
+
     fatal "Can't read file: debian/changelog" unless -r "debian/changelog";
     open CHL, "debian/changelog";
     while(<CHL>) {
 	if(/^(\w$namepat*)\s\((\d+:)?(.+)\)((\s+$namepat+)+)\;\surgency=.+$/) {
-	    unshift @ARGV, "../".$1."_".$3.".dsc";
+	    unshift @ARGV, $debsdir."/".$1."_".$3.".dsc";
 	    $guessed_version++;
 	}
 	last if $guessed_version > 1;
-- 
2.1.4

_______________________________________________
devscripts-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/devscripts-devel

Reply via email to