Author: waldi Date: Mon Aug 21 06:32:24 2006 New Revision: 239 Modified: trunk/scripts/hg2dist.sh Log: scripts/hg2dist.sh: Update versioning schema. Modified: trunk/scripts/hg2dist.sh =============================================================================--- trunk/scripts/hg2dist.sh (original) +++ trunk/scripts/hg2dist.sh Mon Aug 21 06:32:24 2006 @@ -2,36 +2,46 @@ HG=$(which hg) HGDIR=$1 -MAJOR=$2 if [ ! -x $HG ]; then echo "hg must be installed" exit 1 fi -if [ ! -d "$HGDIR" ] && [ ! -d "$HGDIR/.hg" ] || [ -z "$MAJOR" ]; then - echo "Usage: $0 <xen-hg-dir> <major>" +if [ ! -d "$HGDIR" ] && [ ! -d "$HGDIR/.hg" ]; then + echo "Usage: $0 <xen-hg-dir>" exit 1 fi -HASH=$( cd $HGDIR; $HG id | awk ''{ print $1}'') -CHANGESET=$( cd $HGDIR; $HG log -r $HASH | head -n 1 | sed -e ''s/ //g;'' | cut -d: -f2) -RELEASE_LG=$( cd $HGDIR; $HG tags | perl -ne ''BEGIN { $done = 0; } /RELEASE-([0-9.]+) +(\d+):/; if ($1 and $2 <= ''$CHANGESET'' and not $done) { print $2,":",$1,"\n"; $done = 1; }'') -REL_CHG=$( echo $RELEASE_LG | cut -d: -f1 ) -REL_VER=$( echo $RELEASE_LG | cut -d: -f2 ) - -if [ $MAJOR = "unstable" ]; then - VERSION="hg${CHANGESET}" -elif [ $REL_CHG = $CHANGESET ]; then - VERSION="${REL_VER}" +eval $(env -i -- make -f - version <<EOF +include $HGDIR/xen/Makefile + +ifeq (\$(XEN_EXTRAVERSION),-unstable) +MAJOR = unstable else - VERSION="${REL_VER}+hg${CHANGESET}" -fi +MAJOR = \$(XEN_VERSION).\$(XEN_SUBVERSION) +endif + +HASH = \$(shell cd $HGDIR; $HG id | awk ''{ print \$\$1}'') +CHANGESET = \$(shell cd $HGDIR; $HG log -r \$(HASH) | head -n 1 | sed -e ''s/ //g;'' | cut -d: -f2) + +ifneq (\$(MAJOR),unstable) +RELEASE_CHG = \$(shell cd $HGDIR; $HG tags | perl -ne ''BEGIN { \$\$done = 0; } /RELEASE-([-0-9.]+) +(\d+):/; if (\$\$1 and \$\$2 <= ''\$(CHANGESET)'' and not \$\$done) { print "\$\$2\n"; \$\$done = 1; }'') +endif + +ifeq (\$(RELEASE_CHG),\$(CHANGESET)) +VERSION = \$(XEN_FULLVERSION) +else +VERSION = \$(XEN_FULLVERSION)+hg\$(CHANGESET) +endif -DESTDIR="xen-${MAJOR}-${VERSION}" -DESTTAR="xen-${MAJOR}_${VERSION}.orig.tar.gz" +PHONY: version +version: + @echo DESTDIR="xen-\$(MAJOR)-\$(VERSION)" + @echo DESTTAR="xen-\$(MAJOR)_\$(VERSION).orig.tar.gz" +EOF) if [ -d $DESTDIR ]; then echo "Destination directory $DESTDIR already exists"