[pkg-haskell-tools] 01/02: Disentangle upload and tag

Joachim Breitner nomeata at moszumanska.debian.org
Fri Aug 21 13:43:50 UTC 2015


This is an automated email from the git hooks/post-receive script.

nomeata pushed a commit to branch master
in repository pkg-haskell-tools.

commit a64cf9c98f6ab873d7f57e02762876251cbbaa51
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Fri Aug 21 10:08:26 2015 +0200

    Disentangle upload and tag
    
    as tag takes the version number from the changelog, but we need to take
    it from the changes file.
---
 scripts/tag            |  2 +-
 scripts/upload         | 26 ++++++++++++++++++-------
 scripts/what-to-upload | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 8 deletions(-)

diff --git a/scripts/tag b/scripts/tag
index 418d366..c44a2b8 100755
--- a/scripts/tag
+++ b/scripts/tag
@@ -59,7 +59,7 @@ for my $dir (@dirs) {
 			printf STDERR "Cannot tag UNRELEASED package %s-%s\n", $source, $version;
 			$ok = 0;
 		} else {
-			if (system(qw/git show-ref --quiet/, "refs/tags/$tag") == 0) {
+			if (system(qw/git show-ref --verify --quiet/, "refs/tags/$tag") == 0) {
 				# tag exists
 				printf STDERR "Cannot tag package %s-%s, already tagged\n", $source, $version;
 				$ok = 0;
diff --git a/scripts/upload b/scripts/upload
index 2737486..4f8d29e 100755
--- a/scripts/upload
+++ b/scripts/upload
@@ -50,14 +50,26 @@ mkdir $tmpdir
 for c in $changes
 do
 	src="$(grep ^Source "$c"|grep-dctrl -s Source -n '' )"
-	if dht tag --dry-run $root/p/$src
+	ver="$(grep ^Version "$c"|grep-dctrl -s Version -n '' )"
+	dist="$(grep ^Distribution "$c"|grep-dctrl -s Distribution -n '' )"
+	tag="${src}_v$(echo $ver| tr ':~' _)"
+	if [ "$dist" == "UNRELEASED" ]
 	then
-		dht tag $root/p/$src
-		dcmd cp -v "$c" "$tmpdir"
-		debsign "$tmpdir"/"$(basename "$c")"
-		dput ssh-upload "$tmpdir"/"$(basename "$c")"
-	else
-		echo "Skipping $c, not ready for upload" 
+		echo "Skipping $c, not ready for upload"
+		continue
 	fi
+	if git show-ref --quiet --verify "refs/tags/$tag"
+	then
+		echo "Skipping $c, already released"
+		continue
+	fi
+
+	dir="$root/p/$src"
+	rev=$(git log -n 1 --pretty=format:%H -- $dir)
+	msg="Tagging $src version $ver, targetted for $dist"
+	dcmd cp --reflink=auto -v "$c" "$tmpdir"
+	debsign "$tmpdir"/"$(basename "$c")"
+	dput ssh-upload "$tmpdir"/"$(basename "$c")"
+	git -C "$dir" tag -a -m "$msg" "$tag" "$rev"
 done
 git push --tags
diff --git a/scripts/what-to-upload b/scripts/what-to-upload
new file mode 100755
index 0000000..83fee01
--- /dev/null
+++ b/scripts/what-to-upload
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+set -e
+
+if [ -z "$1" -o "$1" = "--help" ]
+then
+  cat <<'__END__'
+what-to-upload - Lists .changes files that should be uploaded
+
+Usage: dht what-to-upload foo.changes ..
+
+Given a number of changes files, reports hose that should be uploaded, i.e.
+the distribution is not UNRELEASED and that the tag does not exist already.
+__END__
+
+  exit 0
+fi
+
+
+if [ "$1" = "--manpage" ]
+then
+cat <<'__END__'
+Usage: dht what-to-upload foo.changes ..
+
+Given a number of changes files, reports hose that should be uploaded, i.e.
+the distribution is not UNRELEASED and that the tag does not exist already.
+__END__
+	exit 0;
+fi
+
+changes="$@"
+
+root="$(realpath --relative-to=$PWD "$(git rev-parse --show-toplevel)")"
+
+for c in $changes
+do
+	src="$(grep ^Source "$c"|grep-dctrl -s Source -n '' )"
+	ver="$(grep ^Version "$c"|grep-dctrl -s Version -n '' )"
+	dist="$(grep ^Distribution "$c"|grep-dctrl -s Distribution -n '' )"
+	tag="${src}_v$(echo $ver| tr ':~' _)"
+	if [ "$dist" == "UNRELEASED" ]
+	then
+		#echo "Skipping $c, not ready for upload"
+		continue
+	fi
+	if git show-ref --quiet --verify "refs/tags/$tag"
+	then
+		#echo "Skipping $c, already released"
+		continue
+	fi
+	echo $c
+done

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/pkg-haskell-tools.git



More information about the Pkg-haskell-commits mailing list