[Skiboot] [PATCH 1/2] versioning: Unify all versioning to match skiboot versions
Cyril Bur
cyril.bur at au1.ibm.com
Wed Jul 29 15:25:53 AEST 2015
Previously there has been some uncertainty as to how separate binaries were
to be versioned compared to the firmware version as they could change (or
not change) out of sync with skiboot versioning. Historically pflash was
born with its own version which didn't help the issue.
It has been decided that make_version.sh should always return one version
which is shall be the skiboot firmware version, external binaries can
supply their own prefix which will be s/skiboot/$prefix/ but the default
behaviour is the git tag versioning.
The main reason for versioning here is so developers can identify which
version of the code someone is running, versions which closly match the
source tree are easiest to deal with. The idea with one version and
every binary getting a bump regardless of changes is that there is a lot of
shared code (libflash/libffs are a prime example) and even if an external
binary isn't explicitly updated it is possible that changes to shared code
may be missed.
This patch simplifies make_version.sh which had been updated to deal with
pflash- git tags.
---
Makefile.main | 2 +-
external/pflash/rules.mk | 2 +-
make_version.sh | 37 +++++++++++++++----------------------
3 files changed, 17 insertions(+), 24 deletions(-)
diff --git a/Makefile.main b/Makefile.main
index 3851c20..48d8b8d 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -156,7 +156,7 @@ $(SUBDIRS):
# Set V=1 if you want to see everything.
include $(SRC)/Makefile.rules
-VERSION ?= $(shell cd $(SRC); GIT_DIR=$(SRC)/.git $(SRC)/make_version.sh skiboot)
+VERSION ?= $(shell cd $(SRC); GIT_DIR=$(SRC)/.git $(SRC)/make_version.sh)
.PHONY: VERSION-always
.version: VERSION-always
diff --git a/external/pflash/rules.mk b/external/pflash/rules.mk
index 06b9e33..d89748b 100644
--- a/external/pflash/rules.mk
+++ b/external/pflash/rules.mk
@@ -25,7 +25,7 @@ PFLASH_VERSION ?= $(shell ./make_version.sh $(EXE))
version.c: make_version.sh .version
@(if [ "a$(PFLASH_VERSION)" = "a" ]; then \
- echo "#error You need to set SKIBOOT_VERSION environment variable" > $@ ;\
+ echo "#error You need to set PFLASH_VERSION environment variable" > $@ ;\
else \
echo "const char version[] = \"$(PFLASH_VERSION)\";" ;\
fi) > $@
diff --git a/make_version.sh b/make_version.sh
index 95058cb..15aed6b 100755
--- a/make_version.sh
+++ b/make_version.sh
@@ -1,35 +1,23 @@
#!/bin/bash
usage() {
- echo "$0 git-tag-prefix"
- echo -e "\tIf inside git dir specify a tag prefix to use."
- echo -e "\tWhere a prefix is anything before the first dash '-' character."
+ echo "$0 [ prefix ]"
+ echo -e "\t Optionally specify a prefix other than 'skiboot'"
echo
- if test -d .git || git rev-parse --is-inside-work-tree > /dev/null 2>&1;
- then
- echo "Possible tags include:"
- git tag | cut -d '-' -f 1 | sort | uniq
- fi
}
-if test -e .git || git rev-parse --is-inside-work-tree > /dev/null 2>&1;
+if [ "$1" = "-h" -o "$1" = "--help" ] ;
then
- if [ $# -ne "1" ] ; then
- usage
- exit 1;
- fi
-
- TAG_PREFIX="$1"
-
- #Check that there is at least one of such a prefix
- if ! git tag | grep -q "$TAG_PREFIX" ; then
- echo -e "There isn't a single gix tag with prefix '$TAG_PREFIX'\n" > stderr
- fi
+ usage
+ exit 1;
+fi
- version=`git describe --exact-match --match "$TAG_PREFIX-*" 2>/dev/null`
+if test -e .git || git rev-parse --is-inside-work-tree > /dev/null 2>&1;
+then
+ version=`git describe --exact-match 2>/dev/null`
if [ -z "$version" ];
then
- version=`git describe --match "$TAG_PREFIX-*" 2>/dev/null`
+ version=`git describe 2>/dev/null`
fi
if [ -z "$version" ];
then
@@ -51,6 +39,11 @@ then
version="$version-$diffsha"
fi
+ if [ $# -eq 1 ];
+ then
+ version=`echo $version | sed s/skiboot/$1/`
+ fi
+
echo $version
else
if [ ! -z "$SKIBOOT_VERSION" ];
--
2.5.0
More information about the Skiboot
mailing list