diff options
author | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2008-01-16 01:04:07 +0100 |
---|---|---|
committer | Dieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de> | 2008-01-16 01:04:07 +0100 |
commit | 85941f0fd77d61b200aa6bf36498832436fe7a16 (patch) | |
tree | aa4b3fc86b3534939e1aa672aaf448c1bc101907 /buildutil | |
parent | 2419f84715e74676c0de87c95a99223870323f02 (diff) | |
download | vdr-plugin-live-85941f0fd77d61b200aa6bf36498832436fe7a16.tar.gz vdr-plugin-live-85941f0fd77d61b200aa6bf36498832436fe7a16.tar.bz2 |
Added version suffix detection based on CVS log and status and on git
show. Still not perfect because it does not trigger a recompile if no
changes in the sources are present.
Diffstat (limited to 'buildutil')
-rwxr-xr-x | buildutil/version-util | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/buildutil/version-util b/buildutil/version-util new file mode 100755 index 0000000..7e377ab --- /dev/null +++ b/buildutil/version-util @@ -0,0 +1,43 @@ +#!/bin/sh +# ----------------------------------------------------------------------------- +# Small shell script to determine the last commit version of the project +# It checks for CVS and .git repositories. +# The output is a string that can be used in a define at compile time to +# automatically mark repository versions. +# For CVS repositories the string contains the date and time of the commit +# that lead to the current version of files. +# For git repositories the output contains the git-id of the current tree. +# An indication if localy modified files exist is added. +# ----------------------------------------------------------------------------- + +function cvsVers () +{ + d=`cvs log -r -N 2> /dev/null \ + | grep '^date:' \ + | cut -d ' ' -f 2-4 \ + | sort -u \ + | tail -1 \ + | tr -d ' \-:'` + m=`cvs status 2> /dev/null \ + | grep 'Status: Locally Modified' > /dev/null && echo "_MOD"` + echo "_cvs_${d}${m}" +} + +function gitVers () +{ + b=`git branch \ + | grep '^*' \ + | sed -e's/^* //'` + h=`git show --pretty=format:"%h_%ci" HEAD \ + | head -1 \ + | tr -d ' \-:'` + echo "_git_${b}_${h}" +} + +if [ -d CVS ]; then + cvsVers +fi + +if [ -d .git ]; then + gitVers +fi |