diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2015-11-07 13:09:56 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-07-01 23:53:45 +0100 |
commit | 7121a993cd2206d3f5066e97ebbc397fe079c18f (patch) | |
tree | 19019e4648d0fd542bcbcf5937e6264bcdc7f498 | |
parent | beb3973ddae45ae7e6d11694301463ce732ead79 (diff) |
Introduce --rm-old-changes to delete previous builds' changes files.
-rw-r--r-- | debian/changelog | 1 | ||||
-rwxr-xr-x | dgit | 19 | ||||
-rw-r--r-- | dgit.1 | 16 |
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. @@ -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') @@ -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 |