Skip to content

Commit

Permalink
Don't try to re-execute with multiple actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jmroot committed Jul 18, 2024
1 parent 336594a commit 0081397
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/port/port.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -2442,9 +2442,11 @@ proc action_selfupdate { action portlist opts } {

if {[dict get $selfupdate_status base_updated]} {
# Base was upgraded, re-execute now to trigger sync if possible
if {[info exists ui_options(ports_commandfiles)]} {
# Batch mode, just exit since re-executing all commands in the file
# may not be correct.
global argv
if {[info exists ui_options(ports_commandfiles)]
|| {;} in $argv} {
# Batch mode or multiple actions on the command line, just exit
# since re-executing all actions may not be correct.
if {[dict get $selfupdate_status needed_portindex]} {
ui_msg "Not all sources could be fully synced using the old version of MacPorts."
ui_msg "Please run selfupdate again now that MacPorts base has been updated."
Expand All @@ -2455,7 +2457,7 @@ proc action_selfupdate { action portlist opts } {
if {![dict exists $options ports_selfupdate_no-sync] || ![dict get $options ports_selfupdate_no-sync]} {
# When re-executing, strip the -f flag to prevent an endless loop
set new_argv {}
foreach arg $::argv {
foreach arg $argv {
if {[string match -nocase {-[a-z]*} $arg]} {
# map the -f flag to nothing
set arg [string map {f ""} $arg]
Expand Down Expand Up @@ -2569,10 +2571,12 @@ proc action_migrate { action portlist opts } {
}
set result [macports::migrate_main $opts]
if {$result == -999} {
global ui_options
if {[info exists ui_options(ports_commandfiles)]} {
# Batch mode, just exit since re-executing all commands in the file
# may not be correct, and we can't really edit their args anyway.
global ui_options argv
if {[info exists ui_options(ports_commandfiles)]
|| {;} in $argv} {
# Batch mode or multiple actions given, just exit since re-
# executing all actions may not be correct (and we can't
# really edit the args in a batch file anyway).
ui_msg "Please run migrate again now that MacPorts base has been updated."
return -999
}
Expand Down

0 comments on commit 0081397

Please sign in to comment.