<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/6573d549d93062d2573ca396ad0af7a14ef8b798">https://github.com/macports/mpbb/commit/6573d549d93062d2573ca396ad0af7a14ef8b798</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 6573d54 cleanup: deactivate dependents of uninstalled ports
</span>6573d54 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit 6573d549d93062d2573ca396ad0af7a14ef8b798
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Wed Nov 1 04:22:18 2023 +1100
<span style='display:block; white-space:pre;color:#404040;'> cleanup: deactivate dependents of uninstalled ports
</span>---
tools/uninstall-unneeded-ports.tcl | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/tools/uninstall-unneeded-ports.tcl b/tools/uninstall-unneeded-ports.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 8889d59..b4b1d84 100755
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/tools/uninstall-unneeded-ports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/tools/uninstall-unneeded-ports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -91,6 +91,22 @@ proc removal_reason {installed_name} {
</span> return $reason
}
<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;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> foreach port [registry::entry imaged] {
# Set to yes if a port should be uninstalled
set uninstall no
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -129,6 +145,10 @@ foreach port [registry::entry imaged] {
</span> }
}
if {$uninstall} {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Deactivate any active dependents first
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach dependent [$port 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> # Try to run the target via the portfile first, so pre/post code runs
if {![registry::run_target $port uninstall [list ports_force 1]]} {
# Portfile failed, use the registry directly
</pre><pre style='margin:0'>
</pre>