Package: devscripts
Version: 2.9.8
Severity: wishlist
Tags: patch
Hi,
in order to use debdiff in scripts, I would need it to let me evaluate
the result of the outcome (differences found or not). This is currently
not easily possible except employing some heuristics by parsing the
output.
I propose the attached patch that adds a "--verbose" option. Without it,
debdiff doesn't output anything on stdout if no problems or differences
were found. With "--verbose", you can reactivate the current behaviour.
This would follow common Unix practice.
See also http://www.catb.org/~esr/writings/taoup/html/ , "Rule of
Silence".
It would also be possible to return the differences-found state via a
return/exit value of the script. But that would diverge from common
practice (see e.g., diff(1)).
Feel free to remove the output-in-case-of-no-differences entirely in
which case you don't need the --verbose switch.
Thanks.
bye,
Roland
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: sparc (sparc64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-sparc64
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL
set to en_GB.UTF-8)
Versions of packages devscripts depends on:
ii debianutils 2.15.1 Miscellaneous utilities specific t
ii dpkg-dev 1.13.11 package building tools for Debian
ii libc6 2.3.5-6 GNU C Library: Shared libraries an
ii perl 5.8.7-7 Larry Wall's Practical Extraction
ii sed 4.1.4-4 The GNU sed stream editor
Versions of packages devscripts recommends:
ii fakeroot 1.5.5 Gives a fake root environment
-- no debconf information
--- debdiff.1.orig 2005-11-06 19:33:12.000000000 +0100
+++ debdiff.1 2005-11-06 19:35:27.000000000 +0100
@@ -111,6 +111,9 @@
.TP
.BR \-\-version ", " \-v
Show version and copyright information.
+.TP
+.BR \-\-verbose
+Print additional info, even if no differences were found.
.SH "CONFIGURATION VARIABLES"
The two configuration files \fI/etc/devscripts.conf\fR and
\fI~/.devscripts\fR are sourced by a shell in that order to set
--- debdiff.pl.orig 2005-11-06 19:33:22.000000000 +0100
+++ debdiff.pl 2005-11-06 19:42:42.000000000 +0100
@@ -61,6 +61,8 @@
--renamed FROM TO The package formerly called FROM has been
renamed TO; only of interest with --show-moved
(multiple permitted)
+ --verbose Print additional info, even if no differences were
+ found
Default settings modified by devscripts configuration files:
$modified_conf_msg
@@ -84,6 +86,8 @@
my $show_moved = 0;
my $wdiff_opt = '';
+my $verbose = 0;
+
# Next, read read configuration files and then command line
# The next stuff is boilerplate
@@ -180,6 +184,7 @@
}
elsif ($ARGV[0] =~ /^(--dirs|-d)$/) { $ignore_dirs = 0; shift; }
elsif ($ARGV[0] eq '--nodirs') { $ignore_dirs = 1; shift; }
+ elsif ($ARGV[0] eq '--verbose') { $verbose = 1; shift; }
elsif ($ARGV[0] =~ /^(--show-moved|-s)$/) { $show_moved = 1; shift; }
elsif ($ARGV[0] eq '--noshow-moved') { $show_moved = 0; shift; }
elsif ($ARGV[0] eq '--nocontrol') { $compare_control = 0; shift; }
@@ -489,7 +494,7 @@
}
}
- if (! $changes) {
+ if ($verbose && ! $changes) {
print "File lists identical on package level (after any
substitutions)\n";
}
} else {
@@ -500,7 +505,7 @@
my @losses = sort grep $files{$_} < 0, keys %files;
my @gains = sort grep $files{$_} > 0, keys %files;
- if (@losses == 0 && @gains == 0) {
+ if ($verbose && @losses == 0 && @gains == 0) {
print "File lists identical (after any substitutions)\n";
}
@@ -554,10 +559,14 @@
use strict 'refs';
-print "\n";
+if ($verbose) {
+ print "\n";
+}
my $wdiff = `wdiff -n $wdiff_opt $dir1/control $dir2/control`;
if ($? >> 8 == 0) {
- print "No differences were encountered in the control files\n";
+ if ($verbose) {
+ print "No differences were encountered in the control files\n";
+ }
} elsif ($? >> 8 == 1) {
if ($wdiff_opt) {
# Don't try messing with control codes