From 45c33d2a172c2ced93749f456e80b754243f6301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C4=83t=C4=83lin=20R=C4=83ceanu?= Date: Thu, 23 Mar 2017 02:55:24 +0200 Subject: [PATCH] Add scripts for automating more parts of the release process Update dates in various files before the release automatically. Also automatically update SHA-1 of the release files both before the release (to zero them) and afterwards (to use the correct values). Closes https://github.com/wxWidgets/wxWidgets/pull/443 --- build/tools/post-release.sh | 22 +++++++++++ build/tools/pre-release.sh | 58 +++++++++++++++++++++++++++++ docs/contributing/how-to-release.md | 28 +++++++------- 3 files changed, 94 insertions(+), 14 deletions(-) create mode 100755 build/tools/post-release.sh create mode 100755 build/tools/pre-release.sh diff --git a/build/tools/post-release.sh b/build/tools/post-release.sh new file mode 100755 index 0000000000..290397c37c --- /dev/null +++ b/build/tools/post-release.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# Exit immediately if a command exits with a non-zero status. +set -e + +# Build the file list for sha1sums, from `docs/release.md` +declare -a files=(`sed -n '/^## Download Verification/,/^## Binaries/p' ../../docs/release.md | sed -n -E 's/^\s*0{40}\s{2}(wx.*)/\1/p'`) + +# Get the release version +ver_string=`grep '#define wxVERSION_STRING ' ./../../include/wx/version.h | sed 's/^.*"wxWidgets \(.*\)")/\1/'` + +for i in "${files[@]}" +do + # compute sha1sum + sha1sum=`sha1sum ./../../distrib/release/$ver_string/$i` + + # save the sha1sum for this file + sed -i -E "/^\s*[0]{40}\s{2}wx/ s/(^\s*)[0]{40}(\s{2}$i)/\1$sha1sum\2/" ./../../docs/release.md +done + +# Commit sha1sum related changes +git commit -m "Update released files sha1sums after $ver_string release" ./../../docs/release.md diff --git a/build/tools/pre-release.sh b/build/tools/pre-release.sh new file mode 100755 index 0000000000..252c2cd9bf --- /dev/null +++ b/build/tools/pre-release.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +# build a list of English locales +declare -a locale_list=("en_GB" "en_US") +# get available en locales (including .utf8 and .UTF-8 ones) +declare -a en_locales=(`locale -a | grep '^C\|^POSIX\|^en_'`) +locale_list+=("${en_locales[@]}") + +found=0 + +# set an English locale to get the month name +for i in "${locale_list[@]}" +do + LC_ALL="$i" + + # check that setting the locale succeeded + # if it failed then LC_TIME would be empty + my_locale=`locale | grep LC_TIME | sed 's/.*"\(.*\)".*/\1/'` + if [ "$my_locale" = "$i" ] + then + echo Locale set to $i + found=1 + break + fi +done + +if [ $found = 0 ] +then + echo Could not set an appropriate locale + exit 1 +fi + +# Exit immediately if a command exits with a non-zero status. +set -e + +# get the month name and the year, see $(date +'%B %Y') +# then use it in the relevant line (one before last) +sed -i "/^The wxWidgets Team, / s/.*/The wxWidgets Team, $(date +'%B %Y')/" ./../../docs/readme.txt +echo Updated date in docs/readme.txt + +# reset checksums to a string of 40 0-s, see $(printf '%.40d' 0) +sed -i -E "/^\s*[0-9a-f]{40}\s{1,2}wx/ s/(\s*)[0-9a-f]{40}(\s{1,2}wx)/\1$(printf '%.40d' 0)\2/" ./../../docs/release.md +echo Reset checksums in docs/release.md + +# get current date, see $(date +'%Y-%m-%d') +# then use it in the line containing "X.X.X: (not released yet)" +sed -i "/^[3-9]\.[0-9]\.[0-9]: (not released yet)$/ s/not released yet/released $(date +'%Y-%m-%d')/" ./../../docs/changes.txt +echo Updated release date in docs/changes.txt + +# get current date, see $(date +'%B %d, %Y') +# then use it in the line starting with @date +sed -i "/^@date / s/.*/@date $(date +'%B %d, %Y')/" ./../../docs/doxygen/mainpages/manual.h +echo Updated date in docs/doxygen/mainpages/manual.h + +# get current date, see $(date +'%B %d, %Y') +# then use it in the first line +sed -i "1s/^.* -- /$(date +'%B %d, %Y') -- /" ./../../docs/publicity/announce.txt +echo Updated date in docs/publicity/announce.txt diff --git a/docs/contributing/how-to-release.md b/docs/contributing/how-to-release.md index c23657dcaa..a3a5a7aa6e 100644 --- a/docs/contributing/how-to-release.md +++ b/docs/contributing/how-to-release.md @@ -46,23 +46,22 @@ and then run it using the new DLLs. ## Pre-Release Steps -* Update `docs/readme.txt`. Please review its contents in addition to just - changing the version number. -* Update `docs/release.md` (the release sha1sums should be set to zeroes). -* Put a date on the release line in `docs/changes.txt`. -* Update the date in the manual (`docs/doxygen/mainpages/manual.h`). -* Update the release announcement post in `docs/publicity/announce.txt`. +1. Perform the following steps. You can run `build/tools/pre-release.sh` to do + the straightforward changes like updating the date and version number + automatically, but please also review and update the contents of the README + and announcement text. + * Update `docs/readme.txt`: version needs to be changed, content updated. + * Update `docs/release.md`: the release sha1sums should be set to zeroes. + * Put a date on the release line in `docs/changes.txt`. + * Update the date in the manual (`docs/doxygen/mainpages/manual.h`). + * Update the release announcement post in `docs/publicity/announce.txt`. -Commit the changes and finally tag the release, preferably GPG-signed: +2. Commit the changes and tag the release using your GPG key: git tag -s -m 'Tag X.Y.Z release' vX.Y.Z -and otherwise unsigned: - - git tag -m 'Tag X.Y.Z release' vX.Y.Z - -Don't overwrite existing tags. For non-final releases use e.g. `X.Y.Z-rc1` -instead of `X.Y.Z`. + Don't overwrite existing tags. For non-final releases use e.g. `X.Y.Z-rc1` + instead of `X.Y.Z`. ## Creating Release Files @@ -91,7 +90,8 @@ ensure you have the appropriate tag or commit checked out. wxMSW-x.y.z-Setup.exe wxWidgets-x.y.z.chm -5. Update the sha1sums in `docs/release.md` and commit the changes. +5. Run `./build/tools/post-release.sh` to update the sha1sums in + `docs/release.md` and commit the changes. ## Uploading