[151031] contrib/mp-buildbot/mpbb-list-subports

cal at macports.org cal at macports.org
Fri Aug 5 13:07:16 PDT 2016


Revision: 151031
          https://trac.macports.org/changeset/151031
Author:   cal at macports.org
Date:     2016-08-05 13:07:16 -0700 (Fri, 05 Aug 2016)
Log Message:
-----------
mp-buildbot: Use port -q info in list-subports

Additionally, throw an error if no valid ports were found.

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

Modified: contrib/mp-buildbot/mpbb-list-subports
===================================================================
--- contrib/mp-buildbot/mpbb-list-subports	2016-08-05 19:55:51 UTC (rev 151030)
+++ contrib/mp-buildbot/mpbb-list-subports	2016-08-05 20:07:16 UTC (rev 151031)
@@ -7,18 +7,12 @@
 
 list-subports-help() {
     echo "Print the name of port --port and its subports."
-	echo "Alternatively, print the name and subports of multiple ports given as positional arguments."
+    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
+    "${option_prefix}/bin/port" -q info --index --line --name "subportof:${portname}" "${portname}" 2>/dev/null || return $?
 }
 
 list-subports() {
@@ -27,11 +21,18 @@
         return 1
     fi
 
+    success=0
+
     if [ -n "${option_port}" ]; then
-        print-subports "${option_port}"
+        print-subports "${option_port}" && success=1
     fi
 
     for p in "$@"; do
-        print-subports "$p"
+        print-subports "$p" && success=1
     done
+
+    if [ $success -eq 0 ]; then
+        errmsg "None of the specified ports were found in the port index."
+        return 1
+    fi
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160805/6cdbe5f2/attachment.html>


More information about the macports-changes mailing list