<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository mpbb.
</pre>
<p><a href="https://github.com/macports/mpbb/commit/426f9e7b172a5339cd0147e2b990673ecfd2c640">https://github.com/macports/mpbb/commit/426f9e7b172a5339cd0147e2b990673ecfd2c640</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 426f9e7b172a5339cd0147e2b990673ecfd2c640
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Fri Nov 18 00:33:19 2016 +1100
<span style='display:block; white-space:pre;color:#404040;'> add successcache support to mpbb
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Check if the archive for the requested port exists in its installed
</span><span style='display:block; white-space:pre;color:#404040;'> location, and if so, simply skip installing.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Do the same for each dependency. Dependencies are still built if not
</span><span style='display:block; white-space:pre;color:#404040;'> already installed (even if the requested port is somehow already
</span><span style='display:block; white-space:pre;color:#404040;'> installed), so their archives can be uploaded.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Deactivate all ports between builds when installing dependencies.
</span><span style='display:block; white-space:pre;color:#404040;'> Activate all the dependencies after they are all installed iff the
</span><span style='display:block; white-space:pre;color:#404040;'> requested port will need to be built.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Fixes: https://trac.macports.org/ticket/52765
</span>---
mpbb-install-dependencies | 77 +++++++++++++++++++++++++++++++++--------------
mpbb-install-port | 11 +++++--
tools/archive-path.tcl | 73 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 136 insertions(+), 25 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/mpbb-install-dependencies b/mpbb-install-dependencies
</span><span style='display:block; white-space:pre;color:#808080;'>index 528ef01..d611ba8 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/mpbb-install-dependencies
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mpbb-install-dependencies
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -105,34 +105,65 @@ install-dependencies() {
</span> text="Installing dependency ($dependencies_counter of $dependencies_count) '${depname}' with variants '${depvariants}'"
echo "----> ${text}"
echo -n "${text} ... " >> "$log_status_dependencies"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # $depvariants isn't quoted on purpose
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # shellcheck disable=SC2086
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if ! "${option_prefix}/bin/port" -d install --unrequested "$depname" $depvariants; then
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- echo "Build of dependency '${depname}' with variants '${depvariants}' failed, aborting." >&2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- echo "[FAIL]" >> "$log_status_dependencies"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- echo "Building '$port' ... [ERROR] (failed to install dependency '${depname}') maintainers: $(get-maintainers "$port" "${depname}")." >> "$log_subports_progress"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Update failcache
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # $depvariants isn't quoted on purpose
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # shellcheck disable=SC2086
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- failcache_failure "$depname" $depvariants
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if [ $? -ne 0 ]; then
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- err "failcache_failure $depname $depvariants failed."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- fi
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # $option_prefix and $thisdir are set in mpbb
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # shellcheck disable=SC2154
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [[ -f $("${option_prefix}/bin/port-tclsh" "${thisdir}/tools/archive-path.tcl" "${depname}" "${depvariants}") ]]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "Already installed, nothing to do"
</span> echo "[OK]" >> "$log_status_dependencies"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Remove failcache if it exists
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dependencies_counter=$((dependencies_counter + 1))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span> # $depvariants isn't quoted on purpose
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # shellcheck disable=SC2086
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- failcache_success "$depname" $depvariants
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if [ $? -ne 0 ]; then
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- err "failcache_success $depname $depvariants failed."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # shellcheck disable=SC2154,SC2086
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if ! "${option_prefix}/bin/port" -d install --unrequested "$depname" $depvariants; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "Build of dependency '${depname}' with variants '${depvariants}' failed, aborting." >&2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "[FAIL]" >> "$log_status_dependencies"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "Building '$port' ... [ERROR] (failed to install dependency '${depname}') maintainers: $(get-maintainers "$port" "${depname}")." >> "$log_subports_progress"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Update failcache
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # $depvariants isn't quoted on purpose
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # shellcheck disable=SC2086
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ failcache_failure "$depname" $depvariants
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -ne 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ err "failcache_failure $depname $depvariants failed."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span> return 1
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "[OK]" >> "$log_status_dependencies"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Remove failcache if it exists
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # $depvariants isn't quoted on purpose
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # shellcheck disable=SC2086
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ failcache_success "$depname" $depvariants
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [ $? -ne 0 ]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ err "failcache_success $depname $depvariants failed."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dependencies_counter=$((dependencies_counter + 1))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # deactivate everything between builds
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # $option_prefix is set by mpbb
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # shellcheck disable=SC2154
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ "${option_prefix}/bin/port" -fp deactivate active
</span> fi
<span style='display:block; white-space:pre;background:#ffe0e0;'>- dependencies_counter=$((dependencies_counter + 1))
</span> fi
done <<<"$dependencies"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # activate everything now that we know it's all built and installed
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # ... but only we're actually going to build the requested port
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # $option_prefix and $thisdir are set in mpbb
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # shellcheck disable=SC2154
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [[ -f $("${option_prefix}/bin/port-tclsh" "${thisdir}/tools/archive-path.tcl" "$@") ]]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "$@ Already installed, not activating dependencies"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "Activating all dependencies..."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # $option_prefix is set by mpbb, and dependencies isn't quoted on purpose
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # shellcheck disable=SC2154,SC2086
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if ! "${option_prefix}/bin/port" -d activate ${dependencies}; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "Activating all dependencies failed, aborting." >&2
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "Done."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span> }
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/mpbb-install-port b/mpbb-install-port
</span><span style='display:block; white-space:pre;color:#808080;'>index 3a1290f..bff1bcc 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/mpbb-install-port
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/mpbb-install-port
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -47,6 +47,15 @@ install-port() {
</span> #> "$log_port_contents"
> "$log_port_stats"
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # $option_prefix and $thisdir are set in mpbb
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # shellcheck disable=SC2154
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if [[ -f $("${option_prefix}/bin/port-tclsh" "${thisdir}/tools/archive-path.tcl" "$@") ]]; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "$@ already installed, nothing to do"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # log: summary for the portwatcher
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ echo "Building '$port' ... [OK]" >> "$log_subports_progress"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> local time_start
local time_stop
time_start=$(date +%s)
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -79,8 +88,6 @@ install-port() {
</span> # log: contents
"${option_prefix}/bin/port" -q contents "$port" > "$log_port_contents"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # TODO: printing statistics (and installing the port + dependencies)
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # only makes sense when the port hasn't been installed previously
</span> # log: statistics
echo "time: $((time_stop - time_start))s" >> "$log_port_stats"
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/tools/archive-path.tcl b/tools/archive-path.tcl
</span>new file mode 100755
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..4b8039d
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/tools/archive-path.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,73 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#!/usr/bin/env port-tclsh
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Prints the archive filename for the given port with the given variants.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Copyright © 2013, 2016 The MacPorts Project.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Redistribution and use in source and binary forms, with or without
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# modification, are permitted provided that the following conditions
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# are met:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# 1. Redistributions of source code must retain the above copyright
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# notice, this list of conditions and the following disclaimer.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# 2. Redistributions in binary form must reproduce the above copyright
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# notice, this list of conditions and the following disclaimer in
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# the documentation and/or other materials provided with the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# distribution.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# 3. Neither the name of the MacPorts project, nor the names of any contributors
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# may be used to endorse or promote products derived from this software
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# without specific prior written permission.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+#
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc split_variants {variants} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set result {}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set l [regexp -all -inline -- {([-+])([[:alpha:]_]+[\w\.]*)} $variants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach { match sign variant } $l {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend result $variant $sign
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return $result
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+package require macports
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {[catch {mportinit "" "" ""} result]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "$errorInfo"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "Failed to initialize ports system: $result"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+set portname [lindex $::argv 0]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {[llength $::argv] > 1} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variations [split_variants [lindex $::argv 1]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+} else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variations ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {[catch {set one_result [mportlookup $portname]}] || [llength $one_result] < 2} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # just print whatever, mpbb will notice the missing port itself
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts "nonexistent"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+array set portinfo [lindex $one_result 1]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+if {[info exists portinfo(porturl)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[catch {set mport [mportopen $portinfo(porturl) [list subport $portinfo(name)] $variations]}]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_warn "failed to open port: $portname"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts "nonexistent"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set workername [ditem_key $mport workername]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts [$workername eval get_portimage_path]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ catch {mportclose $mport}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span></pre><pre style='margin:0'>
</pre>