From a42cb58ded8482b31fce83f8109cd22bf11f5bda Mon Sep 17 00:00:00 2001 From: Ray Milkey Date: Tue, 25 Oct 2016 15:42:00 -0700 Subject: [PATCH] do a cursory check to be sure that the onos tar ball is not corrupt Change-Id: Ia61d03f68a0ec4d8f105ffd88480d48fb527bf1f --- tools/build/envDefaults | 6 ------ tools/test/bin/onos-check-bits | 36 +++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/tools/build/envDefaults b/tools/build/envDefaults index 5874110072..f72d3ae3f6 100644 --- a/tools/build/envDefaults +++ b/tools/build/envDefaults @@ -33,12 +33,6 @@ export ONOS_RPM_VERSION=${ONOS_POM_VERSION//-/.} export ONOS_TAR=$ONOS_STAGE.tar.gz export ONOS_ZIP=$ONOS_STAGE.zip -# If the BUCK-built bits are newer than the Maven-built bits, use the former. -BUCK_TAR=$ONOS_ROOT/buck-out/gen/tools/package/onos-package/onos.tar.gz -if [ -f $BUCK_TAR -a $BUCK_TAR -nt $ONOS_TAR ]; then - rm -f $ONOS_TAR >/dev/null; ln -s $BUCK_TAR $ONOS_TAR -fi - # ONOS test bits (onos-test.tar.gz) staging environment export ONOS_TEST_BITS=onos-test-${ONOS_VERSION%~*} export ONOS_TEST_STAGE_ROOT=${ONOS_TEST_STAGE_ROOT:-/tmp} diff --git a/tools/test/bin/onos-check-bits b/tools/test/bin/onos-check-bits index 0423c342f9..6b91a48ce8 100755 --- a/tools/test/bin/onos-check-bits +++ b/tools/test/bin/onos-check-bits @@ -6,4 +6,38 @@ [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 . $ONOS_ROOT/tools/build/envDefaults -ls -l $ONOS_TAR && cksum $ONOS_TAR +# If the BUCK-built bits are newer than the Maven-built bits, use the former. +BUCK_TAR=$ONOS_ROOT/buck-out/gen/tools/package/onos-package/onos.tar.gz +if [ -f $BUCK_TAR -a $BUCK_TAR -nt $ONOS_TAR ]; then + rm -f $ONOS_TAR >/dev/null; ln -s $BUCK_TAR $ONOS_TAR +fi + +ls -l $ONOS_TAR && cksum $ONOS_TAR +if [ $? -ne 0 ]; then + echo "ONOS archive is unreadable" && exit 1 +fi + +tar tzf ${ONOS_TAR} >/dev/null +if [ $? -ne 0 ]; then + echo "ONOS archive is not a valid tar file" && exit 1 +fi + +tar tzf ${ONOS_TAR} | grep -q onos-${ONOS_VERSION}.*/VERSION +if [ $? -ne 0 ]; then + echo "ONOS archive does not contain the proper version file" && exit 1 +fi + +tar tzf ${ONOS_TAR} | grep -q apache-karaf-3.0.5 +if [ $? -ne 0 ]; then + echo "ONOS archive does not contain karaf" && exit 1 +fi + +tar tzf ${ONOS_TAR} | grep -q apps/org.onosproject.openflow +if [ $? -ne 0 ]; then + echo "ONOS archive does not contain openflow app" && exit 1 +fi + +tar tzf ${ONOS_TAR} | grep -q onos-core-net +if [ $? -ne 0 ]; then + echo "ONOS archive does not contain onos-core-net" && exit 1 +fi