summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2023-09-02 10:49:09 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2023-09-03 00:47:38 +0100
commit5c029d8c0134df9d1eeef083e6eb8f74866fd7b3 (patch)
tree27328ca7663e9bb607a48af39a6808159f337968
parent0e6a048698af1c09466917189d95aed71d2fed3d (diff)
dgit: Prevent pushing old versions
Bail out if the changelog version we are uploading is not strictly newer than the .dsc version in the archive. Closes: #1050711 Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xdgit11
1 files changed, 11 insertions, 0 deletions
diff --git a/dgit b/dgit
index a3b14a0..dd2b301 100755
--- a/dgit
+++ b/dgit
@@ -4680,6 +4680,7 @@ END
git_fetch_us();
}
my $archive_hash = fetch_from_archive();
+ my $archive_dsc = $dsc;
if (!$archive_hash) {
$new_package or
fail __ "package appears to be new in this suite;".
@@ -4737,6 +4738,16 @@ END
my $upstreamversion = upstreamversion $clogp->{Version};
+ if (defined $archive_dsc &&
+ version_compare($archive_dsc->{Version}, $cversion) >= 0 &&
+ !forceing [qw(uploading-old-version)]) {
+ fail f_ <<'END', $archive_dsc->{Version}, $csuite, $cversion;
+You seem to be trying to push an old version.
+Version current in archive: %s (in suite %s)
+Version you are trying to upload: %s
+END
+ }
+
if (madformat_wantfixup($format)) {
# user might have not used dgit build, so maybe do this now:
if (do_split_brain()) {