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!)"
56 # In the rest of this file, tests collect list of errors to be fixed
62 append_emsg " Please follow the instructions in RELEASING to choose a version"
65 echo -n "Checking that '$VERSION' is good with digits and periods... "
68 verfail "'$VERSION' contains other characters than digits and periods" ;;
69 .*) verfail "'$VERSION' begins with a period" ;;
70 *.) verfail "'$VERSION' ends with a period" ;;
71 *..*) verfail "'$VERSION' contains two consecutive periods" ;;
73 *) verfail "'$VERSION' is a single number" ;;
77 echo -n "Checking that this is Debian package for notmuch... "
78 read deb_notmuch deb_version rest < debian/changelog
79 if [ "$deb_notmuch" = 'notmuch' ]
84 append_emsg "Package name '$deb_notmuch' is not 'notmuch' in debian/changelog"
87 echo -n "Checking that Debian package version is $VERSION-1... "
89 if [ "$deb_version" = "($VERSION-1)" ]
94 append_emsg "Version '$deb_version' is not '($VERSION-1)' in debian/changelog"
97 echo -n "Checking that python bindings version is $VERSION... "
98 py_version=`python -c "execfile('$PV_FILE'); print __VERSION__"`
99 if [ "$py_version" = "$VERSION" ]
104 append_emsg "Version '$py_version' is not '$VERSION' in $PV_FILE"
107 echo -n "Checking that NEWS header is tidy... "
108 if [ "`exec sed 's/./=/g; 1q' NEWS`" = "`exec sed '1d; 2q' NEWS`" ]
113 if [ "`exec sed '1d; s/=//g; 2q' NEWS`" != '' ]
115 append_emsg "Line 2 in NEWS file is not all '=':s"
117 append_emsg "Line 2 in NEWS file does not have the same length as line 1"
121 echo -n "Checking that this is Notmuch NEWS... "
122 read news_notmuch news_version news_date < NEWS
123 if [ "$news_notmuch" = "Notmuch" ]
128 append_emsg "First word '$news_notmuch' is not 'Notmuch' in NEWS file"
131 echo -n "Checking that NEWS version is $VERSION... "
132 if [ "$news_version" = "$VERSION" ]
137 append_emsg "Version '$news_version' in NEWS file is not '$VERSION'"
140 #eval `date '+year=%Y mon=%m day=%d'`
141 today0utc=`date --date=0Z +%s` # gnu date feature
143 echo -n "Checking that NEWS date is right... "
145 '('[2-9][0-9][0-9][0-9]-[01][0-9]-[0123][0-9]')')
146 newsdate0utc=`nd=${news_date#\\(}; date --date="${nd%)} 0Z" +%s`
147 ddiff=$((newsdate0utc - today0utc))
148 if [ $ddiff -lt -86400 ] # since beginning of yesterday...
151 append_emsg "Date $news_date in NEWS file is too much in the past"
152 elif [ $ddiff -gt 172800 ] # up to end of tomorrow...
155 append_emsg "Date $news_date in NEWS file is too much in the future"
161 append_emsg "Date '$news_date' in NEWS file is not in format (yyyy-mm-dd)"
164 readonly DATE=${news_date//[()]/} # bash feature
170 append_emsg "'$mp' has too many '.TH' lines"
173 man_date=${5-} man_version=${7-}
176 echo -n "Checking that manual page dates and versions are $DATE and $VERSION... "
177 manfiles=`find man -type f | sort`
182 *.[0-9]) ;; # fall below this 'case ... esac'
184 */Makefile.local | */Makefile ) continue ;;
185 */.gitignore) continue ;;
188 *) append_emsg "'$mp': extra file"
192 manthdata `sed -n '/^[.]TH NOTMUCH/ { y/"/ /; p; }' "$mp"`
193 if [ "$man_version" != "$VERSION" ]
194 then append_emsg "Version '$man_version' is not '$VERSION' in $mp"
197 if [ "$man_date" != "$DATE" ]
198 then append_emsg "DATE '$man_date' is not '$DATE' in $mp"
207 echo 'Release check failed; check these issues:'
212 echo 'All checks this script executed completed successfully.'
213 echo 'Make sure that everything else mentioned in RELEASING'
214 echo 'file is in order, too.'