Added compatibility for ppc64le and not having required repo

Script will now check for the existence of the openpower repo and
download it if it is not present in the workspace. Script will verify 
the type of system the script is running on to modify the dockerfiles
so that they can run on ppc64le systems. Updated the dockerfiles to use
latest as their tags. Updated a few comments as well.

Change-Id: Ied3cdba8c28d7ff9a1b24be69bb6d8df11772be2
Signed-off-by: Alanny Lopez <alanny.lopez@ibm.com>
diff --git a/openpower-build-setup.sh b/openpower-build-setup.sh
index 14b7a5c..bc43919 100755
--- a/openpower-build-setup.sh
+++ b/openpower-build-setup.sh
@@ -4,8 +4,8 @@
 #
 # It expects a few variables which are part of Jenkins build job matrix:
 #   target = palmetto|qemu|habanero|firestone|garrison
-#   distro = ubuntu
-#   WORKSPACE =
+#   distro = ubuntu|fedora
+#   WORKSPACE = Random Number by Default
 
 # Trace bash processing
 set -x
@@ -14,23 +14,45 @@
 target=${target:-palmetto}
 distro=${distro:-ubuntu}
 WORKSPACE=${WORKSPACE:-${HOME}/${RANDOM}${RANDOM}}
-http_proxy=${http_proxy:-}
 
 # Timestamp for job
 echo "Build started, $(date)"
 
+# if there is no open-power directory clone in master into workspace
+if [ ! -e ${WORKSPACE}/op-build ]; then
+        echo "Clone in openpower master to ${WORKSPACE}/op-build"
+        git clone --recursive https://github.com/open-power/op-build ${WORKSPACE}/op-build
+fi
+
+# Determine the architecture
+ARCH=$(uname -m)
+
+# Determine the prefix of the Dockerfile's base image
+case ${ARCH} in
+    "ppc64le")
+        DOCKER_BASE="ppc64le/"
+        ;;
+    "x86_64")
+        DOCKER_BASE=""
+        ;;
+    *)
+        echo "Unsupported system architecture(${ARCH}) found for docker image"
+        exit 1
+esac
+
+
 # Configure docker build
 if [[ "${distro}" == fedora ]];then
 
   Dockerfile=$(cat << EOF
-FROM fedora:latest
+FROM ${DOCKER_BASE}fedora:latest
 
 RUN dnf --refresh repolist && dnf install -y \
 	bc \
 	bison \
 	bzip2 \
 	cpio \
-  	cscope \
+	cscope \
 	ctags \
 	expat-devel \
 	findutils \
@@ -71,7 +93,7 @@
 elif [[ "${distro}" == ubuntu ]]; then
 
   Dockerfile=$(cat << EOF
-FROM ubuntu:15.10
+FROM ${DOCKER_BASE}ubuntu:latest
 
 ENV DEBIAN_FRONTEND noninteractive
 RUN apt-get update && apt-get install -yy \
@@ -79,7 +101,7 @@
 	bison \
 	build-essential \
 	cscope \
-       	cpio \
+	cpio \
 	ctags \
 	flex \
 	g++ \