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-02 11:26:11 +0100
commit1af59cfc1e888cb5478997fa342afdfa6f975f6d (patch)
tree3b3302ec2c4e0f7c22a5b21aca73418770c742be
parentea934e4b7845ab3841e744fd032792d56d86fabe (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 43f4aa2..f2a1ce9 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()) {