Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id BCF7F431FB6 for ; Tue, 4 Sep 2012 07:49:16 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KK4xdBF8ymcy for ; Tue, 4 Sep 2012 07:49:14 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 8C411431FBD for ; Tue, 4 Sep 2012 07:49:14 -0700 (PDT) Received: by guru.guru-group.fi (Postfix, from userid 501) id BE7F310014E; Tue, 4 Sep 2012 17:49:20 +0300 (EEST) From: Tomi Ollila To: notmuch@notmuchmail.org Subject: Release checks v3 Date: Tue, 4 Sep 2012 17:49:11 +0300 Message-Id: <1346770153-14947-1-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 1.7.1 Cc: tomi.ollila@iki.fi X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Sep 2012 14:49:17 -0000 This if V3 of release-check.sh patches, displacing id:"1346491928-2356-1-git-send-email-tomi.ollila@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