diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2010-04-16 12:11:51 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2010-04-16 12:11:51 +0200 |
commit | 9d45c0b010ea5f35abacdc00778d5353794ac8c4 (patch) | |
tree | 7ec71af00103eb2f13a763a92aba2c5d478968c7 /scripts | |
parent | f497370593454c9d598eb7564703cb0478619c0a (diff) | |
parent | c88c8f5d169e2493ad1fed72204c65043b5e67c2 (diff) | |
download | ptxdist-9d45c0b010ea5f35abacdc00778d5353794ac8c4.tar.gz ptxdist-9d45c0b010ea5f35abacdc00778d5353794ac8c4.tar.xz |
Merge branch 'next/version-generation' of git://git.pengutronix.de/git/mkl/ptxdist into HEAD
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/kernel/setlocalversion | 64 | ||||
-rw-r--r-- | scripts/ptxdist_version.sh | 28 | ||||
-rw-r--r-- | scripts/ptxdist_version.sh.in | 16 |
3 files changed, 72 insertions, 36 deletions
diff --git a/scripts/kernel/setlocalversion b/scripts/kernel/setlocalversion index 46989b88d..4095bec1d 100755 --- a/scripts/kernel/setlocalversion +++ b/scripts/kernel/setlocalversion @@ -9,29 +9,53 @@ # # -usage() { - echo "Usage: $0 [srctree]" >&2 - exit 1 -} +# +# Use the following line in your configure.ac, so that $(VERSION) will +# automatically be up-to-date each time configure is run (and note that +# since configure.ac no longer includes a version string, Makefile rules +# should not depend on configure.ac for version updates). +# +# AC_INIT([GNU project], +# m4_esyscmd([build-aux/git-version-gen .tarball-version]), +# [bug-project@example]) +# -cd "${1:-.}" || usage +case $# in + 1) ;; + *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;; +esac + +tarball_version_file="$1" +nl=' +' + +# First see if there is a tarball-only version file. +if test -f $tarball_version_file +then + v=`cat $tarball_version_file` || exit 1 + case $v in + *$nl*) v= ;; # reject multi-line output + esac + test -z "$v" \ + && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2 + + echo -n "$v" + exit +fi + +cd "$(dirname "${tarball_version_file}")" # Check for git and a git repo. if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then - # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore it, - # because this version is defined in the top level Makefile. - if [ -z "`git describe --exact-match 2>/dev/null`" ]; then - - # If we are past a tagged commit (like "v2.6.30-rc5-302-g72357d5"), - # we pretty print it. - if atag="`git describe 2>/dev/null`"; then - echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' + # If we are past a tagged commit (like "ptxdist-2010.03.0-130-g3c60777"), + # we pretty print it. + if atag="`git describe 2>/dev/null`"; then + echo "$atag" | awk -F- '{printf("%s-%05d-%s", $(NF-2),$(NF-1),$(NF))}' - # If we don't have a tag at all we print -g{commitish}. - else - printf '%s%s' -g $head - fi + # If we don't have a tag at all we print -g{commitish}. + else + printf '%s%s' -g $head fi # Is this git on svn? @@ -43,7 +67,7 @@ if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then [ -w . ] && git update-index --refresh --unmerged > /dev/null # Check for uncommitted changes - if git diff-index --name-only HEAD | grep -v "^scripts/package" \ + if git diff-index --name-only HEAD \ | read dummy; then printf '%s' -dirty fi @@ -59,7 +83,7 @@ if hgid=`hg id 2>/dev/null`; then # Do we have an untagged version? if [ -z "$tag" -o "$tag" = tip ]; then id=`printf '%s' "$hgid" | sed 's/[+ ].*//'` - printf '%s%s' -hg "$id" + printf '%s%s' hg "$id" fi # Are there uncommitted changes? @@ -75,7 +99,7 @@ fi # Check for svn and a svn repo. if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then rev=`echo $rev | awk '{print $NF}'` - printf -- '-svn%s' "$rev" + printf -- 'svn%s' "$rev" # All done with svn exit diff --git a/scripts/ptxdist_version.sh b/scripts/ptxdist_version.sh new file mode 100644 index 000000000..543f61820 --- /dev/null +++ b/scripts/ptxdist_version.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# +# version definition for ptxdist +# +_ptxd_get_version() +{ + PTXDIST_VERSION_FULL="$("${PTXDIST_TOPDIR:=.}/scripts/kernel/setlocalversion" "${PTXDIST_TOPDIR}/.tarball-version")" + + local orig_IFS="${IFS}" + local IFS="." + set -- ${PTXDIST_VERSION_FULL} + IFS="${orig_IFS}" + + PTXDIST_VERSION_YEAR="${1}" + PTXDIST_VERSION_MONTH="${2}" + PTXDIST_VERSION_BUGFIX="${3%%-*}" + PTXDIST_VERSION_SCM="${3#*-}" + + if [ -n "${PTXDIST_VERSION_SCM}" ]; then + PTXDIST_VERSION_PTXRC="git" + else + PTXDIST_VERSION_PTXRC="${PTXDIST_VERSION_YEAR}.${PTXDIST_VERSION_MONTH}" + fi + +} + +_ptxd_get_version diff --git a/scripts/ptxdist_version.sh.in b/scripts/ptxdist_version.sh.in deleted file mode 100644 index 73442f7d9..000000000 --- a/scripts/ptxdist_version.sh.in +++ /dev/null @@ -1,16 +0,0 @@ -# -*-sh-*- - -# -# Version Definitions for ptxdist -# -PTXDIST_VERSION_YEAR="@PTXDIST_VERSION_YEAR@" -PTXDIST_VERSION_MONTH="@PTXDIST_VERSION_MONTH@" -PTXDIST_VERSION_BUGFIX="@PTXDIST_VERSION_BUGFIX@" - -PTXDIST_VERSION_SCM="$("${PTXDIST_TOPDIR:=.}/scripts/kernel/setlocalversion" "${PTXDIST_TOPDIR}")" -PTXDIST_VERSION_FULL="${PTXDIST_VERSION_YEAR}.${PTXDIST_VERSION_MONTH}.${PTXDIST_VERSION_BUGFIX}${PTXDIST_VERSION_SCM}" - -PTXDIST_VERSION_CFG_SCM="${PTXDIST_VERSION_SCM:+-git}" -PTXDIST_VERSION_CFG_FULL="${PTXDIST_VERSION_YEAR}.${PTXDIST_VERSION_MONTH}.${PTXDIST_VERSION_BUGFIX}${PTXDIST_VERSION_CFG_SCM}" - -PTXDIST_VERSION_PTXRC="${PTXDIST_VERSION_YEAR}.${PTXDIST_VERSION_MONTH}" |