tom

Modified envSetup to differentiate between ONOS_POM_VERSION and ONOS_VERSION, wh…

…ere the latter uses build number or user name & time.
...@@ -9,10 +9,14 @@ export KARAF_ZIP=${KARAF_ZIP:-~/Downloads/apache-karaf-3.0.1.zip} ...@@ -9,10 +9,14 @@ export KARAF_ZIP=${KARAF_ZIP:-~/Downloads/apache-karaf-3.0.1.zip}
9 export KARAF_TAR=${KARAF_TAR:-~/Downloads/apache-karaf-3.0.1.tar.gz} 9 export KARAF_TAR=${KARAF_TAR:-~/Downloads/apache-karaf-3.0.1.tar.gz}
10 export KARAF_DIST=$(basename $KARAF_ZIP .zip) 10 export KARAF_DIST=$(basename $KARAF_ZIP .zip)
11 11
12 +# Fallback build number us derived from from the user name & time
13 +export BUILD_NUMBER=${BUILD_NUMBER:-$(id -un)~$(date +'%Y/%m/%d@%H:%M')}
14 +
12 # ONOS Version and onos.tar.gz staging environment 15 # ONOS Version and onos.tar.gz staging environment
13 -export ONOS_VERSION=${ONOS_VERSION:-1.0.0-SNAPSHOT} 16 +export ONOS_POM_VERSION="1.0.0-SNAPSHOT"
17 +export ONOS_VERSION=${ONOS_VERSION:-1.0.0.$BUILD_NUMBER}
18 +export ONOS_BITS=onos-${ONOS_VERSION%~*}
14 export ONOS_STAGE_ROOT=${ONOS_STAGE_ROOT:-/tmp} 19 export ONOS_STAGE_ROOT=${ONOS_STAGE_ROOT:-/tmp}
15 -export ONOS_BITS=onos-$ONOS_VERSION
16 export ONOS_STAGE=$ONOS_STAGE_ROOT/$ONOS_BITS 20 export ONOS_STAGE=$ONOS_STAGE_ROOT/$ONOS_BITS
17 export ONOS_TAR=$ONOS_STAGE.tar.gz 21 export ONOS_TAR=$ONOS_STAGE.tar.gz
18 22
......
...@@ -49,7 +49,7 @@ export ONOS_FEATURES="${ONOS_FEATURES:-webconsole,onos-api,onos-core,onos-cli,on ...@@ -49,7 +49,7 @@ export ONOS_FEATURES="${ONOS_FEATURES:-webconsole,onos-api,onos-core,onos-cli,on
49 # ONOS Patching ---------------------------------------------------------------- 49 # ONOS Patching ----------------------------------------------------------------
50 50
51 # Patch the Apache Karaf distribution file to add ONOS features repository 51 # Patch the Apache Karaf distribution file to add ONOS features repository
52 -perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-features/$ONOS_VERSION/xml/features|" \ 52 +perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-features/$ONOS_POM_VERSION/xml/features|" \
53 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg 53 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
54 54
55 # Patch the Apache Karaf distribution file to load ONOS features 55 # Patch the Apache Karaf distribution file to load ONOS features
...@@ -57,17 +57,14 @@ perl -pi.old -e "s|^(featuresBoot=.*)|\1,$ONOS_FEATURES|" \ ...@@ -57,17 +57,14 @@ perl -pi.old -e "s|^(featuresBoot=.*)|\1,$ONOS_FEATURES|" \
57 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg 57 $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg
58 58
59 # Patch the Apache Karaf distribution with ONOS branding bundle 59 # Patch the Apache Karaf distribution with ONOS branding bundle
60 -cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \ 60 +cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_POM_VERSION/onos-branding-*.jar \
61 $ONOS_STAGE/$KARAF_DIST/lib 61 $ONOS_STAGE/$KARAF_DIST/lib
62 62
63 -# Patch in the ONOS version file use the build number or the user name for 63 +# Patch in the ONOS version file
64 -# build postfix in place of the SNAPSHOT post-fix. 64 +echo $ONOS_VERSION > $ONOS_STAGE/VERSION
65 -build=${BUILD_NUMBER:-$(id -un)~$(date +'%Y/%m/%d@%H:%M')}
66 -grep '<version>' $ONOS_ROOT/pom.xml | head -n1 | \
67 - sed 's:.*<version>::g;s:</version>.*::g' | sed "s#SNAPSHOT#$build#g" \
68 - >> $ONOS_STAGE/VERSION
69 65
70 # Now package up the ONOS tar file 66 # Now package up the ONOS tar file
71 cd $ONOS_STAGE_ROOT 67 cd $ONOS_STAGE_ROOT
72 COPYFILE_DISABLE=1 tar zcf $ONOS_TAR $ONOS_BITS 68 COPYFILE_DISABLE=1 tar zcf $ONOS_TAR $ONOS_BITS
73 ls -l $ONOS_TAR >&2 69 ls -l $ONOS_TAR >&2
70 +rm -r $ONOS_STAGE
......