diff --git a/Makefile b/Makefile index b2dfce197a..7eb08a7972 100644 --- a/Makefile +++ b/Makefile @@ -113,7 +113,13 @@ DATE := $(shell date +%Y%m%d) # Compute the full local version string so packages can use it as-is # Need to export it, so it can be got from environment in children (eg. mconf) -export BR2_VERSION_FULL := $(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion) + +BR2_LOCALVERSION := $(shell $(TOPDIR)/support/scripts/setlocalversion) +ifeq ($(BR2_LOCALVERSION),) +export BR2_VERSION_FULL := $(BR2_VERSION) +else +export BR2_VERSION_FULL := $(BR2_LOCALVERSION) +endif # List of targets and target patterns for which .config doesn't need to be read in noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \ diff --git a/support/scripts/setlocalversion b/support/scripts/setlocalversion index b39b751f03..e04c955d9e 100755 --- a/support/scripts/setlocalversion +++ b/support/scripts/setlocalversion @@ -19,19 +19,14 @@ cd "${1:-.}" || usage # 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 + atag="`git describe 2>/dev/null`" - # 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 don't have a tag at all we print -g{commitish}. - else - printf '%s%s' -g $head - fi + # Show -g if we have no tag, or just the tag + # otherwise. + if [ -z "${atag}" ] ; then + printf "%s%s" -g ${head} + else + printf ${atag} fi # Is this git on svn? @@ -60,6 +55,8 @@ if hgid=`HGRCPATH= hg id --id --tags 2>/dev/null`; then if [ -z "$tag" -o "$tag" = tip ]; then id=`printf '%s' "$hgid" | sed 's/[+ ].*//'` printf '%s%s' -hg "$id" + else + printf ${tag} fi # Are there uncommitted changes?