Skip to content

Commit

Permalink
macports/restore: Use ===> as ui_prefix for restore operations
Browse files Browse the repository at this point in the history
The relevant info gets lost in a sea of about a thousand ---> lines, so
let's use ===> for operations performed by the restore operation to draw
attention to the lines that contain progress information.
  • Loading branch information
neverpanic committed Mar 25, 2024
1 parent ced5097 commit d10fdd6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/macports1.0/restore.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ package require struct::graph::op 0.11
package require lambda 1

namespace eval restore {
variable ui_prefix

proc main {opts} {
# The main function. If the action is provided a snapshot id, then it deactivates
# all the current ports and restores the specified snapshot.
Expand All @@ -59,6 +61,8 @@ namespace eval restore {

array set options $opts

set restore::ui_prefix [string map {--- ===} $macports::ui_prefix]

if {[migrate::needs_migration]} {
ui_error "You need to run 'sudo port migrate' before running restore"
return 1
Expand Down Expand Up @@ -87,10 +91,10 @@ namespace eval restore {
set snapshot [lindex $snapshots $retstring]
}

ui_msg "$macports::ui_prefix Deactivating all installed ports"
ui_msg "$restore::ui_prefix Deactivating all installed ports"
deactivate_all

ui_msg "$macports::ui_prefix Restoring snapshot '[$snapshot note]' created at [$snapshot created_at]"
ui_msg "$restore::ui_prefix Restoring snapshot '[$snapshot note]' created at [$snapshot created_at]"
set snapshot_portlist [$snapshot ports]
array set failed [restore_state [$snapshot ports]]

Expand Down Expand Up @@ -235,9 +239,9 @@ namespace eval restore {
}

if {$fancy_output} {
ui_msg "$macports::ui_prefix Computing dependency order"
ui_msg "$restore::ui_prefix Computing dependency order"
} else {
ui_msg "$macports::ui_prefix Computing dependency order. This will take a while, please be patient"
ui_msg "$restore::ui_prefix Computing dependency order. This will take a while, please be patient"
flush stdout
}
$progress start
Expand Down Expand Up @@ -391,7 +395,7 @@ namespace eval restore {

$progress finish

ui_msg "$macports::ui_prefix Sorting dependency tree"
ui_msg "$restore::ui_prefix Sorting dependency tree"

# Compute a list of stronly connected components using Tarjan's
# algorithm. The result should be a list of one-element sets (unless
Expand Down Expand Up @@ -450,9 +454,9 @@ namespace eval restore {
lassign $port name requested active variants

if {$variants ne ""} {
ui_msg "$macports::ui_prefix $index/$length Restoring $name $variants from snapshot"
ui_msg "$restore::ui_prefix Restoring port $index of $length: $name $variants"
} else {
ui_msg "$macports::ui_prefix $index/$length Restoring $name from snapshot"
ui_msg "$restore::ui_prefix Restoring port $index of $length: $name"
}

if {[info exists failed($name)]} {
Expand Down

0 comments on commit d10fdd6

Please sign in to comment.