[152127] contrib/mp-buildbot

larryv at macports.org larryv at macports.org
Mon Aug 29 08:42:57 PDT 2016


Revision: 152127
          https://trac.macports.org/changeset/152127
Author:   larryv at macports.org
Date:     2016-08-29 08:42:57 -0700 (Mon, 29 Aug 2016)
Log Message:
-----------
mpbb: Add flexible "err" and "warn" functions

These leverage the new general "msg" function and print all their
arguments, not just the first.

Modified Paths:
--------------
    contrib/mp-buildbot/mpbb
    contrib/mp-buildbot/mpbb-install-dependencies
    contrib/mp-buildbot/mpbb-install-port
    contrib/mp-buildbot/mpbb-list-subports

Modified: contrib/mp-buildbot/mpbb
===================================================================
--- contrib/mp-buildbot/mpbb	2016-08-29 15:42:54 UTC (rev 152126)
+++ contrib/mp-buildbot/mpbb	2016-08-29 15:42:57 UTC (rev 152127)
@@ -31,9 +31,8 @@
 # Print $0 and arguments to standard error.
 # Unset IFS to ensure "$*" uses spaces as separators.
 msg() (unset IFS; printf >&2 '%s: %s\n' "$0" "$*")
-errmsg() {
-    printf >&2 "Error: %s\n" "$1"
-}
+err() { msg error: "$@"; }
+warn() { msg warning: "$@"; }
 
 usage() {
     cols=$(tput cols) || cols=80
@@ -112,7 +111,7 @@
 
 ## The first argument should be the subcommand
 if [[ $# -lt 1 ]]; then
-    errmsg "No command specified"
+    err "No command specified"
     usage
 fi
 
@@ -120,7 +119,7 @@
 shift
 if [ ! -f "$thisdir/mpbb-$command" ]; then
     if [ "$command" != "--help" ]; then
-        errmsg "Unknown command $command"
+        err "Unknown command $command"
     fi
     usage
 fi
@@ -182,7 +181,7 @@
                     break
                     ;;
                 *)
-                    errmsg "Unknown option: ${key}"
+                    err "Unknown option: ${key}"
                     echo
                     usage
                     ;;
@@ -203,6 +202,6 @@
 ## Otherwise, run the command and deal with errors
 export PORTSRC="${option_workdir}/macports.conf"
 if ! $command "$@"; then
-    errmsg "Failed to run $command"
+    err "Failed to run $command"
     exit 1
 fi

Modified: contrib/mp-buildbot/mpbb-install-dependencies
===================================================================
--- contrib/mp-buildbot/mpbb-install-dependencies	2016-08-29 15:42:54 UTC (rev 152126)
+++ contrib/mp-buildbot/mpbb-install-dependencies	2016-08-29 15:42:57 UTC (rev 152127)
@@ -27,7 +27,7 @@
     local log_subports_progress="${option_logdir}/ports-progress.txt"
 
     if [ -z "${option_port:-}" ]; then
-        errmsg "--port is required"
+        err "--port is required"
         return 1
     fi
 

Modified: contrib/mp-buildbot/mpbb-install-port
===================================================================
--- contrib/mp-buildbot/mpbb-install-port	2016-08-29 15:42:54 UTC (rev 152126)
+++ contrib/mp-buildbot/mpbb-install-port	2016-08-29 15:42:57 UTC (rev 152127)
@@ -26,7 +26,7 @@
     local log_subports_progress="${option_logdir}/ports-progress.txt"
 
     if [ -z "${option_port:-}" ]; then
-        errmsg "--port is required"
+        err "--port is required"
         return 1
     fi
 

Modified: contrib/mp-buildbot/mpbb-list-subports
===================================================================
--- contrib/mp-buildbot/mpbb-list-subports	2016-08-29 15:42:54 UTC (rev 152126)
+++ contrib/mp-buildbot/mpbb-list-subports	2016-08-29 15:42:57 UTC (rev 152127)
@@ -73,7 +73,7 @@
     local log_subports_progress="${option_logdir}/ports-progress.txt"
 
     if [ $# -le 0 ] && [ -z "${option_port:-}" ]; then
-        errmsg "Either --port or a list of positional arguments with port names is required."
+        err "Either --port or a list of positional arguments with port names is required."
         return 1
     fi
 
@@ -92,7 +92,7 @@
     done
 
     if [ $success -eq 0 ]; then
-        errmsg "None of the specified ports were found in the port index."
+        err "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/20160829/07274b13/attachment.html>


More information about the macports-changes mailing list