From ce112d364166f0d96420c25b317eca4709d689cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lawrence=20Vel=C3=A1zquez?= Date: Tue, 30 Aug 2016 20:50:45 +0000 Subject: [PATCH] mpbb: Deprecate "--port" option Relevant subcommands now accept port names in the positional parameters, as "list-subports" already did. Keep the option functional until the updated Buildbot config goes live. git-svn-id: https://svn.macports.org/repository/macports/contrib/mp-buildbot@152162 d073be05-634f-4543-b044-5fe20cf6d1d6 --- README.md | 16 ++++------------ mpbb | 5 +---- mpbb-install-dependencies | 22 +++++++++++----------- mpbb-install-port | 26 +++++++++++++------------- mpbb-list-subports | 2 +- 5 files changed, 30 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 9f81e20..34744e3 100644 --- a/README.md +++ b/README.md @@ -27,25 +27,19 @@ The defined build steps are: --svn-url https://svn.macports.org/repository/macports/trunk \ --svn-revision 123456 -3. Print to standard output a list of all subports for one port... +3. Print one or more ports' subports to standard output. - mpbb list-subports --prefix /opt/local --port php - - ...or for several. - - mpbb list-subports --prefix /opt/local cmake llvm-3.8 ... + mpbb list-subports --prefix /opt/local php cmake llvm-3.8 [...] 4. For each subport listed in step 3: a. Install dependencies. - mpbb install-dependencies \ - --prefix /opt/local \ - --port php71 + mpbb install-dependencies --prefix /opt/local php71 b. Install the subport itself. - mpbb install-port --prefix /opt/local --port php71 + mpbb install-port --prefix /opt/local php71 c. Gather archives. @@ -87,8 +81,6 @@ Subcommand scripts may use but not modify these global shell parameters: The name of the subcommand. - `$option_archive_site`: The URL of the mirror to check for preexisting archives. -- `$option_port`: - The name of the port to install. - `$option_prefix`: The prefix of the MacPorts installation. - `$option_staging_dir`: diff --git a/mpbb b/mpbb index 3683086..f5ea624 100755 --- a/mpbb +++ b/mpbb @@ -52,10 +52,6 @@ OPTIONS --help Print this usage message. - --port PORT - Name of the port to build in MacPorts. This is required for the steps that - build a port. - --variants VARIANTS An optional string with port variants (empty by default; not fully functional yet). @@ -144,6 +140,7 @@ while [[ $# -gt 0 ]]; do option_help=1 ;; --port) + # Deprecated and will be removed in the near future. option_port=$2 shift ;; diff --git a/mpbb-install-dependencies b/mpbb-install-dependencies index d7a12c0..3dec6db 100644 --- a/mpbb-install-dependencies +++ b/mpbb-install-dependencies @@ -19,6 +19,11 @@ get-maintainers() { } install-dependencies() { + local port=${1-${option_port-}} + if [[ -z $port ]]; then + err "Must specify a port" + return 1 + fi local dependencies local dependencies_count local dependencies_counter @@ -27,11 +32,6 @@ install-dependencies() { local log_status_dependencies="${option_logdir}/dependencies-progress.txt" local log_subports_progress="${option_logdir}/ports-progress.txt" - if [ -z "${option_port:-}" ]; then - err "--port is required" - return 1 - fi - # prepare the log file and make sure to start with an empty one mkdir -p "${option_logdir}" > "$log_status_dependencies" @@ -39,22 +39,22 @@ install-dependencies() { # calculate list of dependencies in-order # $option_prefix and $thisdir are set in mpbb # shellcheck disable=SC2154 - dependencies=$("${option_prefix}/bin/port-tclsh" "${thisdir}/tools/dependencies.tcl" "${option_port}" "${option_variants}") + dependencies=$("${option_prefix}/bin/port-tclsh" "${thisdir}/tools/dependencies.tcl" "$port" "${option_variants}") if [ $? -ne 0 ]; then - echo "Calculating dependencies for '${option_port}' failed, aborting." >&2 - echo "Building '${option_port}' ... [ERROR] (failed to calculate dependencies) maintainers: $(get-maintainers "${option_port}")." >> "$log_subports_progress" + echo "Calculating dependencies for '$port' failed, aborting." >&2 + echo "Building '$port' ... [ERROR] (failed to calculate dependencies) maintainers: $(get-maintainers "$port")." >> "$log_subports_progress" return 1 fi if [ -z "$dependencies" ]; then - echo "'${option_port}' has no dependencies, continuing." >&2 + echo "'$port' has no dependencies, continuing." >&2 return 0 fi dependencies_count=$(echo "$dependencies" | wc -l | sed 's/ *//g') dependencies_counter=1 - echo "Installing $dependencies_count dependencies of $option_port:" | tee -a "$log_status_dependencies" + echo "Installing $dependencies_count dependencies of $port:" | tee -a "$log_status_dependencies" echo "$dependencies" | sed -E 's/^/ - /' | tee -a "$log_status_dependencies" echo >> "$log_status_dependencies" @@ -72,7 +72,7 @@ install-dependencies() { if ! "${option_prefix}/bin/port" -d install --unrequested "$depname" $depvariants ${option_variants}; then echo "Build of dependency '${depname}' failed, aborting." >&2 echo "[FAIL]" >> "$log_status_dependencies" - echo "Building '${option_port}' ... [ERROR] (failed to install dependency '${depname}') maintainers: $(get-maintainers "${option_port}" "${depname}")." >> "$log_subports_progress" + echo "Building '$port' ... [ERROR] (failed to install dependency '${depname}') maintainers: $(get-maintainers "$port" "${depname}")." >> "$log_subports_progress" return 1 else echo "[OK]" >> "$log_status_dependencies" diff --git a/mpbb-install-port b/mpbb-install-port index 67428cd..f38b0aa 100644 --- a/mpbb-install-port +++ b/mpbb-install-port @@ -19,6 +19,11 @@ get-maintainers() { } install-port() { + local port=${1-${option_port-}} + if [[ -z $port ]]; then + err "Must specify a port" + return 1 + fi # $option_logdir is set in mpbb # shellcheck disable=SC2154 local log_port_contents="${option_logdir}/port-contents.txt" @@ -26,11 +31,6 @@ install-port() { local log_port_main="${option_logdir}/main.log" local log_subports_progress="${option_logdir}/ports-progress.txt" - if [ -z "${option_port:-}" ]; then - err "--port is required" - return 1 - fi - # prepare the log files and make sure to start with empty ones mkdir -p "${option_logdir}" #> "$log_port_contents" @@ -41,19 +41,19 @@ install-port() { time_start=$(date +%s) # $option_prefix is set in mpbb # shellcheck disable=SC2154 - if ! "${option_prefix}/bin/port" -dk install "${option_port}" ${option_variants}; then - echo "Build of '${option_port}' failed." + if ! "${option_prefix}/bin/port" -dk install "$port" ${option_variants}; then + echo "Build of '$port' failed." # log: summary for the portwatcher - echo "Building '${option_port}' ... [ERROR] maintainers: $(get-maintainers "${option_port}")." >> "$log_subports_progress" + echo "Building '$port' ... [ERROR] maintainers: $(get-maintainers "$port")." >> "$log_subports_progress" return 1 fi time_stop=$(date +%s) # log: summary for the portwatcher - echo "Building '${option_port}' ... [OK]" >> "$log_subports_progress" + echo "Building '$port' ... [OK]" >> "$log_subports_progress" # log: contents - "${option_prefix}/bin/port" -q contents "${option_port}" > "$log_port_contents" + "${option_prefix}/bin/port" -q contents "$port" > "$log_port_contents" # TODO: printing statistics (and installing the port + dependencies) # only makes sense when the port hasn't been installed previously @@ -66,7 +66,7 @@ install-port() { local print_arg_workdir="ERROR" local print_arg_destdir="ERROR" # First, compute port_workdir_size and port_destdir_size - port_workdir=$("${option_prefix}/bin/port" work "${option_port}") + port_workdir=$("${option_prefix}/bin/port" work "$port") if [ -n "$port_workdir" ]; then port_workdir_size=$(du -ks "$port_workdir" | sed 's/^ *//' | tr '\t' '\n' | head -n 1) if [ $? -eq 0 ] && [ -n "$port_workdir_size" ]; then @@ -74,7 +74,7 @@ install-port() { fi local port_destdir="$port_workdir/destroot" - # if we arrive here, 'port work $option_port' was successful, so we're + # if we arrive here, 'port work $port' was successful, so we're # at least going to print 'destdir: -' print_arg_destdir="-" if [ -d "$port_destdir" ]; then @@ -91,7 +91,7 @@ install-port() { # log: main.log local port_mainlog - port_mainlog=$("${option_prefix}/bin/port" logfile "${option_port}") + port_mainlog=$("${option_prefix}/bin/port" logfile "$port") if [ $? -eq 0 ] && [ -f "$port_mainlog" ]; then cp -f "$port_mainlog" "$log_port_main" fi diff --git a/mpbb-list-subports b/mpbb-list-subports index d3ae58c..1f72197 100644 --- a/mpbb-list-subports +++ b/mpbb-list-subports @@ -74,7 +74,7 @@ list-subports() { local log_subports_progress="${option_logdir}/ports-progress.txt" if [ $# -le 0 ] && [ -z "${option_port:-}" ]; then - err "Either --port or a list of positional arguments with port names is required." + err "Must specify at least one port" return 1 fi