4 #set -x # or enter bash -x ... on command line
6 if [ x"${BASH_VERSION-}" = x ]
8 echo "Please execute this script using 'bash' interpreter"
14 set -o pipefail # bash feature
16 # Avoid locale-specific differences in output of executed commands
17 LANG=C LC_ALL=C; export LANG LC_ALL
19 readonly PV_FILE='bindings/python/notmuch/version.py'
21 # Using array here turned out to be unnecessarily complicated
25 emsgs="${emsgs:+$emsgs\n} $1"
28 for f in ./version debian/changelog NEWS "$PV_FILE"
30 if [ ! -f "$f" ]; then append_emsg "File '$f' is missing"
31 elif [ ! -r "$f" ]; then append_emsg "File '$f' is unreadable"
32 elif [ ! -s "$f" ]; then append_emsg "File '$f' is empty"
38 echo 'Release files problems; fix these and try again:'
46 then echo "'version' file contains more than one line"
50 echo "Reading './version' file failed (suprisingly!)"
60 echo "Please follow the instructions in RELEASING to choose a version"
64 echo -n "Checking that '$VERSION' is good with digits and periods... "
67 verfail "'$VERSION' contains other characters than digits and periods" ;;
68 .*) verfail "'$VERSION' begins with a period" ;;
69 *.) verfail "'$VERSION' ends with a period" ;;
70 *..*) verfail "'$VERSION' contains two consecutive periods" ;;
72 *) verfail "'$VERSION' is a single number" ;;
76 # In the rest of this file, tests collect list of errors to be fixed
78 echo -n "Checking that this is Debian package for notmuch... "
79 read deb_notmuch deb_version rest < debian/changelog
80 if [ "$deb_notmuch" = 'notmuch' ]
85 append_emsg "Package name '$deb_notmuch' is not 'notmuch' in debian/changelog"
88 echo -n "Checking that Debian package version is $VERSION-1... "
90 if [ "$deb_version" = "($VERSION-1)" ]
95 append_emsg "Version '$deb_version' is not '($VERSION-1)' in debian/changelog"
98 echo -n "Checking that python bindings version is $VERSION... "
99 py_version=`python -c "execfile('$PV_FILE'); print __VERSION__"`
100 if [ "$py_version" = "$VERSION" ]
105 append_emsg "Version '$py_version' is not '$VERSION' in $PV_FILE"
108 echo -n "Checking that this is Notmuch NEWS... "
109 read news_notmuch news_version news_date < NEWS
110 if [ "$news_notmuch" = "Notmuch" ]
115 append_emsg "First word '$news_notmuch' is not 'Notmuch' in NEWS file"
118 echo -n "Checking that NEWS version is $VERSION... "
119 if [ "$news_version" = "$VERSION" ]
124 append_emsg "Version '$news_version' in NEWS file is not '$VERSION'"
127 #eval `date '+year=%Y mon=%m day=%d'`
128 today0utc=`date --date=0Z +%s` # gnu date feature
130 echo -n "Checking that NEWS date is right... "
132 '('[2-9][0-9][0-9][0-9]-[01][0-9]-[0123][0-9]')')
133 newsdate0utc=`nd=${news_date#\\(}; date --date="${nd%)} 0Z" +%s`
134 ddiff=$((newsdate0utc - today0utc))
135 if [ $ddiff -lt -86400 ] # since beginning of yesterday...
138 append_emsg "Date $news_date in NEWS file is too much in the past"
139 elif [ $ddiff -gt 172800 ] # up to end of tomorrow...
142 append_emsg "Date $news_date in NEWS file is too much in the future"
148 append_emsg "Date '$news_date' in NEWS file is not in format (yyyy-mm-dd)"
151 readonly DATE=${news_date//[()]/} # bash feature
157 append_emsg "'$mp' has too many '.TH' lines"
160 man_date=${5-} man_version=${7-}
163 echo -n "Checking that manual page dates and versions are $DATE and $VERSION... "
164 manfiles=`find man -type f | sort`
169 *.[0-9]) ;; # fall below this 'case ... esac'
171 */Makefile.local | */Makefile ) continue ;;
172 */.gitignore) continue ;;
175 *) append_emsg "'$mp': extra file"
179 manthdata `sed -n '/^[.]TH NOTMUCH/ { y/"/ /; p; }' "$mp"`
180 if [ "$man_version" != "$VERSION" ]
181 then append_emsg "Version '$man_version' is not '$VERSION' in $mp"
184 if [ "$man_date" != "$DATE" ]
185 then append_emsg "DATE '$man_date' is not '$DATE' in $mp"
194 echo 'Release check failed; check these issues:'
199 echo 'All checks this script executed completed successfully.'
200 echo 'Make sure that everything else mentioned in RELEASING'
201 echo 'file is in order, too.'