check and use local buck config when doing a release

Change-Id: I39d3e381d8f4c291878ab5187dcad9318f199599
diff --git a/tools/build/onos-prepare-release b/tools/build/onos-prepare-release
index ccf9152..9c4ce71 100755
--- a/tools/build/onos-prepare-release
+++ b/tools/build/onos-prepare-release
@@ -29,6 +29,10 @@
 git tag -l | grep -q "$ONOS_VERSION\$" &&
   { echo "ERROR: Version already exists"; exit -1; }
 
+
+cp $ONOS_ROOT/.buckconfig.local $DIR/
+
+
 export ONOS_ROOT=$DIR
 . $ONOS_ROOT/tools/build/envDefaults
 exec bash -i
diff --git a/tools/build/onos-release-prerequisites b/tools/build/onos-release-prerequisites
index 38e69e8..9268e50 100755
--- a/tools/build/onos-release-prerequisites
+++ b/tools/build/onos-release-prerequisites
@@ -121,6 +121,33 @@
     echo "OK"
 }
 
+# .buckconfig.local must exist and the sonatype credentials must be set up
+function testBuckconfigLocal() {
+    printf "Checking local buck config..."
+    if [ ! -f $ONOS_ROOT/.buckconfig.local ]; then
+        echo ".buckconfig.local not found"
+        return 1
+    fi
+
+    trap "echo [publish] must be specified" ERR
+    grep -q "^\[publish\]" $ONOS_ROOT/.buckconfig.local
+
+    trap "echo maven_url must be specified" ERR
+    grep -q "maven_url" $ONOS_ROOT/.buckconfig.local
+
+    trap "echo maven_user must be specified" ERR
+    grep -q "maven_user" $ONOS_ROOT/.buckconfig.local
+
+    trap "echo maven_password must be specified" ERR
+    grep -q "maven_password" $ONOS_ROOT/.buckconfig.local
+
+    trap "echo pgp_keyring must be specified" ERR
+    grep -q "pgp_keyring" $ONOS_ROOT/.buckconfig.local
+
+    echo "OK"
+}
+
+testBuckconfigLocal
 testToolchain
 testSnapshotDependencies
 testGerritAccess