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 readonly DEFAULT_IFS="$IFS" # Note: In this particular case quotes are needed.
18 # Avoid locale-specific differences in output of executed commands
19 LANG=C LC_ALL=C; export LANG LC_ALL
21 readonly PV_FILE='bindings/python/notmuch/version.py'
23 # Using array here turned out to be unnecessarily complicated
28 emsg_count=$((emsg_count + 1))
29 emsgs="${emsgs:+$emsgs\n} $1"
32 for f in ./version debian/changelog NEWS "$PV_FILE"
34 if [ ! -f "$f" ]; then append_emsg "File '$f' is missing"
35 elif [ ! -r "$f" ]; then append_emsg "File '$f' is unreadable"
36 elif [ ! -s "$f" ]; then append_emsg "File '$f' is empty"
42 echo 'Release files problems; fix these and try again:'
50 then echo "'version' file contains more than one line"
54 echo "Reading './version' file failed (suprisingly!)"
60 # In the rest of this file, tests collect list of errors to be fixed
62 echo -n "Checking that git working directory is clean... "
63 git_status=`git status --porcelain`
64 if [ "$git_status" = '' ]
69 append_emsg "Git working directory is not clean (git status --porcelain)."
77 append_emsg " Please follow the instructions in RELEASING to choose a version"
80 echo -n "Checking that '$VERSION' is good with digits and periods... "
83 verfail "'$VERSION' contains other characters than digits and periods" ;;
84 .*) verfail "'$VERSION' begins with a period" ;;
85 *.) verfail "'$VERSION' ends with a period" ;;
86 *..*) verfail "'$VERSION' contains two consecutive periods" ;;
88 *) verfail "'$VERSION' is a single number" ;;
91 echo -n "Checking that this is Debian package for notmuch... "
92 read deb_notmuch deb_version rest < debian/changelog
93 if [ "$deb_notmuch" = 'notmuch' ]
98 append_emsg "Package name '$deb_notmuch' is not 'notmuch' in debian/changelog"
101 echo -n "Checking that Debian package version is $VERSION-1... "
103 if [ "$deb_version" = "($VERSION-1)" ]
108 append_emsg "Version '$deb_version' is not '($VERSION-1)' in debian/changelog"
111 echo -n "Checking that python bindings version is $VERSION... "
112 py_version=`python -c "with open('$PV_FILE') as vf: exec(vf.read()); print(__VERSION__)"`
113 if [ "$py_version" = "$VERSION" ]
118 append_emsg "Version '$py_version' is not '$VERSION' in $PV_FILE"
121 echo -n "Checking that NEWS header is tidy... "
122 if [ "`exec sed 's/./=/g; 1q' NEWS`" = "`exec sed '1d; 2q' NEWS`" ]
127 if [ "`exec sed '1d; s/=//g; 2q' NEWS`" != '' ]
129 append_emsg "Line 2 in NEWS file is not all '=':s"
131 append_emsg "Line 2 in NEWS file does not have the same length as line 1"
135 echo -n "Checking that this is Notmuch NEWS... "
136 read news_notmuch news_version news_date < NEWS
137 if [ "$news_notmuch" = "Notmuch" ]
142 append_emsg "First word '$news_notmuch' is not 'Notmuch' in NEWS file"
145 echo -n "Checking that NEWS version is $VERSION... "
146 if [ "$news_version" = "$VERSION" ]
151 append_emsg "Version '$news_version' in NEWS file is not '$VERSION'"
154 #eval `date '+year=%Y mon=%m day=%d'`
155 today0utc=`date --date=0Z +%s` # gnu date feature
157 echo -n "Checking that NEWS date is right... "
159 '('[2-9][0-9][0-9][0-9]-[01][0-9]-[0123][0-9]')')
160 newsdate0utc=`nd=${news_date#\\(}; date --date="${nd%)} 0Z" +%s`
161 ddiff=$((newsdate0utc - today0utc))
162 if [ $ddiff -lt -86400 ] # since beginning of yesterday...
165 append_emsg "Date $news_date in NEWS file is too much in the past"
166 elif [ $ddiff -gt 172800 ] # up to end of tomorrow...
169 append_emsg "Date $news_date in NEWS file is too much in the future"
175 append_emsg "Date '$news_date' in NEWS file is not in format (yyyy-mm-dd)"
179 echo -n "Checking that copyright in documentation contains 2009-$year... "
180 # Read the value of variable `copyright' defined in 'doc/conf.py'.
181 # As __file__ is not defined when python command is given from command line,
182 # it is defined before contents of 'doc/conf.py' (which dereferences __file__)
184 copyrightline=`exec python -c "with open('doc/conf.py') as cf: __file__ = ''; exec(cf.read()); print(copyright)"`
185 case $copyrightline in
190 append_emsg "The copyright in doc/conf.py line '$copyrightline' does not contain '2009-$year'"
196 echo 'Release check failed; check these issues:'
201 echo 'All checks this script executed completed successfully.'
202 echo 'Make sure that everything else mentioned in RELEASING'
203 echo 'file is in order, too.'