From c4ca70b7d2afad8e4c331f1bbcbf0c65b0134d6e Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 9 Sep 2016 11:44:22 -0400 Subject: [PATCH] Provide way to request git describe behavior --- buildcore.sh | 14 +++++++++++--- makerpm | 15 ++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/buildcore.sh b/buildcore.sh index a2422ce7f..e6206f49f 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -172,9 +172,17 @@ else fi function setversionvars { - VER=`cat Version` - SHORTVER=`cat Version|cut -d. -f 1,2` - SHORTSHORTVER=`cat Version|cut -d. -f 1` + if [ ! -z "$USEGITVER" ]; then + VER=`git describe` + VER=${GITVER/-/.post} + VER=${VER/-/.} + else + VER=`cat Version` + fi + XCATVER=$VER + export XCATVER + SHORTVER=`echo $VER|cut -d. -f 1,2` + SHORTSHORTVER=`echo $VER|cut -d. -f 1` BUILD_TIME=`date` BUILD_MACHINE=`hostname` COMMIT_ID=`git rev-parse --short HEAD` diff --git a/makerpm b/makerpm index 983b3ecc5..31c8f35b2 100755 --- a/makerpm +++ b/makerpm @@ -55,7 +55,7 @@ function makenoarch { tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm - rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz + rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz --define "version $VER" $RELEASE RC=$? if [ $RPMNAME = "xCAT-UI" ]; then @@ -137,7 +137,7 @@ function makexcat { rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET + rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" $RELEASE RC=$? fi } @@ -170,7 +170,7 @@ function makegenesis { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec --define "version $VER" $RELEASE } function makegenesisscripts { @@ -190,7 +190,7 @@ function makegenesisscripts { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$ARCH-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET --define "version $VER" $RELEASE } @@ -213,7 +213,12 @@ if [ -z "$1" ]; then fi OSNAME=$(uname) -VER=`cat Version` +if [ -z "$XCATVER"] ; then + VER=`cat Version` + RELEASE="--define 'release 1'" +else + VER=$XCATVER +fi if [ "$VERBOSE" = "1" -o "$VERBOSE" = "yes" ];then QUIET="" else