[pkg-haskell-tools] 04/04: upload: skip uploaded .changes, or changes not meant for release
Joachim Breitner
nomeata at moszumanska.debian.org
Thu Aug 20 12:30:35 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 7db8dcd39551078a1f9b71ac37c8dee37f16c4f2
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Thu Aug 20 14:30:09 2015 +0200
upload: skip uploaded .changes, or changes not meant for release
---
scripts/tag | 39 +++++++++++++++++++++++++++++++--------
scripts/upload | 17 +++++++++++------
2 files changed, 42 insertions(+), 14 deletions(-)
diff --git a/scripts/tag b/scripts/tag
index 3fa2637..418d366 100755
--- a/scripts/tag
+++ b/scripts/tag
@@ -2,7 +2,6 @@
# TODO:
# * Check for uncommited changes before
-# * Add a dry-run mode, to be used from upload
use strict;
use warnings;
@@ -12,22 +11,35 @@ use DHT;
usage <<__END__;
tag - Tag a built pakage
-Usage: dht tag [directory..]
+Usage: dht tag [--dry-run] [directory..]
For all given directories, which should be Debian source packages,
figure out the current version from debian/changeslog and create a tag, tagging
the youngest git commit that changed this particular source package.
+
+With --dry-run it simply checks if it could tag this (suite not UNRELEASED, not
+already tagged), and returns 0 if it could.
__END__
manpage <<__END__;
-Usage: dht tag [directory..]
+Usage: dht tag [--dry-run] [directory..]
For all given directories, which should be Debian source packages,
figure out the current version from debian/changeslog and create a tag, tagging
the youngest git commit that changed this particular source package.
+
+With --dry-run it simply checks if it could tag everything (suite not UNRELEASED, not
+already tagged), and returns 0 if it could.
__END__
+my $dryrun = 0;
+my $ok = 1;
+if (@ARGV > 0 and $ARGV[0] eq "--dry-run") {
+ $dryrun = 1;
+ shift @ARGV;
+}
+
my @dirs = @ARGV;
for my $dir (@dirs) {
@@ -44,12 +56,21 @@ for my $dir (@dirs) {
$tag =~ tr/:~/_/;
my $msg = sprintf "Tagging %s version %s, targetted for %s", $source, $version, $suite;
if ($suite eq "UNRELEASED") {
- printf STDERR "Cannot tag UNRELEASED package %s-%s", $source, $version;
+ printf STDERR "Cannot tag UNRELEASED package %s-%s\n", $source, $version;
+ $ok = 0;
} else {
- my $rev = `git log -n 1 --pretty=format:%h -- $dir`;
- my $ret = system(qw/git tag -a -m/, $msg, $tag, $rev);
- die (sprintf "Failed to tag %s: %d\n", $tag, $?>>8) if $ret != 0;
- printf "Added tag %s (revision %s)\n", $tag, $rev;
+ if (system(qw/git show-ref --quiet/, "refs/tags/$tag") == 0) {
+ # tag exists
+ printf STDERR "Cannot tag package %s-%s, already tagged\n", $source, $version;
+ $ok = 0;
+ } else {
+ if (not $dryrun) {
+ my $rev = `git log -n 1 --pretty=format:%h -- $dir`;
+ my $ret = system(qw/git tag -a -m/, $msg, $tag, $rev);
+ die (sprintf "Failed to tag %s: %d\n", $tag, $?>>8) if $ret != 0;
+ printf "Added tag %s (revision %s)\n", $tag, $rev;
+ }
+ }
}
} else {
printf STDERR "Cannot parse %s:\n%s", $changelog, $firstline;
@@ -57,5 +78,7 @@ for my $dir (@dirs) {
}
}
+exit (not $ok);
+
diff --git a/scripts/upload b/scripts/upload
index 534b96b..2737486 100755
--- a/scripts/upload
+++ b/scripts/upload
@@ -13,7 +13,7 @@ then
echo "using \"dput ssh-upload\" and tags them in the repository and pushes the tag."
echo
echo "Checks that the distribution is not UNRELEASED and that the tag does"
- echo "not exist already (by tagging first)."
+ echo "not exist already."
echo
exit 0
fi
@@ -29,7 +29,7 @@ location (to avoid touching the original files), uploads them to the archive
using `dput ssh-upload` and tags them in the repository and pushes the tag.
Checks that the distribution is not `UNRELEASED` and that the tag does
-not exist already (by tagging first).
+not exist already.
__END__
exit 0;
fi
@@ -50,9 +50,14 @@ mkdir $tmpdir
for c in $changes
do
src="$(grep ^Source "$c"|grep-dctrl -s Source -n '' )"
- dht tag $root/p/$src
- dcmd cp -v "$c" "$tmpdir"
- debsign "$tmpdir"/"$(basename "$c")"
- dput ssh-upload "$tmpdir"/"$(basename "$c")"
+ if dht tag --dry-run $root/p/$src
+ 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"
+ fi
done
git push --tags
--
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