meta-openembedded and poky: subtree updates

Squash of the following due to dependencies among them
and OpenBMC changes:

meta-openembedded: subtree update:d0748372d2..9201611135
meta-openembedded: subtree update:9201611135..17fd382f34
poky: subtree update:9052e5b32a..2e11d97b6c
poky: subtree update:2e11d97b6c..a8544811d7

The change log was too large for the jenkins plugin
to handle therefore it has been removed. Here is
the first and last commit of each subtree:

meta-openembedded:d0748372d2
      cppzmq: bump to version 4.6.0
meta-openembedded:17fd382f34
      mpv: Remove X11 dependency
poky:9052e5b32a
      package_ipk: Remove pointless comment to trigger rebuild
poky:a8544811d7
      pbzip2: Fix license warning

Change-Id: If0fc6c37629642ee207a4ca2f7aa501a2c673cd6
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/poky/scripts/contrib/bb-perf/buildstats-plot.sh b/poky/scripts/contrib/bb-perf/buildstats-plot.sh
index 898834e..45c27d0 100755
--- a/poky/scripts/contrib/bb-perf/buildstats-plot.sh
+++ b/poky/scripts/contrib/bb-perf/buildstats-plot.sh
@@ -39,7 +39,10 @@
 
 BS_DIR="tmp/buildstats"
 N=10
+RECIPE=""
+TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack"
 STATS="utime"
+ACCUMULATE=""
 SUM=""
 OUTDATA_FILE="$PWD/buildstats-plot.out"
 
@@ -51,11 +54,15 @@
                 (default: "$BS_DIR")
   -n N          Top N recipes to display. Ignored if -S is present
                 (default: "$N")
+  -r recipe     The recipe mask to be searched
+  -t tasks      The tasks to be computed
+                (default: "$TASKS")
   -s stats      The stats to be matched. If more that one stat, units
                 should be the same because data is plot as histogram.
                 (see buildstats.sh -h for all options) or any other defined
                 (build)stat separated by colons, i.e. stime:utime
                 (default: "$STATS")
+  -a            Accumulate all stats values for found recipes
   -S            Sum values for a particular stat for found recipes
   -o            Output data file.
                 (default: "$OUTDATA_FILE")
@@ -64,32 +71,41 @@
 }
 
 # Parse and validate arguments
-while getopts "b:n:s:o:Sh" OPT; do
-	case $OPT in
-	b)
-		BS_DIR="$OPTARG"
-		;;
-	n)
-		N="$OPTARG"
-		;;
-	s)
-	        STATS="$OPTARG"
-	        ;;
-	S)
-	        SUM="y"
-	        ;;
-	o)
-	        OUTDATA_FILE="$OPTARG"
-	        ;;
-	h)
-		usage
-		exit 0
-		;;
-	*)
-		usage
-		exit 1
-		;;
-	esac
+while getopts "b:n:r:t:s:o:aSh" OPT; do
+    case $OPT in
+    b)
+        BS_DIR="$OPTARG"
+        ;;
+    n)
+        N="$OPTARG"
+        ;;
+    r)
+        RECIPE="-r $OPTARG"
+        ;;
+    t)
+        TASKS="$OPTARG"
+        ;;
+    s)
+        STATS="$OPTARG"
+        ;;
+    a)
+        ACCUMULATE="-a"
+        ;;
+    S)
+        SUM="y"
+        ;;
+    o)
+        OUTDATA_FILE="$OPTARG"
+        ;;
+    h)
+        usage
+        exit 0
+        ;;
+    *)
+        usage
+        exit 1
+        ;;
+    esac
 done
 
 # Get number of stats
@@ -101,10 +117,10 @@
 
 # Parse buildstats recipes to produce a single table
 OUTBUILDSTATS="$PWD/buildstats.log"
-$CD/buildstats.sh -H -s "$STATS" -H > $OUTBUILDSTATS
+$CD/buildstats.sh -b "$BS_DIR" -s "$STATS" -t "$TASKS" $RECIPE $ACCUMULATE -H > $OUTBUILDSTATS
 
 # Get headers
-HEADERS=$(cat $OUTBUILDSTATS | sed -n -e '1s/ /-/g' -e '1s/:/ /gp')
+HEADERS=$(cat $OUTBUILDSTATS | sed -n -e 's/\(.*\)/"\1"/' -e '1s/ /\\\\\\\\ /g' -e 's/_/\\\\\\\\_/g' -e '1s/:/" "/gp')
 
 echo -e "set boxwidth 0.9 relative"
 echo -e "set style data histograms"
@@ -113,7 +129,7 @@
 
 # Get output data
 if [ -z "$SUM" ]; then
-    cat $OUTBUILDSTATS | sed -e '1d' | sort -k3 -n -r | head -$N > $OUTDATA_FILE
+    cat $OUTBUILDSTATS | sed -e '1d' -e 's/_/\\\\_/g' | sort -k3 -n -r | head -$N > $OUTDATA_FILE
     # include task at recipe column
     sed -i -e "1i\
 ${HEADERS}" $OUTDATA_FILE
@@ -125,8 +141,8 @@
     declare -a sumargs
     j=0
     for i in `seq $nstats`; do
-	sumargs[j]=sum; j=$(( $j + 1 ))
-	sumargs[j]=`expr 3 + $i - 1`;  j=$(( $j + 1 ))
+        sumargs[j]=sum; j=$(( $j + 1 ))
+        sumargs[j]=`expr 3 + $i - 1`;  j=$(( $j + 1 ))
     done
 
     # Do the processing with datamash
diff --git a/poky/scripts/contrib/bb-perf/buildstats.sh b/poky/scripts/contrib/bb-perf/buildstats.sh
index e9ec2d4..e45cfc1 100755
--- a/poky/scripts/contrib/bb-perf/buildstats.sh
+++ b/poky/scripts/contrib/bb-perf/buildstats.sh
@@ -36,8 +36,10 @@
 Child rusage ru_nivcsw"
 
 BS_DIR="tmp/buildstats"
+RECIPE=""
 TASKS="compile:configure:fetch:install:patch:populate_lic:populate_sysroot:unpack"
 STATS="$TIME"
+ACCUMULATE=""
 HEADER="" # No header by default
 
 function usage {
@@ -46,6 +48,7 @@
 Usage: $CMD [-b buildstats_dir] [-t do_task]
   -b buildstats The path where the folder resides
                 (default: "$BS_DIR")
+  -r recipe     The recipe to be computed
   -t tasks      The tasks to be computed
                 (default: "$TASKS")
   -s stats      The stats to be matched. Options: TIME, IO, RUSAGE, CHILD_RUSAGE
@@ -56,87 +59,109 @@
                     IO=$IO
                     RUSAGE=$RUSAGE
                     CHILD_RUSAGE=$CHILD_RUSAGE
+  -a            Accumulate all stats values for found recipes
   -h            Display this help message
 EOM
 }
 
 # Parse and validate arguments
-while getopts "b:t:s:Hh" OPT; do
-	case $OPT in
-	b)
-		BS_DIR="$OPTARG"
-		;;
-	t)
-		TASKS="$OPTARG"
-		;;
-	s)
-		STATS="$OPTARG"
-		;;
-	H)
-	        HEADER="y"
-	        ;;
-	h)
-		usage
-		exit 0
-		;;
-	*)
-		usage
-		exit 1
-		;;
-	esac
+while getopts "b:r:t:s:aHh" OPT; do
+    case $OPT in
+    b)
+        BS_DIR="$OPTARG"
+        ;;
+    r)
+        RECIPE="$OPTARG"
+        ;;
+    t)
+        TASKS="$OPTARG"
+        ;;
+    s)
+        STATS="$OPTARG"
+        ;;
+    a)
+        ACCUMULATE="y"
+        ;;
+    H)
+        HEADER="y"
+        ;;
+    h)
+        usage
+        exit 0
+        ;;
+    *)
+        usage
+        exit 1
+        ;;
+    esac
 done
 
 # Ensure the buildstats folder exists
 if [ ! -d "$BS_DIR" ]; then
-	echo "ERROR: $BS_DIR does not exist"
-	usage
-	exit 1
+    echo "ERROR: $BS_DIR does not exist"
+    usage
+    exit 1
 fi
 
 stats=""
 IFS=":"
 for stat in ${STATS}; do
-	case $stat in
-	    TIME)
-		stats="${stats}:${TIME}"
-		;;
-	    IO)
-		stats="${stats}:${IO}"
-		;;
-	    RUSAGE)
-		stats="${stats}:${RUSAGE}"
-		;;
-	    CHILD_RUSAGE)
-		stats="${stats}:${CHILD_RUSAGE}"
-		;;
-	    *)
-		stats="${STATS}"
-	esac
+    case $stat in
+        TIME)
+            stats="${stats}:${TIME}"
+            ;;
+        IO)
+            stats="${stats}:${IO}"
+            ;;
+        RUSAGE)
+            stats="${stats}:${RUSAGE}"
+            ;;
+        CHILD_RUSAGE)
+            stats="${stats}:${CHILD_RUSAGE}"
+            ;;
+        *)
+            stats="${STATS}"
+            ;;
+    esac
 done
 
 # remove possible colon at the beginning
 stats="$(echo "$stats" | sed -e 's/^://1')"
 
 # Provide a header if required by the user
-[ -n "$HEADER" ] && { echo "task:recipe:$stats"; }
+if [ -n "$HEADER" ] ; then
+    if [ -n "$ACCUMULATE" ]; then
+        echo "task:recipe:accumulated(${stats//:/;})"
+    else
+        echo "task:recipe:$stats"
+    fi
+fi
 
 for task in ${TASKS}; do
     task="do_${task}"
-    for file in $(find ${BS_DIR} -type f -name ${task} | awk 'BEGIN{ ORS=""; OFS=":" } { print $0,"" }'); do
+    for file in $(find ${BS_DIR} -type f -path *${RECIPE}*/${task} | awk 'BEGIN{ ORS=""; OFS=":" } { print $0,"" }'); do
         recipe="$(basename $(dirname $file))"
-	times=""
-	for stat in ${stats}; do
-	    [ -z "$stat" ] && { echo "empty stats"; }
-	    time=$(sed -n -e "s/^\($stat\): \\(.*\\)/\\2/p" $file)
-	    # in case the stat is not present, set the value as NA
-	    [ -z "$time" ] && { time="NA"; }
-	    # Append it to times
-	    if [ -z "$times" ]; then
-		times="${time}"
-	    else
-		times="${times} ${time}"
-	    fi
-	done
+        times=""
+        for stat in ${stats}; do
+            [ -z "$stat" ] && { echo "empty stats"; }
+            time=$(sed -n -e "s/^\($stat\): \\(.*\\)/\\2/p" $file)
+            # in case the stat is not present, set the value as NA
+            [ -z "$time" ] && { time="NA"; }
+            # Append it to times
+            if [ -z "$times" ]; then
+                times="${time}"
+            else
+                times="${times} ${time}"
+            fi
+        done
+        if [ -n "$ACCUMULATE" ]; then
+            IFS=' '; valuesarray=(${times}); IFS=':'
+            times=0
+            for value in "${valuesarray[@]}"; do
+                [ "$value" == "NA" ] && { echo "ERROR: stat is not present."; usage; exit 1; }
+                times=$(( $times + $value ))
+            done
+        fi
         echo "${task} ${recipe} ${times}"
     done
 done