[151029] contrib/mp-buildbot

cal at macports.org cal at macports.org
Fri Aug 5 12:48:56 PDT 2016


Revision: 151029
          https://trac.macports.org/changeset/151029
Author:   cal at macports.org
Date:     2016-08-05 12:48:56 -0700 (Fri, 05 Aug 2016)
Log Message:
-----------
mp-buildbot: Accept multi-inputs for list-subports

For the use case in our buildbot setup, we would prefer calling ./mpbb
list-subports only once with a list of all ports for which we want their
subports, so add this possibility using positional arguments.

Additionally, filter port names that are not found in the portindex to avoid
scheduling useless builds on the port builders.

Modified Paths:
--------------
    contrib/mp-buildbot/mpbb
    contrib/mp-buildbot/mpbb-list-subports

Modified: contrib/mp-buildbot/mpbb
===================================================================
--- contrib/mp-buildbot/mpbb	2016-08-05 19:06:18 UTC (rev 151028)
+++ contrib/mp-buildbot/mpbb	2016-08-05 19:48:56 UTC (rev 151029)
@@ -172,7 +172,7 @@
 fi
 ## Otherwise, run the command and deal with errors
 export PORTSRC="${option_workdir}/macports.conf"
-if ! $command; then
+if ! $command "$@"; then
     errmsg "Failed to run $command"
     exit 1
 fi

Modified: contrib/mp-buildbot/mpbb-list-subports
===================================================================
--- contrib/mp-buildbot/mpbb-list-subports	2016-08-05 19:06:18 UTC (rev 151028)
+++ contrib/mp-buildbot/mpbb-list-subports	2016-08-05 19:48:56 UTC (rev 151029)
@@ -6,16 +6,32 @@
 
 
 list-subports-help() {
-    echo "Print the name of port --port and any subports."
+    echo "Print the name of port --port and its subports."
+	echo "Alternatively, print the name and subports of multiple ports given as positional arguments."
 }
 
+print-subports() {
+    local portname=$1
+    # test whether a port with this name exists
+    port file "${portname}" >/dev/null 2>/dev/null || return 0
+
+    echo "${portname}"
+    for subport in $("${option_prefix}/bin/port" echo "subportof:${portname}" 2>/dev/null); do
+        echo "${subport}"
+    done
+}
+
 list-subports() {
-    if [ -z "${option_port}" ]; then
-        errmsg "--port is required"
+    if [ $# -le 0 -a -z "${option_port}" ]; then
+        errmsg "Either --port or a list of positional arguments with port names is required."
         return 1
     fi
 
-    for subport in "${option_port}" $(port echo subportof:"${option_port}" 2>/dev/null); do
-        echo $subport
+    if [ -n "${option_port}" ]; then
+        print-subports "${option_port}"
+    fi
+
+    for p in "$@"; do
+        print-subports "$p"
     done
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160805/0e005a90/attachment.html>


More information about the macports-changes mailing list