Allowing BUCK-built package to take precedence over the Maven-built package if the former is newer.

Change-Id: I5ebec1d0d2997cfaa6e84565f03c1fae838bda7b
diff --git a/tools/build/envDefaults b/tools/build/envDefaults
index 631f205..781a6a8 100644
--- a/tools/build/envDefaults
+++ b/tools/build/envDefaults
@@ -33,6 +33,12 @@
 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 $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}