build: add support for .scmversion files for GLUON_VERSION and GLUON_SITE_VERSION

Sometimes it is useful to override the default version detection, for
example when local patches are applied to a repo. Allow providing a
version number using a file called .scmversion, which is the same that
the Linux kernel and U-Boot use.
This commit is contained in:
Matthias Schiffer 2021-09-21 17:57:34 +02:00
parent b5db6435e5
commit 1c89f616a9
3 changed files with 16 additions and 0 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
.bash_history
.subversion
.wget-hsts
/.scmversion

View File

@ -88,3 +88,17 @@ update.sh
source and installs it into *packages/* directory. It simply tries to set the *base*
branch of the cloned repo to the correct commit. If this fails it fetches the
upstream branch and tries again to set the local *base* branch.
getversion.sh
Used to determine the version numbers of the repositories of Gluon and the
site configuraiton, to be included in the built firmware images as
*/lib/gluon/gluon-version* and */lib/gluon/site-version*.
By default, this uses ``git describe`` to generate a version number based
on the last git tag. This can be overridden by putting a file called
*.scmversion* into the root of the respective repositories.
A command like ``rm -f .scmversion; echo "$(./scripts/getversion.sh .)" > .scmversion``
can be used before applying local patches to ensure that the reported
version numbers refer to an upstream commit ID rather than an arbitrary
local one after ``git am``.

View File

@ -7,6 +7,7 @@ fi
cd "$1" || exit 1
cat .scmversion 2>/dev/null && exit 0
git --git-dir=.git describe --always --abbrev=7 --dirty=+ 2>/dev/null && exit 0
echo unknown