Author: waldi Date: 2006-03-10 22:13:08 +0000 (Fri, 10 Mar 2006) New Revision: 104 Modified: trunk/scripts/hg2dist.sh Log: hg2dist.sh - Support unstable. - Use hg id to find correct changeset. - Get correct release tag for available changeset. Modified: trunk/scripts/hg2dist.sh ==================================================================--- trunk/scripts/hg2dist.sh 2006-03-10 18:13:54 UTC (rev 103) +++ trunk/scripts/hg2dist.sh 2006-03-10 22:13:08 UTC (rev 104) @@ -2,33 +2,36 @@ HG=$(which hg) HGDIR=$1 +MAJOR=$2 if [ ! -x $HG ]; then echo "hg must be installed" exit 1 fi -if [ ! \( -d "$HGDIR" -a -d "$HGDIR/.hg" \) ]; then - echo "Usage: $0 <xen-hg-dir>" +if [ ! -d "$HGDIR" ] && [ ! -d "$HGDIR/.hg" ] || [ -z "$MAJOR" ]; then + echo "Usage: $0 <xen-hg-dir> <major>" exit 1 fi -CHANGESET=$( (cd $HGDIR; $HG log | head -1 ) | sed -e ''s/ //g;'' | cut -d: -f2) +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 log | grep -B 1 "tag:.*RELEASE" | head -2) | sed -e ''s/ //g'') -REL_CHG=$( echo $RELEASE_LG | cut -d: -f2 ) -REL_VER=$( echo $RELEASE_LG | cut -d- -f2 ) -REL_MAJ=$( echo $REL_VER | sed -r -e ''s/([0-9]+\.[0-9]+)\.[0-9]+/\1/'' ) +RELEASE_LG=$( cd $HGDIR; $HG tags | perl -ne ''BEGIN { $done = 0; } /RELEASE-(\S+) +(\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 [ $REL_CHG = $CHANGESET ]; then - DESTDIR="xen-${REL_MAJ}-${REL_VER}" - DESTTAR="xen-${REL_MAJ}_${REL_VER}.orig.tar.gz" +if [ $MAJOR = "unstable" ]; then + VERSION="hg${CHANGESET}" +elif [ $REL_CHG = $CHANGESET ]; then + VERSION="${REL_VER}" else - DESTDIR="xen-${REL_MAJ}-${REL_VER}+hg${CHANGESET}" - DESTTAR="xen-${REL_MAJ}_${REL_VER}+hg${CHANGESET}.orig.tar.gz" + VERSION="${REL_VER}+hg${CHANGESET}" fi +DESTDIR="xen-${MAJOR}-${VERSION}" +DESTTAR="xen-${MAJOR}_${VERSION}.orig.tar.gz" if [ -d $DESTDIR ]; then echo "Destination directory $DESTDIR already exists"