summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJon Loeliger <jdl@freescale.com>2007-07-07 13:52:25 -0500
committerJon Loeliger <jdl@freescale.com>2007-07-07 13:52:25 -0500
commita657ce8fb7da5bca364f717fb981059639dbd0d1 (patch)
tree9040c0aa0daaeacb1f4387c43c5753778dc93255 /scripts
parent74e6d2128439c53ad9d4a9c1613c82ee92491e84 (diff)
downloaddtc-a657ce8fb7da5bca364f717fb981059639dbd0d1.tar.gz
Add DTC release version information.
Adopted the version information and implementation from of the Linux Kernel Makefiles. Signed-off-by: Jon Loeliger <jdl@jdl.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/setlocalversion22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
new file mode 100755
index 0000000..82e4993
--- /dev/null
+++ b/scripts/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 | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
+ printf '%s%s' -g `echo "$head" | cut -c1-8`
+ fi
+
+ # Are there uncommitted changes?
+ if git diff-index HEAD | read dummy; then
+ printf '%s' -dirty
+ fi
+fi