<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/234171d82175c5689ba93135a46c7281e9c4b88d">https://github.com/macports/macports-base/commit/234171d82175c5689ba93135a46c7281e9c4b88d</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 234171d82 restore::resolve_dependencies: add arch checking
</span>234171d82 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 234171d82175c5689ba93135a46c7281e9c4b88d
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Mon Jun 10 23:54:56 2024 +1000
<span style='display:block; white-space:pre;color:#404040;'> restore::resolve_dependencies: add arch checking
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Add +universal when needed by dependents, since some ports may not
</span><span style='display:block; white-space:pre;color:#404040;'> support the current system's native/preferred arch.
</span>---
src/macports1.0/restore.tcl | 101 +++++++++++++++++++++++++++++++++-----------
1 file changed, 76 insertions(+), 25 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/restore.tcl b/src/macports1.0/restore.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 25dd26159..468ddfcc0 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/restore.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/restore.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -377,11 +377,11 @@ namespace eval restore {
</span> # Populate $ports so that we can look up requested variants given the
# port name.
foreach port $portlist {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- lassign $port name requested active _ variants
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lassign $port name requested active _ requested_variants
</span>
# bool-ify active
set active [expr {$active eq "installed"}]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- dict set ports $name [list $requested $active $variants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set ports $name [list $requested $active $requested_variants]
</span>
if {$requested} {
incr requested_total
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -394,7 +394,7 @@ namespace eval restore {
</span> # Use a worklist so that we can push items to the front to do
# depth-first dependency resolution.
set worklist [list]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set seen [dict create]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set required_archs [dict create]
</span> set snapshot_id [$snapshot id]
foreach port $portlist {
lassign $port name requested _ _ _
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -409,10 +409,10 @@ namespace eval restore {
</span> set worklist [lassign $worklist portname]
# If we've already seen this port, continue
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[dict exists $seen $portname]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[dict exists $mports $portname] &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ [macports::_mport_supports_archs [dict get $mports $portname] [dict get $required_archs $portname]]} {
</span> continue
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- dict set seen $portname 1
</span>
ui_debug "Dependency calculation for port $portname"
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -427,30 +427,67 @@ namespace eval restore {
</span> lassign $port portname portinfo
if {[dict exists $ports $portname]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- lassign [dict get $ports $portname] requested _ variants
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lassign [dict get $ports $portname] requested _ requested_variants
</span> } elseif {[dict exists $dep_ports $portname]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set variants [dict get $dep_ports $portname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set requested_variants [dict get $dep_ports $portname]
</span> set requested 0
} else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set variants ""
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set requested_variants ""
</span> set requested 0
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set porturl [dict get $portinfo porturl]
</span>
# Open the port with the requested variants from the snapshot
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![dict exists $mports $portname $variants]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![dict exists $mports $portname]} {
</span> set options [dict create ports_requested $requested subport $portname]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set variations [variants_to_variations_arr $variants]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[catch {set mport [mportopen [dict get $portinfo porturl] $options $variations]} result]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variations [variants_to_variations_arr $requested_variants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[catch {set mport [mportopen $porturl $options $variations]} result]} {
</span> $progress intermission
ui_error "Unable to open port '$portname' with variants '$variants': $result"
continue
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- dict set mports $portname $variants $mport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set mports $portname $mport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![dict exists $required_archs $portname]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set $required_archs $portname [list]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> } else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set mport [dict get $mports $portname $variants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set mport [dict get $mports $portname]
</span> }
set portinfo [mportinfo $mport]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Check archs and re-open with +universal if needed (and possible)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[dict exists $portinfo installs_libs] && ![dict get $portinfo installs_libs]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set $required_archs $portname [list]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![macports::_mport_supports_archs $mport [dict get $required_archs $portname]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ && [dict exists $portinfo variants] && "universal" in [dict get $portinfo variants]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variations [ditem_key $mport variations]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {!([dict exists $variations universal] && [dict get $variations universal] eq "+")} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set variations universal +
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set options [dict create ports_requested $requested subport $portname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![catch {set universal_mport [mportopen $porturl $options $variations]}]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[macports::_mport_supports_archs $universal_mport [dict get $required_archs $portname]]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mportclose $mport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set mport $universal_mport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set mports $portname $mport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set requested_variants [_mportkey $mport requested_variants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[dict exists $ports $portname]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set ports_entry [dict get $ports $portname]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lset ports_entry 2 $requested_variants
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set ports $portname $ports_entry
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } elseif {[dict exists $dep_ports $portname]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set $dep_ports $portname $requested_variants
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mportclose $universal_mport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Requirement can't be satisfied, so don't bother checking again
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # (an error will occur regardless when we actually try to install)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set $required_archs $portname [list]
</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;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # Compute the dependencies for the 'install' target. Do not recurse into the dependencies: we'll do that
# here manually in order to
# (1) keep our dependency graph updated
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -460,6 +497,8 @@ namespace eval restore {
</span> # conflicts with curl-ca-bundle).
set workername [ditem_key $mport workername]
set deptypes [macports::_deptypes_for_target install $workername]
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set port_archs [$workername eval [list get_canonical_archs]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set depends_skip_archcheck [_mportkey $mport depends_skip_archcheck]
</span>
set provides [ditem_key $mport provides]
if {![$dependencies node exists $provides]} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -469,6 +508,7 @@ namespace eval restore {
</span> if {![dict exists $portinfo $deptype]} {
continue
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ set check_archs [expr {$port_archs ne "noarch" && [macports::_deptype_needs_archcheck $deptype]}]
</span> foreach depspec [dict get $portinfo $deptype] {
set dependency [resolve_depspec $depspec $ports $snapshot_id]
if {$dependency eq ""} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -480,6 +520,19 @@ namespace eval restore {
</span> continue
}
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$check_archs && [lsearch -exact -nocase $depends_skip_archcheck $dependency] == -1} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![dict exists $required_archs $dependency]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set required_archs $dependency $port_archs
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set dep_required_archs [dict get $required_archs $dependency]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach arch $port_archs {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$arch ni $dep_required_archs} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lappend dep_required_archs $arch
</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;'>+ dict set required_archs $dependency $dep_required_archs
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> if {![$dependencies node exists $dependency]} {
$dependencies node insert $dependency
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -561,10 +614,10 @@ namespace eval restore {
</span> set length [llength $sorted_snapshot_portlist]
foreach port $sorted_snapshot_portlist {
incr index
<span style='display:block; white-space:pre;background:#ffe0e0;'>- lassign $port name requested active variants
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ lassign $port name requested active requested_variants
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$variants ne ""} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "$restore::ui_prefix Restoring port $index of $length: $name $variants"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {$requested_variants ne ""} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "$restore::ui_prefix Restoring port $index of $length: $name $requested_variants"
</span> } else {
ui_msg "$restore::ui_prefix Restoring port $index of $length: $name"
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -603,19 +656,19 @@ namespace eval restore {
</span> continue
}
lassign $res portname portinfo
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![dict exists $mports $portname $variants]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![dict exists $mports $portname]} {
</span> set porturl [dict get $portinfo porturl]
set options [dict create ports_requested $requested subport $portname]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set variations [variants_to_variations_arr $variants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set variations [variants_to_variations_arr $requested_variants]
</span>
if {[catch {set mport [mportopen $porturl $options $variations]} result]} {
ui_debug $::errorInfo
_handle_failure failed $dependencies $name "unable to open port $name: $result"
continue
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- dict set mports $portname $variants $mport
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict set mports $portname $mport
</span> } else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set mport [dict get $mports $portname $variants]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set mport [dict get $mports $portname]
</span> }
foreach target [list clean $install_target] {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -627,14 +680,12 @@ namespace eval restore {
</span> }
}
mportclose $mport
<span style='display:block; white-space:pre;background:#ffe0e0;'>- dict unset mports $portname $variants
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dict unset mports $portname
</span> }
$dependencies destroy
<span style='display:block; white-space:pre;background:#ffe0e0;'>- dict for {pname sub} $mports {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- dict for {variants mport} $sub {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- mportclose $mport
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach mport [dict values $mports] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mportclose $mport
</span> }
return $failed
</pre><pre style='margin:0'>
</pre>