<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/45d9cb3914f5edc884dac3834fbcaa09f68149d1">https://github.com/macports/mpbb/commit/45d9cb3914f5edc884dac3834fbcaa09f68149d1</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 45d9cb3914f5edc884dac3834fbcaa09f68149d1
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Wed Oct 25 22:30:26 2023 +1100
<span style='display:block; white-space:pre;color:#404040;'> dependencies.tcl: factor out deactivation code
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Deactivate in dependency order and with ports_nodepcheck set, to reduce
</span><span style='display:block; white-space:pre;color:#404040;'> log noise about deactivating ports with dependents.
</span>---
tools/dependencies.tcl | 38 ++++++++++++++++++++------------------
1 file changed, 20 insertions(+), 18 deletions(-)
<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 8034828..767862d 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;'>@@ -247,6 +247,23 @@ proc open_port {portname} {
</span> return [list $mport [array get portinfo]]
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# Deactivate the given port, first deactivating any active dependents
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# it has.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+proc deactivate_with_dependents {e} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[$e state] ne "installed"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach dependent [$e dependents] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ deactivate_with_dependents $dependent
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![registry::run_target $e deactivate [list ports_nodepcheck 1]]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ && [catch {portimage::deactivate [$e name] [$e version] [$e revision] [$e variants] [list ports_nodepcheck 1]} result]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts stderr $::errorInfo
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts stderr "Deactivating [$e name] @[$e version]_[$e revision][$e variants] failed: $result"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ exit 2
</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> proc deactivate_unneeded {portinfovar} {
upvar $portinfovar portinfo
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -289,12 +306,7 @@ proc deactivate_unneeded {portinfovar} {
</span> # bit, but those are much less common and this ensures
# consistent behaviour.
if {![info exists needed_array([$e name])]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![registry::run_target $e deactivate [list ports_force yes]]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- && [catch {portimage::deactivate [$e name] [$e version] [$e revision] [$e variants] [list ports_force yes]} result]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts stderr $::errorInfo
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts stderr "Deactivating [$e name] @[$e version]_[$e revision][$e variants] failed: $result"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- exit 2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ deactivate_with_dependents $e
</span> } else {
array unset entryinfo
array set entryinfo $::mportinfo_array($mports_array([$e name]))
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -310,18 +322,8 @@ proc deactivate_unneeded {portinfovar} {
</span> if {$dependents_check_list ne ""} {
puts "Deactivating ports with outdated versions/variants and their dependents:"
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- while {$dependents_check_list ne ""} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set e [lindex $dependents_check_list end]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set dependents_check_list [lreplace ${dependents_check_list}[set dependents_check_list {}] end end]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[$e state] eq "installed"} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- lappend dependents_check_list {*}[$e dependents]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![registry::run_target $e deactivate [list ports_force yes]]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- && [catch {portimage::deactivate [$e name] [$e version] [$e revision] [$e variants] [list ports_force yes]} result]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts stderr $::errorInfo
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts stderr "Deactivating [$e name] @[$e version]_[$e revision][$e variants] failed: $result"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- exit 2
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach e $dependents_check_list {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ deactivate_with_dependents $e
</span> }
# For ports that remain active, close the mport that was opened
# earlier - it most likely won't be used again (and will be
</pre><pre style='margin:0'>
</pre>