Buildbot now fails to build wine dependencies

Joshua Root jmr at macports.org
Tue Jul 4 21:18:59 UTC 2017


On 2017-7-5 06:00 , Clemens Lang wrote:
> Hi,
> 
> On Tue, Jul 04, 2017 at 04:23:13PM +0200, Rainer Müller wrote:
>> I still don't understand why we pass *default* variants to
>> dependencies at all. As I see it, the problem would go away if we
>> would not request default variants explicitly...
>>
>> @Clemens,
>> as you originally added this to mpbb/tools/dependencies.tcl, do you
>> still remember the reason?
> 
> You were right on it when you mentioned the failcache. However, you only
> considered the reading part of the failcache, not the writing part of
> it.
> 
> We need to know the canonical (i.e., fully-expanded) set of variants for
> every port we build, because even when a port is only installed as a
> dependency, we update the failcache when it fails.
> 
> Failure to do this would possibly cache a build failure of what mpbb
> thinks is 'cairo +quartz' (but actually is 'cairo +quartz+x11') cached
> for 'cairo +quartz-x11' (i.e. canonically 'cairo +quartz').
> 
> 
>> I am attaching a patch to only print active variants that are not
>> enabled by default (or disabled default variants). To me the result
>> looks like what we want to have:
>>
>> $ tools/dependencies.tcl wine | grep -E 'glib2|cairo'
>> glib2 +universal
>> cairo +universal
>> $ tools/dependencies.tcl gtk3 +quartz | grep -E 'glib2|cairo'
>> glib2 +quartz
>> cairo
> 
> No, this won't work, because with this output you can no longer
> distinguish 'cairo (default variants)' from 'cairo -quartz-x11'. This is
> probably not a valid configuration for the cairo port specifically, but
> you get the idea.

So really we need two pieces of information: the 
canonical_active_variants to use with the fail cache, and the variants 
that should be actually be requested.

How about this?

- Josh
-------------- next part --------------
diff --git a/mpbb-install-dependencies b/mpbb-install-dependencies
index 1402587..a3a261a 100644
--- a/mpbb-install-dependencies
+++ b/mpbb-install-dependencies
@@ -71,10 +71,11 @@ 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
+        depvariants=$2
 
         # $depvariants isn't quoted on purpose
         # shellcheck disable=SC2086
@@ -95,25 +96,27 @@ 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
+        depvariants=$2
+        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
             # 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 +148,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 +162,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..b1ebf59 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,23 @@ 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"]
+    puts [string trim "$depinfo(name) $activevariantstring $requestedvariantstring"]
 }
 dlist_eval $dlist {} [list printdependency]


More information about the macports-dev mailing list