<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/f6e46815a5033358212ce383956fd567eb51e53c">https://github.com/macports/mpbb/commit/f6e46815a5033358212ce383956fd567eb51e53c</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'>     new f6e4681  Only request variants explicitly when needed.
</span>f6e4681 is described below

<span style='display:block; white-space:pre;color:#808000;'>commit f6e46815a5033358212ce383956fd567eb51e53c
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Sat Jul 8 19:43:05 2017 +1000

<span style='display:block; white-space:pre;color:#404040;'>    Only request variants explicitly when needed.
</span>---
 mpbb-install-dependencies | 40 ++++++++++++++++++++++++----------------
 tools/dependencies.tcl    | 20 +++++++++++++++-----
 2 files changed, 39 insertions(+), 21 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 1402587..e0bcdd4 100644
</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;'>@@ -71,10 +71,13 @@ install-dependencies() {
</span>     # Check whether any of the dependencies have previously failed
     failcachecounter=0
     while read -r dependency; do
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        # Split portname +variant1+variant2 into portname and variants, where
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # the variants are optional.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        depname=${dependency%% *}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        depvariants=${dependency:${#depname}+1}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        # Split portname +variant1+variant2 into portname and active
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        # variants, where the variants are optional.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set $dependency
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        depname="$1"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        # remove surrounding quotes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        depvariants="${2%\"}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        depvariants="${depvariants#\"}"
</span> 
         # $depvariants isn't quoted on purpose
         # shellcheck disable=SC2086
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -95,25 +98,30 @@ install-dependencies() {
</span>     rm -f "${option_work_dir}/all_ports"
 
     while read -r dependency; do
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        # Split portname +variant1+variant2 into portname and variants, where
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        # the variants are optional.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        depname=${dependency%% *}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        depvariants=${dependency:${#depname}+1}
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-        text="Installing dependency ($dependencies_counter of $dependencies_count) '${depname}' with variants '${depvariants}'"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        # Split portname +variant1+variant2 into portname and active and
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        # requested variants, where the variants are optional.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set $dependency
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        depname=$1
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        # remove surrounding quotes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        depvariants="${2%\"}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        depvariants="${depvariants#\"}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        deprequestedvariants="${3%\"}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        deprequestedvariants="${deprequestedvariants#\"}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        text="Installing dependency ($dependencies_counter of $dependencies_count) '${depname}' with variants '${depvariants}' (requesting '${deprequestedvariants}')"
</span>         echo "----> ${text}"
         echo -n "${text} ... " >> "$log_status_dependencies"
         # $option_prefix and $thisdir are set in mpbb
         # shellcheck disable=SC2154
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        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;'>+        if [[ -f $("${option_prefix}/bin/port-tclsh" "${thisdir}/tools/archive-path.tcl" "${depname}" "${deprequestedvariants}") ]]; then
</span>             echo "Already installed, nothing to do"
             echo "[OK]" >> "$log_status_dependencies"
             dependencies_counter=$((dependencies_counter + 1))
         else
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            # $depvariants isn't quoted on purpose
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            # $deprequestedvariants isn't quoted on purpose
</span>             # shellcheck disable=SC2154,SC2086
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            if ! "${option_prefix}/bin/port" -dn 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:#e0ffe0;'>+            if ! "${option_prefix}/bin/port" -dn install --unrequested "$depname" $deprequestedvariants; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                echo "Build of dependency '${depname}' with variants '${deprequestedvariants}' failed, aborting." >&2
</span>                 echo "[FAIL]" >> "$log_status_dependencies"
                 echo "Building '$port' ... [ERROR] (failed to install dependency '${depname}') maintainers: $(get-maintainers "$port" "${depname}")." >> "$log_subports_progress"
 
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -145,7 +153,7 @@ install-dependencies() {
</span>             fi
         fi
         # add to the list for gather_archives
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        echo "$dependency" >> "${option_work_dir}/all_ports"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        echo "$depname $deprequestedvariants" >> "${option_work_dir}/all_ports"
</span>     done <<<"$dependencies"
 
     # activate everything now that we know it's all built and installed
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -159,7 +167,7 @@ install-dependencies() {
</span>         echo "Activating all dependencies..."
         # $option_prefix is set by mpbb, and dependencies isn't quoted on purpose
         # shellcheck disable=SC2154,SC2086
<span style='display:block; white-space:pre;background:#ffe0e0;'>-        if ! "${option_prefix}/bin/port" -dn install --unrequested ${dependencies}; then
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        if ! "${option_prefix}/bin/port" -dn install --unrequested $(cat "${option_work_dir}/all_ports"); then
</span>             echo "Activating all dependencies failed, aborting." >&2
             return 1
         fi
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/tools/dependencies.tcl b/tools/dependencies.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 12a0aec..fec0792 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/tools/dependencies.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/tools/dependencies.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -102,7 +102,7 @@ proc printdependency {ditem} {
</span>     # Given the active_variants of the current dependency calculation and the
     # default variants, calculate the required string.
     set default_variants {}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    if {[array size variants] > 0 && [info exists depinfo(vinfo)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if {[info exists depinfo(vinfo)]} {
</span>         foreach {vname vattrs} $depinfo(vinfo) {
             foreach {key val} $vattrs {
                 if {$key eq "is_default" && $val eq "+"} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -113,19 +113,29 @@ proc printdependency {ditem} {
</span>         }
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    set variantstring ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    set activevariantstring ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    set requestedvariantstring ""
</span>     array set active_variants $depinfo(active_variants)
 
     set relevant_variants [lsort -unique [concat [array names active_variants] $default_variants]]
     foreach variant $relevant_variants {
         if {[info exists active_variants($variant)]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            append variantstring "$active_variants($variant)$variant"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            append activevariantstring "$active_variants($variant)$variant"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            if {$variant ni $default_variants} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                append requestedvariantstring "$active_variants($variant)$variant"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            }
</span>         } else {
             # the only case where this situation can occur is a default variant that was explicitly disabled
<span style='display:block; white-space:pre;background:#ffe0e0;'>-            append variantstring "-$variant"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+            append requestedvariantstring "-$variant"
</span>         }
     }
 
<span style='display:block; white-space:pre;background:#ffe0e0;'>-    puts [string trim "$depinfo(name) $variantstring"]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if {$activevariantstring eq ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set activevariantstring {""}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    if {$requestedvariantstring eq ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        set requestedvariantstring {""}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    puts [string trim "$depinfo(name) $activevariantstring $requestedvariantstring"]
</span> }
 dlist_eval $dlist {} [list printdependency]
</pre><pre style='margin:0'>

</pre>