<pre style='margin:0'>
Clemens Lang (neverpanic) pushed a commit to branch master
in repository macports-base.

</pre>
<p><a href="https://github.com/macports/macports-base/commit/cb3305837913f2629e16f7033a2abd9476d52b53">https://github.com/macports/macports-base/commit/cb3305837913f2629e16f7033a2abd9476d52b53</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit cb3305837913f2629e16f7033a2abd9476d52b53
</span>Author: Clemens Lang <cal@macports.org>
AuthorDate: Tue Mar 19 02:24:20 2024 +0100

<span style='display:block; white-space:pre;color:#404040;'>    registry2.0: Enable progress bar for deactivation
</span><span style='display:block; white-space:pre;color:#404040;'>    
</span><span style='display:block; white-space:pre;color:#404040;'>    This progress bar works in two steps, each of which take 50%. The first
</span><span style='display:block; white-space:pre;color:#404040;'>    step loops over the files to determine the directories to deactivate and
</span><span style='display:block; white-space:pre;color:#404040;'>    normalize file paths, the second pass does the actual deactivation.
</span>---
 src/registry2.0/portimage.tcl | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/registry2.0/portimage.tcl b/src/registry2.0/portimage.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 5895c69ab..176beb144 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/registry2.0/portimage.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/registry2.0/portimage.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -823,7 +823,16 @@ proc _deactivate_file {dstfile} {
</span> proc _deactivate_contents {port imagefiles {force 0} {rollback 0}} {
     set files [list]
 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+    # these are only used locally, so it is *not* a mistake that there is no
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    # 'variable' declaration here
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    set progress_step 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    set progress_total_steps [expr {[llength $imagefiles] * 2}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+    _progress start
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>     foreach file $imagefiles {
<span style='display:block; white-space:pre;background:#e0ffe0;'>+        incr progress_step
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+        _progress update $progress_step $progress_total_steps
</span>         if { [::file exists $file] || (![catch {::file type $file} ft] && $ft eq "link") } {
             # Normalize the file path to avoid removing the intermediate
             # symlinks (remove the empty directories instead)
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -842,6 +851,7 @@ proc _deactivate_contents {port imagefiles {force 0} {rollback 0}} {
</span>             # as well.
             while {$directory ni $files} {
                 lappend files $directory
<span style='display:block; white-space:pre;background:#e0ffe0;'>+                incr progress_total_steps
</span>                 set directory [::file dirname $directory]
             }
         } else {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -854,6 +864,8 @@ proc _deactivate_contents {port imagefiles {force 0} {rollback 0}} {
</span>     # are after their elements.
     set files [lsort -decreasing -unique $files]
 
<span style='display:block; white-space:pre;background:#e0ffe0;'>+    set progress_total_steps [expr {[llength $imagefiles] + [llength $files]}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>     # Avoid interruptions while removing the files and updating the database to
     # prevent inconsistencies from forming between filesystem and database.
     set osignals [signal get {TERM INT}]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -872,6 +884,9 @@ proc _deactivate_contents {port imagefiles {force 0} {rollback 0}} {
</span>                 $port deactivate $imagefiles
                 foreach file $files {
                     _deactivate_file $file
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    incr progress_step
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                    _progress update $progress_step $progress_total_steps
</span>                 }
 
                 # Update the port's state in the same transaction as the file
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -881,11 +896,16 @@ proc _deactivate_contents {port imagefiles {force 0} {rollback 0}} {
</span>         } else {
             foreach file $files {
                 _deactivate_file $file
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                incr progress_step
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+                _progress update $progress_step $progress_total_steps
</span>             }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span>         }
     } finally {
         # restore the signal block state
         signal set $osignals
<span style='display:block; white-space:pre;background:#e0ffe0;'>+        _progress finish
</span>     }
 }
 
</pre><pre style='margin:0'>

</pre>