Release checks v3
Tomi Ollila
tomi.ollila at iki.fi
Tue Sep 4 07:49:11 PDT 2012
This if V3 of release-check.sh patches, displacing
id:"1346491928-2356-1-git-send-email-tomi.ollila at iki.fi"
Changes:
Bash kept, mainly for pipefail -- and that possible future pipeline
additions have more protection.
Added set -o posix lessens drifts to more bashishms -- and somewhere was
mentioned that posix mode provides a bit more robust pipefail...
Changed that one short circuit & continues to if... elif... fi construct.
Used *[^0-9.]*) for matching non-digit and non-dot characters; this
was really nice one.
One formatting change (added newline).
Removed last 'exit 0'.
---
Something related: Some good pages for shell differences can be browsed at
http://www.in-ulm.de/~mascheck/
Diffdiff of the changes follows:
--- v2/release-checks.sh
+++ v3/release-checks.sh
@@ -10,13 +10,12 @@ then echo
exit 1
fi
+set -o posix
set -o pipefail # bash feature
# Avoid locale-specific differences in output of executed commands
LANG=C LC_ALL=C; export LANG LC_ALL
-readonly DEFAULT_IFS="$IFS"
-
readonly PV_FILE='bindings/python/notmuch/version.py'
# Using array here turned out to be unnecessarily complicated
@@ -28,9 +27,10 @@ append_emsg ()
for f in ./version debian/changelog NEWS "$PV_FILE"
do
- test -f $f || { append_emsg "File '$f' is missing"; continue; }
- test -r $f || { append_emsg "File '$f' is unreadable"; continue; }
- test -s $f || append_emsg "File '$f' is empty"
+ if [ ! -f "$f" ]; then append_emsg "File '$f' is missing"
+ elif [ ! -r "$f" ]; then append_emsg "File '$f' is unreadable"
+ elif [ ! -s "$f" ]; then append_emsg "File '$f' is empty"
+ fi
done
if [ -n "$emsgs" ]
@@ -62,18 +62,15 @@ verfail ()
}
echo -n "Checking that '$VERSION' is good with digits and periods... "
-if [ -z "${VERSION//[0123456789.]/}" ] # bash feature
-then
- case $VERSION in
- .*) verfail "'$VERSION' begins with a period" ;;
- *.) verfail "'$VERSION' ends with a period" ;;
- *..*) verfail "'$VERSION' contains two consecutive periods" ;;
- *.*) echo Yes. ;;
- *) verfail "'$VERSION' is a single number" ;;
- esac
-else
- verfail "'$VERSION' contains other characters than digits and periods"
-fi
+case $VERSION in
+ *[^0-9.]*)
+ verfail "'$VERSION' contains other characters than digits and periods" ;;
+ .*) verfail "'$VERSION' begins with a period" ;;
+ *.) verfail "'$VERSION' ends with a period" ;;
+ *..*) verfail "'$VERSION' contains two consecutive periods" ;;
+ *.*) echo Yes. ;;
+ *) verfail "'$VERSION' is a single number" ;;
+esac
# In the rest of this file, tests collect list of errors to be fixed
@@ -168,7 +165,9 @@ manfiles=`find man -type f | sort`
man_pages_ok=Yes
for mp in $manfiles
do
- case $mp in *.[0-9]) ;; # fall below this 'case ... esac'
+ case $mp in
+ *.[0-9]) ;; # fall below this 'case ... esac'
+
*/Makefile.local | */Makefile ) continue ;;
*/.gitignore) continue ;;
*.bak) continue ;;
@@ -201,7 +200,6 @@ echo 'All checks this script executed completed successfully.'
echo 'Make sure that everything else mentioned in RELEASING'
echo 'file is in order, too.'
-exit 0
# Local variables:
# mode: shell-script
More information about the notmuch
mailing list