From ac981dd92158727ad37f82d4b609c498539b848a Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 17 Jul 2019 08:51:27 +0100 Subject: git-debpush: check for target suite change since last upload Signed-off-by: Sean Whitton --- git-debpush | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/git-debpush b/git-debpush index 6c41908..03fc9ce 100755 --- a/git-debpush +++ b/git-debpush @@ -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" -- cgit v1.2.3