Buildbot now fails to build wine dependencies

Joshua Root jmr at macports.org
Wed Jul 5 13:57:25 UTC 2017


On 2017-7-5 11:27 , Joshua Root wrote:
> I did notice one bug with my initial patch; dependencies.tcl needs to 
> print "" instead of nothing when there are no active variants. Not hard 
> to fix.

Here's the fixed version.

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


More information about the macports-dev mailing list