diff options
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | buildutil/version-util | 75 | ||||
-rw-r--r-- | buildutil/version-util.awk | 48 | ||||
-rw-r--r-- | pages/pageelems.ecpp | 2 |
4 files changed, 111 insertions, 16 deletions
@@ -143,7 +143,7 @@ PAGES: $(MAKE) -C pages CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" .dependencies $(VERSIONSUFFIX): FORCE - ./buildutil/version-util $(VERSIONSUFFIX) + ./buildutil/version-util $(VERSIONSUFFIX) || ./buildutil/version-util -F $(VERSIONSUFFIX) libvdr-$(PLUGIN).so: $(VERSIONSUFFIX) $(SUBDIRS) $(PLUGINOBJS) $(CXX) $(LDFLAGS) -shared -o $@ $(PLUGINOBJS) -Wl,--whole-archive $(WEBLIBS) -Wl,--no-whole-archive $(LIBS) diff --git a/buildutil/version-util b/buildutil/version-util index f35d7f7..fa4b127 100755 --- a/buildutil/version-util +++ b/buildutil/version-util @@ -1,18 +1,32 @@ #!/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. +# 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 currently only for CVS. # ----------------------------------------------------------------------------- -[ $# -lt 1 ] && echo "USAGE: version-util <versionfile>" && exit 1 +[ $# -lt 1 ] && echo "USAGE: version-util [-F] <versionfile>" && exit 1 VERS_FILE=$1 +FORCE_EMPTY=0 + +[ "$VERS_FILE" == "-F" -a $# -lt 2 ] && echo "USAGE: version-util [-F] <versionfile>" && exit 1 + +if [ $# -gt 1 ]; then + VERS_FILE=$2 + FORCE_EMPTY=1 +fi + + +SCRIPT_PATH=`dirname $0` + +# echo "file: ${VERS_FILE}, force = $FORCE_EMPTY" +# exit 0 function createVers () { @@ -27,11 +41,32 @@ cat <<EOF EOF } +function fileVersions() +{ + for file in `find . -wholename '*CVS/Entries' -print` + do + sed -e's/\//|/g' -e's/|/\//' $file \ + | grep --label=$file -H '^/' \ + | sed -e's/\/CVS\/Entries://' -e's/\.\///' + done +} + +function cvsLog() +{ + echo "= == ===marker=== == =" + cvs log -b -N 2> /dev/null +} + +function cvsData() +{ + fileVersions + cvsLog +} + function cvsVers () { - d=`cvs log -r -N 2> /dev/null \ - | grep '^date:' \ - | cut -d ' ' -f 2-4 \ + d=`cvsData \ + | awk -f ${SCRIPT_PATH}/version-util.awk \ | sort -u \ | tail -1 \ | tr -d ' \-:'` @@ -51,6 +86,11 @@ function gitVers () echo "_git_${b}_${h}" } +function emptyVers () +{ + echo "" +} + function checkVers () { s=`$1` @@ -60,8 +100,6 @@ function checkVers () else v=`grep '^#define VERSION_SUFFIX' ${VERS_FILE} \ | awk '{print $3}'` - echo "s: $s" - echo "v: $v" if [ "$v" != "\"$s\"" ]; then echo "$VERS_FILE is being recreated!" createVers $s > ${VERS_FILE} @@ -69,10 +107,19 @@ function checkVers () fi } +if [ $FORCE_EMPTY -eq 1 ]; then + checkVers emptyVers + exit 0 +fi + if [ -d CVS ]; then checkVers cvsVers + exit 0 fi if [ -d .git ]; then checkVers gitVers + exit 0 fi + +checkVers emptyVers diff --git a/buildutil/version-util.awk b/buildutil/version-util.awk new file mode 100644 index 0000000..0ed59c5 --- /dev/null +++ b/buildutil/version-util.awk @@ -0,0 +1,48 @@ +BEGIN { + FS="|"; + init_revisions = 1; + rev_trigger = 0; + date_trigger = 0; +} + +/= == ===marker=== == =/ { + init_revisions = 0; + FS=";"; + next; +} + +init_revisions == 1 { + # print "XXX " $1, $2; + file_revs[$1] = $2; + next; +} + +/^Working file:/ { + rev_trigger = 0; + if (match($0, "^Working file: (.*)$", f) > 0) { + if (f[1] in file_revs) { + revision = "revision " file_revs[f[1]]; + rev_trigger = 1; + } + } + # print "FFF " f[1], revision, rev_trigger; + next; +} + +rev_trigger == 1 && /^revision/ { + if (match($0, revision) > 0) { + # print "FOUND " revision, $0; + rev_trigger = 0; + date_trigger = 1; + } + next; +} + +date_trigger == 1 { + if (match($1, "date: (.*)", d) > 0) { + print d[1]; + } + date_trigger = 0; +} + +{ next; } diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp index a2fef4a..34cfbf8 100644 --- a/pages/pageelems.ecpp +++ b/pages/pageelems.ecpp @@ -335,7 +335,7 @@ int update_status(1); <div class="about_right">Michael Brückner (skiller2k1)</div> <div class="about_head"><div><div><$ tr("Information") $></div></div></div> <div class="about_left"><$ tr("LIVE version") $>:</div> - <div class="about_right"><$ LIVEVERSION $><$ #VERSION_SUFFIX $></div> + <div class="about_right"><$ LIVEVERSION $><$ VERSION_SUFFIX $></div> <div class="about_left"><$ tr("VDR version") $>:</div> <div class="about_right"><$ VDRVERSION $></div> <div class="about_head"><div><div><$ tr("Features") $></div></div></div> |