Eric Blake wrote: > On 01/04/2011 03:01 PM, Eric Blake wrote: >> Found one, and it even works on libvirt (where the gnulib submodule is >> named .gnulib instead of gnulib). It should also work on a repository >> with multiple submodules, although I have not yet tested it on bison.git. >> >> gnulib-commit-check: >> git submodule foreach test '$$(git merge-base --independent \ >> origin $$sha1 | wc -w)' = 1 >> >> This effectively runs the shell command: >> >> git merge-base --independent origin $sha1 >> >> with $sha1 set to the value recorded in the superproject (identical to >> your computation of $commit), and outputs the minimal set of revisions >> not reachable from any other in the set of arguments. If origin >> contains $sha1, the output is a single hash (it happens to be that of >> origin); if $sha1 is a local-only revision, the output is two hashes, so >> the test fails, which in turn lets 'make alpha' fail. > > Not quite robust enough - if your superproject contains commits not > pushed upstream yet, then merge-base would still output a single > reference. This should close that gap, by requiring that the least > reachable commit be exactly the upstream origin. > > gnulib-commit-check: > git submodule foreach test '$$(git rev-parse origin)' \ > = '"$$(git merge-base --independent origin $$sha1)"'
Thanks again for the fine test. It passed my tests, so I propose this in your name: >From 8ba2dc9163f753c4953e8686f2b611d4e2a3ae84 Mon Sep 17 00:00:00 2001 From: Eric Blake <ebl...@redhat.com> Date: Thu, 6 Jan 2011 10:35:18 +0100 Subject: [PATCH] maint.mk: add pre-release check to ensure submodule commits are public * top/maint.mk (public-submodule-commit): New rule. (submodule-checks): New variable. (alpha beta stable): Depend on the variable. --- ChangeLog | 7 +++++++ top/maint.mk | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b99e92..5e319f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-01-06 Eric Blake <ebl...@redhat.com> + + maint.mk: add pre-release check to ensure submodule commits are public + * top/maint.mk (public-submodule-commit): New rule. + (submodule-checks): New variable. + (alpha beta stable): Depend on the variable. + 2011-01-05 Pádraig Brady <p...@draigbrady.com> and Jim Meyering <meyer...@redhat.com> diff --git a/top/maint.mk b/top/maint.mk index 5545e69..3a3ede6 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -1118,9 +1118,19 @@ no-submodule-changes: : ; \ fi +submodule-checks = no-submodule-changes public-submodule-commit + +# Ensure that each sub-module commit we're using is public. +# Without this, it is too easy to tag and release code that +# cannot be built from a fresh clone. +.PHONY: public-submodule-commit +public-submodule-commit: + git submodule foreach 'test $$(git rev-parse origin)' \ + = '"$$(git merge-base --independent origin $$sha1)"' + .PHONY: alpha beta stable ALL_RECURSIVE_TARGETS += alpha beta stable -alpha beta stable: $(local-check) writable-files no-submodule-changes +alpha beta stable: $(local-check) writable-files $(submodule-checks) test $@ = stable \ && { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \ || { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\ -- 1.7.3.4