From 2a5ea3cadee6decf2927822f4fdc53fdd4cbd677 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 22 Apr 2018 12:30:32 +0200 Subject: [PATCH] Improve helper scripts Note: Still to be tested (when upgrading to Qt 5.11.0). --- devel/qt5/continue-rebase-patches.sh | 26 ++++++++++++++++++++++++++ devel/qt5/rebase-patches.sh | 19 ++++++++++++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100755 devel/qt5/continue-rebase-patches.sh diff --git a/devel/qt5/continue-rebase-patches.sh b/devel/qt5/continue-rebase-patches.sh new file mode 100755 index 00000000..2465291c --- /dev/null +++ b/devel/qt5/continue-rebase-patches.sh @@ -0,0 +1,26 @@ +#set -euxo pipefail +set -e # abort on first error +shopt -s nullglob + +if ! [[ $1 ]] || ! [[ $2 ]]; then + echo 'No version specified, must specify the new and old version, eg. 5.9.2 5.9.1' + echo "Usage: $0 newversion" + exit -1 +fi +newversion="$1" + +# determine remote to push +remote= +for maybe_remote in 'martchus' 'origin'; do + if git remote get-url $maybe_remote; then + remote=$maybe_remote + break + fi +done +if ! [[ $remote ]]; then + echo "Unable to detect remote" + exit -2 +fi + +git cherry-pick --continue +git push -u $maybe_remote "$newversion-mingw-w64" diff --git a/devel/qt5/rebase-patches.sh b/devel/qt5/rebase-patches.sh index fc09c128..171ac130 100755 --- a/devel/qt5/rebase-patches.sh +++ b/devel/qt5/rebase-patches.sh @@ -4,12 +4,25 @@ shopt -s nullglob if ! [[ $1 ]] || ! [[ $2 ]]; then echo 'No version specified, must specify the new and old version, eg. 5.9.2 5.9.1' - echo "Usage: $0 newversion oldversion" + echo "Usage: $0 newversion oldversion [old-branch-suffix]" exit -1 fi newversion="$1" oldversion="$2" +oldbranchsuffix="$3" +# determine branch from old version +oldversionbranch="$oldversion-mingw-w64" +if [[ $oldbranchsuffix ]] \ + && oldversionbranch="$oldversionbranch-$oldbranchsuffix" +if [[ $(git branch | grep "$oldversionbranch" | wc -l) -gt 1 ]]; then + echo 'Which of the following branches was the latest for the old version?' + git branch | grep "$oldversionbranch" + echo 'Please disambiguate by specifying the corresponding suffix as 3rd argument.' + exit -1 +fi + +# determine remote to push remote= for maybe_remote in 'martchus' 'origin'; do if git remote get-url $maybe_remote; then @@ -17,13 +30,13 @@ for maybe_remote in 'martchus' 'origin'; do break fi done - if ! [[ $remote ]]; then echo "Unable to detect remote" exit -2 fi +# update Git checkout, create new branch with rebased commits, push to remote git remote update git checkout -b "$newversion-mingw-w64" "v$newversion" -git cherry-pick "v$oldversion..$oldversion"-mingw-w64 +git cherry-pick "v$oldversion..$oldversionbranch" git push -u $maybe_remote "$newversion-mingw-w64"