[devscripts] 05/05: debdiff: Specify directory of .dsc files
James McCoy
jamessan at debian.org
Tue Jun 9 02:35:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository devscripts.
commit 9af7199988479754bd077d61cf62fadd237428c4
Author: Craig Small <csmall at debian.org>
Date: Sat May 16 13:03:12 2015 +1000
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.
Signed-off-by: James McCoy <jamessan at debian.org>
---
debian/changelog | 3 +++
scripts/debdiff.1 | 16 ++++++++++++++++
scripts/debdiff.pl | 31 ++++++++++++++++++++++++++++++-
3 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 6a85252..8cac5c1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -60,6 +60,9 @@ devscripts (2.15.5) UNRELEASED; urgency=medium
[ Hideki Yamane ]
* Add bash completion for dcut. (Closes: #787321)
+ [ Craig Small ]
+ * debdiff: Honor DEBRELEASE_DEBS_DIR or --debs-dir. (Closes: #785421)
+
-- Cyril Brulebois <kibi at debian.org> Tue, 28 Apr 2015 16:58:36 +0200
devscripts (2.15.4) unstable; urgency=medium
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 2eff196..a39b594 100755
--- a/scripts/debdiff.pl
+++ b/scripts/debdiff.pl
@@ -112,6 +112,8 @@ EOF
# Start by setting default values
+my $debsdir;
+my $debsdir_warning;
my $ignore_dirs = 1;
my $compare_control = 1;
my $controlfiles = 'control';
@@ -143,6 +145,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;
@@ -173,6 +176,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}) {
@@ -182,6 +190,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'};
@@ -200,6 +209,7 @@ my $type = '';
my @excludes = ();
my @move = ();
my %renamed = ();
+my $opt_debsdir;
# handle command-line options
@@ -260,6 +270,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; }
@@ -297,16 +317,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;
--
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