summaryrefslogtreecommitdiff
path: root/tools/setlocalversion
diff options
context:
space:
mode:
authorWolfgang Denk <wd@pollux.(none)>2006-02-21 17:33:04 +0100
committerWolfgang Denk <wd@pollux.(none)>2006-02-21 17:33:04 +0100
commit881a87ecbab328656eb3e9d25c3ed6868587b197 (patch)
tree227aae7103facd49a8bb4e00c1f751b731faaf1f /tools/setlocalversion
parent654c2d2836ff49c94a0bceb700701976e2682375 (diff)
downloadu-boot-imx-881a87ecbab328656eb3e9d25c3ed6868587b197.zip
u-boot-imx-881a87ecbab328656eb3e9d25c3ed6868587b197.tar.gz
u-boot-imx-881a87ecbab328656eb3e9d25c3ed6868587b197.tar.bz2
Add GIT version information (commid ID) to untagged U-Boot versions
As done in the linux kernel, the U-Boot version (U_BOOT_VERSION) of all unreleased (untagged) U-Boot images will be automatically extended upon compiletime with a part of the GIT commit ID and possibly with "dirty" if uncommited changes are detected. Here an example for the resulting version: "U-Boot 1.1.4-g3457ac18-dirty" The version is now maintained in the toplevel Makefile and the version headers are autogenerated. Patch by Stefan Roese, 9 Feb 2006
Diffstat (limited to 'tools/setlocalversion')
-rwxr-xr-xtools/setlocalversion22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/setlocalversion b/tools/setlocalversion
new file mode 100755
index 0000000..9a23825
--- /dev/null
+++ b/tools/setlocalversion
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Print additional version information for non-release trees.
+
+usage() {
+ echo "Usage: $0 [srctree]" >&2
+ exit 1
+}
+
+cd "${1:-.}" || usage
+
+# Check for git and a git repo.
+if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+ # Do we have an untagged version?
+ if [ "`git name-rev --tags HEAD`" = "HEAD undefined" ]; then
+ printf '%s%s' -g `echo "$head" | cut -c1-8`
+ fi
+
+ # Are there uncommitted changes?
+ if git diff-files | read dummy; then
+ printf '%s' -dirty
+ fi
+fi