Allow running pre/post-release scripts from any directory

Don't assume they're run from the directory containing them, especially
as this is not how they are shown to be invoked in the release
instructions.

Now running ./build/tools/pre-release.sh works too.
This commit is contained in:
Vadim Zeitlin
2017-11-16 18:49:45 +01:00
parent 2fc4b76cf0
commit a80210f0d7
2 changed files with 14 additions and 10 deletions

View File

@@ -3,20 +3,22 @@
# Exit immediately if a command exits with a non-zero status.
set -e
topdir=`dirname $0`/../..
# 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'`)
declare -a files=(`sed -n '/^## Download Verification/,/^## Binaries/p' $topdir/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/'`
ver_string=`grep '#define wxVERSION_STRING ' $topdir/include/wx/version.h | sed 's/^.*"wxWidgets \(.*\)")/\1/'`
for i in "${files[@]}"
do
# compute sha1sum
sha1sum=`sha1sum ./../../distrib/release/$ver_string/$i`
sha1sum=`sha1sum $topdir/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
sed -i -E "/^\s*[0]{40}\s{2}wx/ s/(^\s*)[0]{40}(\s{2}$i)/\1$sha1sum\2/" $topdir/docs/release.md
done
# Commit sha1sum related changes
git commit -m "Update released files sha1sums after $ver_string release" ./../../docs/release.md
git commit -m "Update released files sha1sums after $ver_string release" $topdir/docs/release.md

View File

@@ -33,26 +33,28 @@ fi
# Exit immediately if a command exits with a non-zero status.
set -e
topdir=`dirname $0`/../..
# 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
sed -i "/^The wxWidgets Team, / s/.*/The wxWidgets Team, $(date +'%B %Y')/" $topdir/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
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/" $topdir/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
sed -i "/^[3-9]\.[0-9]\.[0-9]: (not released yet)$/ s/not released yet/released $(date +'%Y-%m-%d')/" $topdir/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
sed -i "/^@date / s/.*/@date $(date +'%B %d, %Y')/" $topdir/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
sed -i "1s/^.* -- /$(date +'%B %d, %Y') -- /" $topdir/docs/publicity/announce.txt
echo Updated date in docs/publicity/announce.txt