summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Rosengren <robert.rosengren@stericsson.com>2011-02-07 15:30:38 +0100
committerMichael BRANDT <michael.brandt@stericsson.com>2011-02-09 11:35:20 +0100
commite663de63c2e94465741c26ff80d5fe5cc24e8d8e (patch)
tree74760b64b298f311fe786fa4b74b5fc69f437152
parente445fc651e204d1c7da411d80cbbc2e716710e4e (diff)
setlocalversion: Add support for getting info from correct tag
Previously the setlocalversion script checked if the git had untagged commits since the latest tag. If one wants to set extra tags as checkpoints, other than the official releases, then this will give incorrect version. This patch introduce a second optional parameter to setlocalversion, for specifying a git tag to look for. The Makefile specifies the u-boot version and passes it to the script. The script will then look for untagged commits since the "u-boot version"-tag. ST-Ericsson ID: None ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I7315f4d38d6b74b78e118b36aac271859658ff67 Signed-off-by: Robert Rosengren <robert.rosengren@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/14578 Reviewed-by: Michael BRANDT <michael.brandt@stericsson.com>
-rw-r--r--Makefile2
-rwxr-xr-xtools/setlocalversion12
2 files changed, 10 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 1a4de3da0..beed146ec 100644
--- a/Makefile
+++ b/Makefile
@@ -382,7 +382,7 @@ $(U_BOOT_ONENAND): $(ONENAND_IPL) $(obj)u-boot.bin
$(VERSION_FILE):
@( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)" \
- '$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ) > $@.tmp
+ '$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR) v$(U_BOOT_VERSION))' ) > $@.tmp
@cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@
$(TIMESTAMP_FILE):
diff --git a/tools/setlocalversion b/tools/setlocalversion
index b3f5f2824..935a6a2a9 100755
--- a/tools/setlocalversion
+++ b/tools/setlocalversion
@@ -2,7 +2,7 @@
# Print additional version information for non-release trees.
usage() {
- echo "Usage: $0 [srctree]" >&2
+ echo "Usage: $0 [srctree] [git tag (optional)]" >&2
exit 1
}
@@ -10,10 +10,16 @@ cd "${1:-.}" || usage
# Check for git and a git repo.
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+ # Check if we shall search for specific tag, if not latest will be used
+ if [ -n "$2" ]; then
+ REV_REFS_OPTION="--refs refs/tags/"$2
+ MATCH_OPTION="--match "$2
+ fi
+
# Do we have an untagged version?
- if git name-rev --tags HEAD | \
+ if git name-rev --tags $REV_REFS_OPTION HEAD | \
grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
- git describe | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
+ git describe $MATCH_OPTION | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
fi
# Are there uncommitted changes?