scripts: make git-update.sh build with all cores available
[platform/upstream/gstreamer.git] / scripts / git-update.sh
index 221e1ae..d02e0f7 100755 (executable)
@@ -16,8 +16,7 @@ MODULES="\
 EXTRA_MODULES="\
     gst-editing-services \
     gst-rtsp-server \
-    gst-python \
-    gnonlin"
+    gst-python"
 
 tmp=${TMPDIR-/tmp}
 tmp=$tmp/git-update.$(date +%Y%m%d-%H%M-).$RANDOM.$RANDOM.$RANDOM.$$
@@ -28,20 +27,21 @@ tmp=$tmp/git-update.$(date +%Y%m%d-%H%M-).$RANDOM.$RANDOM.$RANDOM.$$
 }
 
 ERROR_LOG="$tmp/failures.log"
-touch $ERROR_LOG
 ERROR_RETURN=255
 
+CPUCORES=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu  2>/dev/null || echo "1")
+
 for m in $CORE $MODULES $EXTRA_MODULES; do
   if test -d $m; then
     echo "+ updating $m"
     cd $m
 
-    git pull origin master
+    git pull --rebase
     if test $? -ne 0
     then
       echo "$m: update (trying stash, pull, stash apply)" >> $ERROR_LOG
       git stash
-      git pull origin master
+      git pull --rebase
       if test $? -ne 0
       then 
         echo "$m: update" >> $ERROR_LOG
@@ -93,7 +93,7 @@ build()
     fi
 
     echo "+ $1: make"
-    make > "$tmp/$1-make.log" 2>&1
+    MAKEFLAGS="-j$CPUCORES $MAKEFLAGS" make > "$tmp/$1-make.log" 2>&1
     if test $? -ne 0
     then
       echo "$1: make [$tmp/$1-make.log]" >> $ERROR_LOG
@@ -124,6 +124,7 @@ if test -e $ERROR_LOG;  then
   echo
   cat $ERROR_LOG
 else
+  echo "Update done"
   rm -rf "$tmp"
 fi
 exit