Fix To Jenkins Using Wrong Gerrit Commits

Changed the ocache to now be called obmcext, an external directory
outside of the docker container which holds the OpenBMC repo you want to
use. The script will treat the directory as holding the exact files that
will be passed and if not present will use the master branch which
should make it work in the same way as before. To use in the container,
will use cp to create a copy of the files that will be used to do the
OpenBMC build.

Change-Id: I56b1c5487afa895d6f78c6ae71ecfb4c9eaab1b4
Signed-off-by: Alanny Lopez <alanny.lopez@ibm.com>
diff --git a/build-setup.sh b/build-setup.sh
index 41b158e..f79e19b 100755
--- a/build-setup.sh
+++ b/build-setup.sh
@@ -10,8 +10,9 @@
 #                 zaius|romulus|qemu
 #  distro       = fedora|ubuntu
 #  imgtag       = Varies by distro. latest|16.04|14.04|trusty|xenial; 23|24|25
-#  ocache       = Path of the OpenBMC repo cache that is used to speed up git
-#                 clones, default directory location "${WORKSPACE}/openbmc"
+#  obmcext      = Path of the OpenBMC repo directory used in creating a copy
+#                 inside the container that is not mounted to external storage
+#                 default directory location "${WORKSPACE}/openbmc"
 #  obmcdir      = Path of the OpenBMC directory, where the build occurs inside
 #                 the container cannot be placed on external storage default
 #                 directory location "/tmp/openbmc"
@@ -47,7 +48,7 @@
 obmcdir=${obmcdir:-/tmp/openbmc}
 sscdir=${sscdir:-${HOME}}
 WORKSPACE=${WORKSPACE:-${HOME}/${RANDOM}${RANDOM}}
-ocache=${ocache:-${WORKSPACE}/openbmc}
+obmcext=${obmcext:-${WORKSPACE}/openbmc}
 launch=${launch:-}
 http_proxy=${http_proxy:-}
 PROXY=""
@@ -71,10 +72,10 @@
 # Timestamp for job
 echo "Build started, $(date)"
 
-# If the ocache directory doesn't exist clone it in, ocache will be used as a cache for git clones
-if [ ! -d ${ocache} ]; then
-  echo "Clone in openbmc master to ${ocache} to act as cache for future builds"
-  git clone https://github.com/openbmc/openbmc ${ocache}
+# If the obmcext directory doesn't exist clone it in
+if [ ! -d ${obmcext} ]; then
+  echo "Clone in openbmc master to ${obmcext}"
+  git clone https://github.com/openbmc/openbmc ${obmcext}
 fi
 
 # Work out what build target we should be running and set BitBake command
@@ -223,7 +224,7 @@
 set -xeo pipefail
 
 # Use the mounted repo cache to make an internal repo not mounted externally
-git clone --reference ${ocache} --dissociate https://github.com/openbmc/openbmc ${obmcdir}
+cp -R ${obmcext} ${obmcdir}
 
 # Go into the OpenBMC directory (the openbmc script will put us in a build subdir)
 cd ${obmcdir}
@@ -293,11 +294,11 @@
   # Build the Docker image
   docker build -t ${imgname} - <<< "${Dockerfile}"
 
-  # If ocache or sscdir are ${HOME} or a subdirectory they will not be mounted
-  mountocache="-v ""${ocache}"":""${ocache}"" "
+  # If obmcext or sscdir are ${HOME} or a subdirectory they will not be mounted
+  mountobmcext="-v ""${obmcext}"":""${obmcext}"" "
   mountsscdir="-v ""${sscdir}"":""${sscdir}"" "
-  if [[ "${ocache}" = "${HOME}/"* || "${ocache}" = "${HOME}" ]];then
-    mountocache=""
+  if [[ "${obmcext}" = "${HOME}/"* || "${obmcext}" = "${HOME}" ]];then
+    mountobmcext=""
   fi
   if [[ "${sscdir}" = "${HOME}/"* || "${sscdir}" = "${HOME}" ]];then
     mountsscdir=""
@@ -311,7 +312,7 @@
   -e WORKSPACE=${WORKSPACE} \
   -w "${HOME}" \
   -v "${HOME}":"${HOME}" \
-  ${mountocache} \
+  ${mountobmcext} \
   ${mountsscdir} \
   -t ${imgname} \
   ${WORKSPACE}/build.sh
@@ -326,4 +327,4 @@
 fi
 
 # Timestamp for build
-echo "Build completed, $(date)"
+echo "Build completed, $(date)"
\ No newline at end of file