Changeset 53704


Ignore:
Timestamp:
Jul 12, 2009, 12:16:49 PM (10 years ago)
Author:
jmr@…
Message:

Remove the -x flag and make its behaviour the default, improve error propagation, and handle the -p option where it is now needed. Fixes #13918.

Location:
trunk/base/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/macports1.0/macports.tcl

    r53371 r53704  
    23132313               
    23142314                # upgrade its dependencies first
    2315                 _upgrade_dependencies portinfo depscache globalvarlist variationslist options
     2315                set status [_upgrade_dependencies portinfo depscache globalvarlist variationslist options]
     2316                if {$status != 0 && ![ui_isset ports_processall]} {
     2317                    catch {mportclose $workername}
     2318                    return $status
     2319                }
    23162320                # now install it
    23172321                if {[catch {set result [mportexec $workername install]} result]} {
     
    23412345        } else {
    23422346            ui_error "Checking installed version failed: $result"
    2343             exit 1
     2347            return 1
    23442348        }
    23452349    } else {
     
    24592463    # first upgrade dependencies
    24602464    if {![info exists options(ports_nodeps)]} {
    2461         _upgrade_dependencies portinfo depscache globalvarlist variationslist options
     2465        set status [_upgrade_dependencies portinfo depscache globalvarlist variationslist options]
     2466        if {$status != 0 && ![ui_isset ports_processall]} {
     2467            catch {mportclose $workername}
     2468            return $status
     2469        }
    24622470    } else {
    24632471        ui_debug "Not following dependencies"
     
    24882496                        set mpname [lindex $dep 2]
    24892497                        if {![llength [array get depscache port:${mpname}]]} {
    2490                             macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache
     2498                            set status [macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache]
     2499                            if {$status != 0 && ![ui_isset ports_processall]} {
     2500                                catch {mportclose $workername}
     2501                                return $status
     2502                            }
    24912503                        }
    24922504                    }
     
    26262638                set mpname [lindex $dep 2]
    26272639                if {![llength [array get depscache port:${mpname}]]} {
    2628                     macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache
     2640                    set status [macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache]
     2641                    if {$status != 0 && ![ui_isset ports_processall]} {
     2642                        catch {mportclose $workername}
     2643                        return $status
     2644                    }
    26292645                }
    26302646            }
     
    26572673    unset -nocomplain options(ports_do_dependents)
    26582674
     2675    set status 0
    26592676    # each dep type is upgraded
    26602677    foreach dtype {depends_fetch depends_extract depends_build depends_lib depends_run} {
     
    26632680                set d [lindex [split $i :] end]
    26642681                if {![llength [array get depscache port:${d}]] && ![llength [array get depscache $i]]} {
    2665                     upgrade $d $i $globalvarlist $variationslist [array get options] depscache
    2666                 }
    2667             }
    2668         }
     2682                    set status [upgrade $d $i $globalvarlist $variationslist [array get options] depscache]
     2683                    if {$status != 0 && ![ui_isset ports_processall]} break
     2684                }
     2685            }
     2686        }
     2687        if {$status != 0 && ![ui_isset ports_processall]} break
    26692688    }
    26702689    # restore dependent-following to its former value
     
    26722691        set options(ports_do_dependents) yes
    26732692    }
     2693    return $status
    26742694}
    26752695
  • trunk/base/src/port/port.tcl

    r53674 r53704  
    20082008    foreachport $portlist {
    20092009        if {![registry::entry_exists_for_name $portname]} {
    2010             ui_error "$portname is not installed"
    2011             return 1
     2010            break_softcontinue "$portname is not installed" 1 status
    20122011        }
    20132012        if {![info exists depscache(port:$portname)]} {
     
    20202019            set variations_list [mport_filtervariants [array get requested_variations] yes]
    20212020           
    2022             macports::upgrade $portname "port:$portname" $global_variations_list $variations_list [array get options] depscache
    2023         }
    2024     }
    2025 
    2026     return 0
     2021            set status [macports::upgrade $portname "port:$portname" $global_variations_list $variations_list [array get options] depscache]
     2022            if {$status != 0 && ![macports::ui_isset ports_processall]} {
     2023                return $status
     2024            }
     2025        }
     2026    }
     2027
     2028    return $status
    20272029}
    20282030
     
    32173219                        set ui_options(ports_processall) yes
    32183220                    }
    3219                     x {
    3220                         # Exit with error from any command while in batch/interactive mode
    3221                         set ui_options(ports_exit) yes
    3222                     }
    3223 
    32243221                    f {
    32253222                        set global_options(ports_force) yes
     
    32933290
    32943291    # Process an action if there is one
    3295     while {$action_status == 0 && [moreargs]} {
     3292    while {($action_status == 0 || [macports::ui_isset ports_processall]) && [moreargs]} {
    32963293        set action [lookahead]
    32973294        advance
     
    33763373        # semaphore to exit
    33773374        if {$action_status == -999} break
    3378 
    3379         # If we're not in exit mode then ignore the status from the command
    3380         if { ![macports::ui_isset ports_exit] } {
    3381             set action_status 0
    3382         }
    33833375    }
    33843376   
     
    35033495    # Main command loop
    35043496    set exit_status 0
    3505     while { $exit_status == 0 } {
     3497    while { $exit_status == 0 || [macports::ui_isset ports_processall] } {
    35063498
    35073499        # Calculate our prompt
     
    35233515       
    35243516        # Check for semaphore to exit
    3525         if {$exit_status == -999} break
    3526        
    3527         # Ignore status unless we're in error-exit mode
    3528         if { ![macports::ui_isset ports_exit] } {
     3517        if {$exit_status == -999} {
    35293518            set exit_status 0
     3519            break
    35303520        }
    35313521    }
     
    35693559        }
    35703560
    3571         # Check for semaphore to exit
    3572         if {$exit_status == -999} {
    3573             set exit_status 0
    3574             break
    3575         }
    3576 
    3577         # Ignore status unless we're in error-exit mode
    3578         if { ![macports::ui_isset ports_exit] } {
    3579             set exit_status 0
     3561        # Exit on first failure unless -p was given
     3562        if {$exit_status != 0 && ![macports::ui_isset ports_processall]} {
     3563            return $exit_status
    35803564        }
    35813565    }
     
    36633647
    36643648    # If there are remaining arguments, process those as a command
    3665 
    3666     # Exit immediately, by default, unless we're going to be processing command files
    3667     if {![info exists ui_options(ports_commandfiles)]} {
    3668         set ui_options(ports_exit) yes
    3669     }
    36703649    set exit_status [process_cmd $remaining_args]
    36713650}
    36723651
    36733652# Process any prescribed command files, including standard input
    3674 if { $exit_status == 0 && [info exists ui_options(ports_commandfiles)] } {
     3653if { ($exit_status == 0 || [macports::ui_isset ports_processall]) && [info exists ui_options(ports_commandfiles)] } {
    36753654    set exit_status [process_command_files $ui_options(ports_commandfiles)]
    36763655}
Note: See TracChangeset for help on using the changeset viewer.