Ticket #55637: patch-allow-reactivation.2.diff

File patch-allow-reactivation.2.diff, 2.3 KB (added by RJVB (René Bertin), 6 years ago)
  • src/port/port.tcl

    diff --git a/src/port/port.tcl b/src/port/port.tcl
    index cc1b368b..b6e59474 100644
    a b proc action_activate { action portlist opts } { 
    24922492    }
    24932493    foreachport $portlist {
    24942494        set composite_version [composite_version $portversion [array get variations]]
     2495        array set actoptions [array get options]
     2496        set force 0
     2497        if ([info exists actoptions(ports_force)]) {
     2498            if ([string is true -strict $actoptions(ports_force)]) {
     2499                set force 1
     2500            }
     2501        }
    24952502        if {![info exists options(ports_activate_no-exec)]
    24962503            && ![catch {set ilist [registry::installed $portname $composite_version]}]
    2497             && [llength $ilist] == 1} {
     2504            && ([llength $ilist] == 1 && !$force)} {
    24982505
    24992506            set i [lindex $ilist 0]
    25002507            set regref [registry::entry open $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
  • src/registry2.0/portimage.tcl

    diff --git a/src/registry2.0/portimage.tcl b/src/registry2.0/portimage.tcl
    index 6d0c1a86..c88f2e60 100644
    a b proc activate {name {version ""} {revision ""} {variants 0} {optionslist ""}} { 
    9797        set registry_open yes
    9898    }
    9999    set todeactivate [list]
     100    set actaction "Activating"
    100101
    101102    registry::read {
    102103
    proc activate {name {version ""} {revision ""} {variants 0} {optionslist ""}} { 
    125126            return -code error "Image error: Can't find image file $location"
    126127        }
    127128        if {[$requested state] eq "installed"} {
    128             return -code error "Image error: ${name} @${specifier} is already active."
     129            if {$force} {
     130                set actaction "Reactivating"
     131                lappend todeactivate $requested
     132            } else {
     133                return -code error "Image error: ${name} @${specifier} is already active."
     134            }
    129135        }
    130136    }
    131137    foreach a $todeactivate {
    proc activate {name {version ""} {revision ""} {variants 0} {optionslist ""}} { 
    134140        }
    135141    }
    136142
    137     ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $specifier]"
     143    ui_msg "$UI_PREFIX [format [msgcat::mc "$actaction %s @%s"] $name $specifier]"
    138144
    139145    _activate_contents $requested $rename_list
    140146}