From 9d0f6fc9956bbe773c13bc35c422879794f96572 Mon Sep 17 00:00:00 2001 From: Cary R Date: Sun, 1 Mar 2026 14:47:58 -0800 Subject: [PATCH] Add CREATE_BRANCH.sh script --- scripts/CREATE_BRANCH.sh | 51 +++++++++++++++++++++++++++++++++++++++ scripts/CREATE_RELEASE.sh | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 scripts/CREATE_BRANCH.sh diff --git a/scripts/CREATE_BRANCH.sh b/scripts/CREATE_BRANCH.sh new file mode 100644 index 000000000..c2e292810 --- /dev/null +++ b/scripts/CREATE_BRANCH.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +# This script creates a new release branch using the major version number +# that is passed as the only argument, +# +# 1. It creates a new branch with the proper name. +# +# 2. It then updates the version_base.h to match this version. It likely +# already does, but it is incorrectly marked as devel instead of stable. +# +# 3. It updates the default suffix in aclocal.m4 to match the branch. +# +# Now manually push the new branch to the master repository. +# +# git push -u origin v13-branch +# + +if [ $# -ne 1 ] ; then + echo "Usage: CREATE_BRANCH.sh " + exit 1; +fi +case $1 in + *[!0-9]*) echo "Major number must be numeric"; exit 1;; +esac + +major=$1 + +branch="v${major}-branch" + +branch_exists=`git ls-remote --heads origin $branch` +if [ -n "$branch_exists" ] ; then + echo "The branch $branch already exists. Aborting" + exit 1 +fi + +echo "Creating branch $branch" +git checkout -b $branch + +echo "Updating version_base.h..." +sed -i -E "s/(define\s+VERSION_MAJOR\s+).*/\1$major/" version_base.h +sed -i -E "s/(define\s+VERSION_MINOR\s+).*/\10/" version_base.h +sed -i -E "s/(define\s+VERSION_EXTRA\s+).*/\1\" \(stable\)\"/" version_base.h + +echo "Updating aclocal.m4..." +sed -i -E "s/(install_suffix='-)dev/\1$major/" aclocal.m4 + +echo "Adding updated files to the new branch..." +git add version_base.h aclocal.m4 +git commit -m "Creating new branch $branch" + +echo "Done" diff --git a/scripts/CREATE_RELEASE.sh b/scripts/CREATE_RELEASE.sh index 7df1291dc..9bff3b652 100644 --- a/scripts/CREATE_RELEASE.sh +++ b/scripts/CREATE_RELEASE.sh @@ -18,7 +18,7 @@ # (Push the commits and tag to the remote repository.) # # For a major release, create and switch to the new release branch before -# running this script. +# running this script. See: scripts/CREATE_BRANCH.sh if [ $# -ne 2 ] ; then echo "Usage: CREATE_RELEASE.sh "