From: Frédéric Marchal Date: Thu, 19 Jul 2012 07:24:14 +0000 (+0200) Subject: Check the working directory before preparing the archive X-Git-Tag: v2.3.3~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f23af6b99679ddf2add5d71944b9c7f825ac2514;p=thirdparty%2Fsarg.git Check the working directory before preparing the archive The script test for the usual things I always forget: 1) Update the po files. 2) Commit the changes. 3) Set a git tag to find the version back. --- diff --git a/archive.sh b/archive.sh index 61fb6b2..dc3621f 100755 --- a/archive.sh +++ b/archive.sh @@ -3,6 +3,7 @@ Sources="." Target=".." +# check version number in every file Version=$(cat "$Sources/CMakeLists.txt" | sed -n -e 's/^SET(sarg_VERSION \([0-9]\))/\1/p') if [ -z "$Version" ] ; then echo "No version found" @@ -21,6 +22,47 @@ if [ "x$Version" != "x$VersionCheck" ] ; then exit 1 fi +# update the po files +if ( ! make update-po ) ; then + echo "Failed to update the po files" + exit 1 +fi + +# is the git repository dirty? +if [[ $(git diff --shortstat 2> /dev/null) != "" ]] ; then + echo "Git repository is dirty" + exit 1 +fi + +# check the working tree +if ( ! git diff-files --quiet ) ; then + echo "Uncommitted changes in working tree" + exit 1 +fi + +# check the index for uncommitted changes +if ( ! git diff-index --quiet --cached HEAD ) ; then + echo "Uncommitted changes in the index" + exit 1 +fi + +# check for untracked files +Untracked="$(git ls-files --exclude-standard --others)" +if [[ -n "$Untracked" ]] ; then + echo "Untracked files in directory" + echo "$Untracked" + exit 1 +fi + +# is the git tag set? +GitVersion=$(git describe) +if [[ "$GitVersion" != "$Version" ]] ; then + echo "Git tag not set for version $Version. Use command:" + echo "git tag -a \"$Version\" -m \"$Version\"" + exit 1 +fi + +# prepare the archive SargList="$Target/sarglist.txt.unsort" SortList="$Target/sarglist.txt" DirList="$Target/sargdir.txt"