Separate download of the ONOS buck plugin from the overall buck package
Change-Id: I75b35365aa6e9a80f32552d71dd2b874267157e5
diff --git a/tools/build/onos-buck b/tools/build/onos-buck
index 70c4414..e11f1de 100755
--- a/tools/build/onos-buck
+++ b/tools/build/onos-buck
@@ -10,6 +10,9 @@
# onos-yang-tools buck plugin version
YANG_VER="2.4.1"
+ONOS_PLUGIN_VER="1.0.2"
+MAVEN_BASE="https://repo1.maven.org/maven2"
+MAVEN_ONOSPROJECT="$MAVEN_BASE/org/onosproject"
[ "-U" = "$1" ] && shift && FORCE_UPDATE=True
@@ -36,7 +39,7 @@
else
echo "SHA cannot be verified"
fi
- unzip cache/$BUCK_FILE
+ unzip -qq cache/$BUCK_FILE
# Kill buckd
ps -ef | egrep buckd | grep -v egrep | cut -c7-11 | xargs kill 2>/dev/null || :
rm -rf $ROOT_DIR/buck-out
@@ -47,6 +50,7 @@
YANG_PLUGIN_CACHE="cache/onos-yang-compiler-buck-plugin-$YANG_VER.jar"
if hash mvn 2>/dev/null; then
if [[ $YANG_VER = *"-SNAPSHOT" ]] || [ ! -f "$YANG_PLUGIN_CACHE" ]; then
+ echo "Updating Yang plugin $YANG_VER..." >&2
ARTIFACT="org.onosproject:onos-yang-compiler-buck-plugin:$YANG_VER"
mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:copy \
-Dartifact=$ARTIFACT \
@@ -55,20 +59,21 @@
fi
else
if [ ! -f "$YANG_PLUGIN_CACHE" ]; then
+ echo "Updating Yang plugin $YANG_VER..." >&2
if [[ $YANG_VER = *"-SNAPSHOT" ]]; then
echo "mvn command must be installed to handle SNAPSHOT version"
exit 1
fi
curl -o "$YANG_PLUGIN_CACHE" \
- -L https://repo1.maven.org/maven2/org/onosproject/onos-yang-compiler-buck-plugin/$YANG_VER/onos-yang-compiler-buck-plugin-$YANG_VER.jar
+ -L $MAVEN_ONOSPROJECT/onos-yang-compiler-buck-plugin/$YANG_VER/onos-yang-compiler-buck-plugin-$YANG_VER.jar
fi
if [[ $YANG_VER != *"-SNAPSHOT" ]] && hash shasum 2>/dev/null; then
SHA=$(shasum $YANG_PLUGIN_CACHE | cut -d' ' -f1)
if [ ! -f "$YANG_PLUGIN_CACHE".sha1 ]; then
curl -o "$YANG_PLUGIN_CACHE".sha1 \
- -L https://repo1.maven.org/maven2/org/onosproject/onos-yang-compiler-buck-plugin/$YANG_VER/onos-yang-compiler-buck-plugin-$YANG_VER.jar.sha1
+ -L $MAVEN_ONOSPROJECT/onos-yang-compiler-buck-plugin/$YANG_VER/onos-yang-compiler-buck-plugin-$YANG_VER.jar.sha1
fi
YANG_PLUGIN_SHA=$(cat "$YANG_PLUGIN_CACHE".sha1)
if [ "$SHA" != "$YANG_PLUGIN_SHA" ]; then
@@ -79,7 +84,34 @@
echo "SHA verification skipped"
fi
fi
-install -Cv "$YANG_PLUGIN_CACHE" plugins/yang.jar
+install -Cv "$YANG_PLUGIN_CACHE" plugins/yang.jar >/dev/null
+
+# Fetch & install onos buck plugin
+
+ONOS_PLUGIN_CACHE="cache/onos-buck-plugin-$ONOS_PLUGIN_VER.jar"
+
+if [ ! -f "$ONOS_PLUGIN_CACHE" ]; then
+ echo "Updating ONOS plugin $ONOS_PLUGIN_VER..." >&2
+ curl -o "$ONOS_PLUGIN_CACHE" \
+ -L $MAVEN_ONOSPROJECT/onos-buck-plugin/$ONOS_PLUGIN_VER/onos-buck-plugin-$ONOS_PLUGIN_VER.jar
+fi
+
+
+if hash shasum 2>/dev/null; then
+ SHA=$(shasum $ONOS_PLUGIN_CACHE | cut -d' ' -f1)
+ if [ ! -f "$ONOS_PLUGIN_CACHE".sha1 ]; then
+ curl -o "$ONOS_PLUGIN_CACHE".sha1 \
+ -L $MAVEN_ONOSPROJECT/onos-buck-plugin/$ONOS_PLUGIN_VER/onos-buck-plugin-$ONOS_PLUGIN_VER.jar.sha1
+ fi
+ ONOS_PLUGIN_SHA=$(cat "$ONOS_PLUGIN_CACHE".sha1)
+ if [ "$SHA" != "$ONOS_PLUGIN_SHA" ]; then
+ echo "ERROR: Downloaded SHA ($SHA) did not match expected SHA ($ONOS_PLUGIN_SHA)" &&
+ rm -f $ONOS_PLUGIN_CACHE $ONOS_PLUGIN_CACHE.sha1 && exit 1
+ fi
+else
+ echo "SHA verification skipped"
+fi
+install -Cv "$ONOS_PLUGIN_CACHE" plugins/onos.jar >/dev/null
popd > /dev/null