summaryrefslogtreecommitdiffstats
path: root/tools/power/cpupower/utils/version-gen.sh
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-31 06:23:40 -1000
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-31 06:23:40 -1000
commit4d8a93c7e542c364b1c2ad1dd406ede85080eab9 (patch)
tree313d1dd3dec890b79b98a9ee420b17f6967db9fc /tools/power/cpupower/utils/version-gen.sh
parentf33c596a2f921696391801b637ed50d514634079 (diff)
parent029e9f73667f9b4661ac9886f706d75d26850260 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/cpupowerutils
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/cpupowerutils: cpupower: Do detect IDA (opportunistic processor performance) via cpuid cpupower: Show Intel turbo ratio support via ./cpupower frequency-info cpupowerutils: increase MAX_LINE_LEN cpupower: Rename package from cpupowerutils to cpupower cpupowerutils: Rename: libcpufreq->libcpupower cpupowerutils: use kernel version-derived version string cpupowerutils: utils - ConfigStyle bugfixes cpupowerutils: helpers - ConfigStyle bugfixes cpupowerutils: idle_monitor - ConfigStyle bugfixes cpupowerutils: lib - ConfigStyle bugfixes cpupowerutils: bench - ConfigStyle bugfixes cpupowerutils: do not update po files on each and every compile cpupowerutils: remove ccdv, use kernel quiet/verbose mechanism cpupowerutils: use COPYING, CREDITS from top-level directory cpupowerutils - cpufrequtils extended with quite some features
Diffstat (limited to 'tools/power/cpupower/utils/version-gen.sh')
-rwxr-xr-xtools/power/cpupower/utils/version-gen.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/power/cpupower/utils/version-gen.sh b/tools/power/cpupower/utils/version-gen.sh
new file mode 100755
index 00000000000..5ec41c55699
--- /dev/null
+++ b/tools/power/cpupower/utils/version-gen.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Script which prints out the version to use for building cpupowerutils.
+# Must be called from tools/power/cpupower/
+#
+# Heavily based on tools/perf/util/PERF-VERSION-GEN .
+
+LF='
+'
+
+# First check if there is a .git to get the version from git describe
+# otherwise try to get the version from the kernel makefile
+if test -d ../../../.git -o -f ../../../.git &&
+ VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
+ case "$VN" in
+ *$LF*) (exit 1) ;;
+ v[0-9]*)
+ git update-index -q --refresh
+ test -z "$(git diff-index --name-only HEAD --)" ||
+ VN="$VN-dirty" ;;
+ esac
+then
+ VN=$(echo "$VN" | sed -e 's/-/./g');
+else
+ eval $(grep '^VERSION[[:space:]]*=' ../../../Makefile|tr -d ' ')
+ eval $(grep '^PATCHLEVEL[[:space:]]*=' ../../../Makefile|tr -d ' ')
+ eval $(grep '^SUBLEVEL[[:space:]]*=' ../../../Makefile|tr -d ' ')
+ eval $(grep '^EXTRAVERSION[[:space:]]*=' ../../../Makefile|tr -d ' ')
+
+ VN="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}"
+fi
+
+VN=$(expr "$VN" : v*'\(.*\)')
+
+echo $VN