Merge "Fix performance option handling"
[apex.git] / ci / build.sh
index 2fd8c26..e687055 100755 (executable)
@@ -35,6 +35,7 @@ CACHE_DEST=""
 CACHE_DIR="cache"
 CACHE_NAME="apex-cache"
 MAKE_TARGETS="images"
+REQUIRED_PKGS="rpm-build python-docutils"
 
 parse_cmdline() {
   while [ "${1:0:1}" = "-" ]
@@ -82,6 +83,16 @@ run_make() {
 
 parse_cmdline "$@"
 
+# Install build dependencies
+for pkg in $REQUIRED_PKGS; do
+  if ! rpm -q $pkg > /dev/null; then
+    if ! sudo yum -y install $pkg > /dev/null; then
+      echo "Required package $pkg missing and installation failed."
+      exit 1
+    fi
+  fi
+done
+
 if [ -n "$RELEASE" ]; then MAKE_ARGS+="RELEASE=$RELEASE "; fi
 
 # Get the Old Cache
@@ -96,7 +107,7 @@ if [ -n "$CACHE_DEST" ]; then
     fi
 fi
 
-#create build_output for legecy functionality compatibiltiy in jenkins
+#create build_output for legacy functionality compatibility in jenkins
 if [[ ! -d ../build_output  ]]; then
     rm -f ../build_output
     ln -s build/noarch/ ../build_output
@@ -128,6 +139,15 @@ if [[ "$MAKE_TARGETS" == "images" ]]; then
     fi
 fi
 
+# Make sure python is installed
+if ! rpm -q python34-devel > /dev/null; then
+    sudo yum install -y epel-release
+    if ! sudo yum install -y python34-devel; then
+        echo "Failed to install python34-devel package..."
+        exit 1
+    fi
+fi
+
 # Execute make against targets
 for t in $MAKE_TARGETS; do
     run_make $t