diff --git a/.gitignore b/.gitignore index a929851e8a544a870fbaa2c76cd998a7633f552e..c812721871833701be1b5e926ee02fd9bf1e968f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ .bash_history .subversion .wget-hsts +/.scmversion diff --git a/docs/dev/build.rst b/docs/dev/build.rst index 74b9aa11f2c49fe0baeb4df526e1d2f037081735..92fd672bd9667f43a76fb9126f13c3b739f162b6 100644 --- a/docs/dev/build.rst +++ b/docs/dev/build.rst @@ -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``. diff --git a/scripts/getversion.sh b/scripts/getversion.sh index cbb7cf602e302e88353a7a90ba03e1fe5f516f72..8c437762a2654a5a5f7749bf7b84e6e9c994b304 100755 --- a/scripts/getversion.sh +++ b/scripts/getversion.sh @@ -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