summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog1
-rwxr-xr-xdgit19
-rw-r--r--dgit.116
3 files changed, 36 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 9b5230d..5d9e8cb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,7 @@ dgit (1.5~~) unstable; urgency=medium
avoid accidental use of the wrong one (by software, or by users).
* dgit sbuild: Check that the binary .changes file doesn't contain a
.dsc.
+ * Introduce --rm-old-changes to delete previous builds' changes files.
Documentation:
* Document the dgit-distro.DISTRO.quilt-mode config setting.
diff --git a/dgit b/dgit
index 51df7c3..38c1497 100755
--- a/dgit
+++ b/dgit
@@ -59,6 +59,7 @@ our %previously;
our $existing_package = 'dpkg';
our $cleanmode;
our $changes_since_version;
+our $rmchanges;
our $quilt_mode;
our $quilt_modes_re = 'linear|smash|auto|nofix|nocheck';
our $we_are_responder;
@@ -3013,6 +3014,16 @@ sub build_prep () {
$package = getfield $clogp, 'Source';
$version = getfield $clogp, 'Version';
build_maybe_quilt_fixup();
+ if ($rmchanges) {
+ my $pat = changespat $version;
+ foreach my $f (glob "$buildproductsdir/$pat") {
+ if (act_local()) {
+ unlink $f or fail "remove old changes file $f: $!";
+ } else {
+ progress "would remove $f";
+ }
+ }
+ }
}
sub changesopts_initial () {
@@ -3332,6 +3343,9 @@ sub parseopts () {
} elsif (m/^--no-rm-on-error$/s) {
push @ropts, $_;
$rmonerror = 0;
+ } elsif (m/^--(no-)?rm-old-changes$/s) {
+ push @ropts, $_;
+ $rmchanges = !$1;
} elsif (m/^--deliberately-($deliberately_re)$/s) {
push @ropts, $_;
push @deliberatelies, $&;
@@ -3438,6 +3452,11 @@ if (!@ARGV) {
my $cmd = shift @ARGV;
$cmd =~ y/-/_/;
+if (!defined $rmchanges) {
+ local $access_forpush;
+ $rmchanges = access_cfg_bool(0, 'rm-old-changes');
+}
+
if (!defined $quilt_mode) {
local $access_forpush;
$quilt_mode = cfg('dgit.force.quilt-mode', 'RETURN-UNDEF')
diff --git a/dgit.1 b/dgit.1
index 8235b05..d3f3702 100644
--- a/dgit.1
+++ b/dgit.1
@@ -526,6 +526,18 @@ otherwise, the changes file is expected in that directory (by
default, in
.BR .. ).
.TP
+.B --rm-old-changes
+When doing a build, delete any changes files matching
+.IB package _ version _*.changes
+before starting. This ensures that
+dgit push (and dgit sbuild) will be able to unambigously
+identify the relevant changes files from the most recent build, even
+if there have been previous builds with different tools or options.
+The default is not to remove, but
+.B \-\-no-rm-old-changes
+can be used to override a previous \-\-rm-old-changes
+or the .rm-old-changes configuration setting.
+.TP
.BI --build-products-dir= directory
Specifies where to find the built files to be uploaded.
By default, dgit looks in the parent directory
@@ -647,6 +659,10 @@ One of the values for the command line --clean= option; used if
One of the values for the command line --quilt= option; used if
--quilt is not specified.
.TP
+.BR dgit-distro. \fIdistro\fR .rm-old-changes
+Boolean, used if neither \-\-rm-old-changes nor \-\-no-rm-old-changes
+is specified. The default is not to remove.
+.TP
.BR dgit-distro. \fIdistro\fR .readonly " " auto | a " | " true | t | y | 1 " | " false | f | n | 0
Whether you have push access to the distro.
For Debian, it is OK to use auto, which uses readonly mode if you are