chiark / gitweb /
git-debpush: check for target suite change since last upload
authorSean Whitton <spwhitton@spwhitton.name>
Wed, 17 Jul 2019 07:51:27 +0000 (08:51 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 17 Jul 2019 13:12:27 +0000 (14:12 +0100)
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
git-debpush

index 6c41908633f10c3fca193e07ea872eacce515d89..03fc9ce73585a2ea2bfab60088ea58b40265c429 100755 (executable)
@@ -220,11 +220,20 @@ if ! [ "x$last_debian_tag" = "x" ] && ! [ "x$last_archive_tag" = "x" ]; then
     fi
 fi
 
-# TODO additional checks we might do:
-#
-# - are we uploading to a different suite from the last tag
-#   (e.g. unstable after experimental)?  user should pass option to
-#   confirm
+if ! [ "x$last_debian_tag" = "x" ]; then
+    temp=$(mktemp -d)
+    trap cleanup EXIT
+    mkdir "$temp/debian"
+    git cat-file blob "$last_debian_tag":debian/changelog >"$temp/debian/changelog"
+    prev_target=$(cd $temp; dpkg-parsechangelog -SDistribution)
+    rm -rf "$temp"
+    trap - EXIT
+
+    if ! [ "$prev_target" = "$target" ] && ! [ "$target" = "UNRELEASED" ]; then
+        fail_check \
+"last upload targeted $prev_target, now targeting $target; might be a mistake?"
+    fi
+fi
 
 if ! $force && $failed_check; then
     fail "some checks failed; you can override with --force"