[PATCH V2 1/2] devel: add release-checks.sh
authorTomi Ollila <tomi.ollila@iki.fi>
Sat, 1 Sep 2012 09:32:07 +0000 (12:32 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:16 +0000 (09:49 -0800)
34/5fa161763f897ef203d96465761eeaa6e6d28c [new file with mode: 0644]

diff --git a/34/5fa161763f897ef203d96465761eeaa6e6d28c b/34/5fa161763f897ef203d96465761eeaa6e6d28c
new file mode 100644 (file)
index 0000000..e0c46e1
--- /dev/null
@@ -0,0 +1,290 @@
+Return-Path: <too@guru-group.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 40A10431FBD\r
+       for <notmuch@notmuchmail.org>; Sat,  1 Sep 2012 02:32:14 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id roBYaiukSLPb for <notmuch@notmuchmail.org>;\r
+       Sat,  1 Sep 2012 02:32:13 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id BA93F431FAF\r
+       for <notmuch@notmuchmail.org>; Sat,  1 Sep 2012 02:32:12 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+       id 476FB100635; Sat,  1 Sep 2012 12:32:19 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH V2 1/2] devel: add release-checks.sh\r
+Date: Sat,  1 Sep 2012 12:32:07 +0300\r
+Message-Id: <1346491928-2356-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.7.1\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 01 Sep 2012 09:32:14 -0000\r
+\r
+Currently Makefile.local contains some machine executable release\r
+checking functionality. This is unnecessarily complex way to do it:\r
+\r
+Multiline script functionality is hard to embed -- from Makefile point\r
+of view there is just one line split using backslashes and every line\r
+ends with ';'. It is hard to maintain such "script" when it gets longer.\r
+\r
+The embedded script does not fail as robust as separate script; set -eu\r
+could be added to get same level of robustness -- but the provided\r
+Bourne Again Shell (bash) script exceeds this with 'set -o pipefail',\r
+making the script to fail when any of the commands in pipeline fails\r
+(and not just the last one).\r
+\r
+Checking for release is done very seldom compared to all other use;\r
+The whole Makefile.local gets simpler and easier to grasp when most\r
+release checking targets are removed.\r
+\r
+When release checking is done, the steps are executed sequentially;\r
+nothing is allowed to be skipped due to some satisfied dependency.\r
+---\r
+\r
+This patch obsoletes (now moreinfo) patch in\r
+\r
+id:"1344456107-19308-1-git-send-email-tomi.ollila@iki.fi"\r
+\r
+ devel/release-checks.sh | 211 ++++++++++++++++++++++++++++++++++++++++++++++++\r
+ 1 file changed, 211 insertions(+)\r
+ create mode 100755 devel/release-checks.sh\r
+\r
+diff --git a/devel/release-checks.sh b/devel/release-checks.sh\r
+new file mode 100755\r
+index 0000000..7dadefa\r
+--- /dev/null\r
++++ b/devel/release-checks.sh\r
+@@ -0,0 +1,211 @@\r
++#!/usr/bin/env bash\r
++\r
++set -eu\r
++#set -x # or enter bash -x ... on command line\r
++\r
++if [ x"${BASH_VERSION-}" = x ]\r
++then  echo\r
++      echo "Please execute this script using 'bash' interpreter"\r
++      echo\r
++      exit 1\r
++fi\r
++\r
++set -o pipefail # bash feature\r
++\r
++# Avoid locale-specific differences in output of executed commands\r
++LANG=C LC_ALL=C; export LANG LC_ALL\r
++\r
++readonly DEFAULT_IFS="$IFS"\r
++\r
++readonly PV_FILE='bindings/python/notmuch/version.py'\r
++\r
++# Using array here turned out to be unnecessarily complicated\r
++emsgs=''\r
++append_emsg ()\r
++{\r
++      emsgs="${emsgs:+$emsgs\n}  $1"\r
++}\r
++\r
++for f in ./version debian/changelog NEWS "$PV_FILE"\r
++do\r
++      test -f $f || { append_emsg "File '$f' is missing"; continue; }\r
++      test -r $f || { append_emsg "File '$f' is unreadable"; continue; }\r
++      test -s $f ||   append_emsg "File '$f' is empty"\r
++done\r
++\r
++if [ -n "$emsgs" ]\r
++then\r
++      echo 'Release files problems; fix these and try again:'\r
++      echo -e "$emsgs"\r
++      exit 1\r
++fi\r
++\r
++if read VERSION\r
++then\r
++      if read rest\r
++      then    echo "'version' file contains more than one line"\r
++              exit 1\r
++      fi\r
++else\r
++      echo "Reading './version' file failed (suprisingly!)"\r
++      exit 1\r
++fi < ./version\r
++\r
++readonly VERSION\r
++\r
++verfail ()\r
++{\r
++      echo No.\r
++      echo "$@"\r
++      echo "Please follow the instructions in RELEASING to choose a version"\r
++      exit 1\r
++}\r
++\r
++echo -n "Checking that '$VERSION' is good with digits and periods... "\r
++if [ -z "${VERSION//[0123456789.]/}" ] # bash feature\r
++then\r
++      case $VERSION in\r
++              .*)     verfail "'$VERSION' begins with a period" ;;\r
++              *.)     verfail "'$VERSION' ends with a period" ;;\r
++              *..*)   verfail "'$VERSION' contains two consecutive periods" ;;\r
++              *.*)    echo Yes. ;;\r
++              *)      verfail "'$VERSION' is a single number" ;;\r
++      esac\r
++else\r
++      verfail "'$VERSION' contains other characters than digits and periods"\r
++fi\r
++\r
++\r
++# In the rest of this file, tests collect list of errors to be fixed\r
++\r
++echo -n "Checking that this is Debian package for notmuch... "\r
++read deb_notmuch deb_version rest < debian/changelog\r
++if [ "$deb_notmuch" = 'notmuch' ]\r
++then\r
++      echo Yes.\r
++else\r
++      echo No.\r
++      append_emsg "Package name '$deb_notmuch' is not 'notmuch' in debian/changelog"\r
++fi\r
++\r
++echo -n "Checking that Debian package version is $VERSION-1... "\r
++\r
++if [ "$deb_version" = "($VERSION-1)" ]\r
++then\r
++      echo Yes.\r
++else\r
++      echo No.\r
++      append_emsg "Version '$deb_version' is not '($VERSION-1)' in debian/changelog"\r
++fi\r
++\r
++echo -n "Checking that python bindings version is $VERSION... "\r
++py_version=`python -c "execfile('$PV_FILE'); print __VERSION__"`\r
++if [ "$py_version" = "$VERSION" ]\r
++then\r
++      echo Yes.\r
++else\r
++      echo No.\r
++      append_emsg "Version '$py_version' is not '$VERSION' in $PV_FILE"\r
++fi\r
++\r
++echo -n "Checking that this is Notmuch NEWS... "\r
++read news_notmuch news_version news_date < NEWS\r
++if [ "$news_notmuch" = "Notmuch" ]\r
++then\r
++      echo Yes.\r
++else\r
++      echo No.\r
++      append_emsg "First word '$news_notmuch' is not 'Notmuch' in NEWS file"\r
++fi\r
++\r
++echo -n "Checking that NEWS version is $VERSION... "\r
++if [ "$news_version" = "$VERSION" ]\r
++then\r
++      echo Yes.\r
++else\r
++      echo No.\r
++      append_emsg "Version '$news_version' in NEWS file is not '$VERSION'"\r
++fi\r
++\r
++#eval `date '+year=%Y mon=%m day=%d'`\r
++today0utc=`date --date=0Z +%s` # gnu date feature\r
++\r
++echo -n "Checking that NEWS date is right... "\r
++case $news_date in\r
++ '('[2-9][0-9][0-9][0-9]-[01][0-9]-[0123][0-9]')')\r
++      newsdate0utc=`nd=${news_date#\\(}; date --date="${nd%)} 0Z" +%s`\r
++      ddiff=$((newsdate0utc - today0utc))\r
++      if [ $ddiff -lt -86400 ] # since beginning of yesterday...\r
++      then\r
++              echo No.\r
++              append_emsg "Date $news_date in NEWS file is too much in the past"\r
++      elif [ $ddiff -gt 172800 ] # up to end of tomorrow...\r
++      then\r
++              echo No.\r
++              append_emsg "Date $news_date in NEWS file is too much in the future"\r
++      else\r
++              echo Yes.\r
++      fi ;;\r
++ *)\r
++      echo No.\r
++      append_emsg "Date '$news_date' in NEWS file is not in format (yyyy-mm-dd)"\r
++esac\r
++\r
++readonly DATE=${news_date//[()]/} # bash feature\r
++manthdata ()\r
++{\r
++      set x $*\r
++      if [ $# != 7 ]\r
++      then\r
++              append_emsg "'$mp' has too many '.TH' lines"\r
++              man_mismatch=1\r
++      fi\r
++      man_date=${5-} man_version=${7-}\r
++}\r
++\r
++echo -n "Checking that manual page dates and versions are $DATE and $VERSION... "\r
++manfiles=`find man -type f | sort`\r
++man_pages_ok=Yes\r
++for mp in $manfiles\r
++do\r
++      case $mp in *.[0-9]) ;; # fall below this 'case ... esac'\r
++              */Makefile.local | */Makefile ) continue ;;\r
++              */.gitignore)   continue ;;\r
++              *.bak)          continue ;;\r
++\r
++              *)      append_emsg "'$mp': extra file"\r
++                      man_pages_ok=No\r
++                      continue\r
++      esac\r
++      manthdata `sed -n '/^[.]TH NOTMUCH/ { y/"/ /; p; }' "$mp"`\r
++      if [ "$man_version" != "$VERSION" ]\r
++      then    append_emsg "Version '$man_version' is not '$VERSION' in $mp"\r
++              mman_pages_ok=No\r
++      fi\r
++      if [ "$man_date" != "$DATE" ]\r
++      then    append_emsg "DATE '$man_date' is not '$DATE' in $mp"\r
++              man_pages_ok=No\r
++      fi\r
++done\r
++echo $man_pages_ok.\r
++\r
++if [ -n "$emsgs" ]\r
++then\r
++      echo\r
++      echo 'Release check failed; check these issues:'\r
++      echo -e "$emsgs"\r
++      exit 1\r
++fi\r
++\r
++echo 'All checks this script executed completed successfully.'\r
++echo 'Make sure that everything else mentioned in RELEASING'\r
++echo 'file is in order, too.'\r
++\r
++exit 0\r
++\r
++# Local variables:\r
++# mode: shell-script\r
++# sh-basic-offset: 8\r
++# tab-width: 8\r
++# End:\r
++# vi: set sw=8 ts=8\r
+--\r
+1.7.11.4\r