]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
build: Add "basebranch" to .gitreview
authorGeorge Joseph <gjoseph@digium.com>
Wed, 26 Jan 2022 13:56:15 +0000 (06:56 -0700)
committerJoshua Colp <jcolp@sangoma.com>
Tue, 1 Feb 2022 13:30:07 +0000 (07:30 -0600)
If you have a development branch for a major project that
will receive gerrit reviews it'll probably be named something
like "development/16/newproject".  That will necessitate setting
"defaultbranch=development/16/newproject" in .gitreview.  The
make_version script uses that variable to construct the asterisk
version however, which results in versions like
"GIT-development/16/newproject-ee582a8c7b" which is probably not
what you want.  Worse, since the download_externals script uses
make_version to construct the URL to download the binary codecs
or DPMA.  Since it's expecting a simple numeric version, the
downloads will fail.

To get this to work, a new variable "basebranch" has been added
to .gitreview and make_version has been updated to use that instead
of defaultversion:

.gitreview:
defaultbranch=development/16/myproject
basebranch=16

Now git-review will send the reviews to the proper branch
(development/16/myproject) but the version will still be
constructed using the simple branch number (16).

If "basebranch" is missing from .gitreview, make_version will
fall back to using "defaultbranch".

Change-Id: I2941a3b21e668febeb6cfbc1a7bb51a67726fcc4

.gitreview
build_tools/make_version

index a57dca79d9e08c26e86995cbc72a85259abb8529..a233c590b0f9467f2c4fa38ce8495bab3a5ada64 100644 (file)
@@ -1,5 +1,6 @@
 [gerrit]
 defaultbranch=16
+basebranch=16
 #
 # Intentional padding to ensure it is possible to point a commit
 # to an alternative gerrit server/repository without breaking
index 83c42d1fba3b6bc2a2c78d301b39136b535bbb9f..6ef7b2941d6ca7d063ef145048e63fe734bd5b7c 100755 (executable)
@@ -100,7 +100,11 @@ elif [ -d ${1}/.git ]; then
     MODIFIED=""
     SVN_REV=`${GIT} log --pretty=full -1 | sed -n '/git-svn-id:/ s/.*\@\([^ ]*\) .*/\1/p'`
     if [ -z "$SVN_REV" ]; then
-        MAINLINE_BRANCH=$(git config -f .gitreview --get gerrit.defaultbranch)
+        MAINLINE_BRANCH=$(${GIT} config -f .gitreview --get gerrit.basebranch)
+        if [ "x${MAINLINE_BRANCH}" == "x" ] ; then
+            MAINLINE_BRANCH=$(${GIT} config -f .gitreview --get gerrit.defaultbranch)
+        fi
+
         VERSION=`${GIT} describe --long --always --tags --dirty=M 2> /dev/null`
         if [ $? -ne 0 ]; then
             if [ "`${GIT} ls-files -m | wc -l`" != "0" ]; then