diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-11-19 12:15:07 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-11-19 12:19:30 +1100 |
commit | 0b18bd2ae2db1e6fd15e859b00b23bb39886f528 (patch) | |
tree | b6e2c141d55c2d274b152fadea92871a3f08e803 /make_version.sh | |
parent | 0265f805be05f224fbcf3913fb4c604fa04da7e0 (diff) | |
download | talos-skiboot-0b18bd2ae2db1e6fd15e859b00b23bb39886f528.tar.gz talos-skiboot-0b18bd2ae2db1e6fd15e859b00b23bb39886f528.zip |
Implement skiboot versioning
We grab a version from git tags (or SKIBOOT_VERSION environment variable),
optionally tack on EXTRA_VERSION (if from git) as well as add things to the
git version number if we're ahead of the most recent tag or the tree is dirty.
Also fix-up makefiles so that we don't have to rebuild version.c every time
you run make.
fsp attn area needed updating as we can have >40 character version strings.
We also export the version string via device tree rather than just the gitid.
For buildroot builds, setting SKIBOOT_VERSION environment variable to the
tag you grab will do the correct thing.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'make_version.sh')
-rwxr-xr-x | make_version.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/make_version.sh b/make_version.sh new file mode 100755 index 00000000..14097044 --- /dev/null +++ b/make_version.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +if test -d .git; +then + version=`git describe --exact-match 2>/dev/null` + if [ -z "$version" ]; + then + version=`git describe 2>/dev/null` + fi + if [ -z "$version" ]; + then + version=`git rev-parse --verify --short HEAD 2>/dev/null` + fi + if [ ! -z "$EXTRA_VERSION" ]; + then + version="$version-$EXTRA_VERSION" + fi + if git diff-index --name-only HEAD |grep -qv '.git'; + then + if [ ! -z "$USER" ]; + then + version="$version-$USER" + fi + version="$version-dirty" + diffsha=`git diff|sha1sum` + diffsha=`cut -c-7 <<< "$diffsha"` + version="$version-$diffsha" + fi + + echo $version +else + if [ ! -z "$SKIBOOT_VERSION" ]; + then + echo $SKIBOOT_VERSION + else + exit 1; + fi +fi |