New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Changeset 81668


Ignore:
Timestamp:
08/03/11 13:33:17 (4 years ago)
Author:
cal@…
Message:

rev-upgrade: Rebuild ports using own options rather than specifying force and nodepends

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gsoc11-rev-upgrade/base/src/macports1.0/macports.tcl

    r81289 r81668  
    31143114    } 
    31153115 
     3116    # Is this a rev-upgrade-called run? 
     3117    set is_revupgrade no 
     3118    if {[macports::global_option_isset ports_revupgrade]} { 
     3119        set is_revupgrade yes 
     3120    } 
     3121    set is_revupgrade_second_run no 
     3122    if {[macports::global_option_isset ports_revupgrade_second_run]} { 
     3123        set is_revupgrade_second_run yes 
     3124    } 
     3125 
    31163126    # check if the port is in tree 
    31173127    if {[catch {mportlookup $portname} result]} { 
     
    33793389            } 
    33803390            set will_install no 
     3391            if {$is_revupgrade} { 
     3392                set will_install yes 
     3393            } 
     3394            if {$is_revupgrade_second_run} { 
     3395                set build_override 1 
     3396            } 
    33813397        } 
    33823398    } 
     
    33843400    set will_build no 
    33853401    # avoid building again unnecessarily 
    3386     if {$will_install && ([info exists options(ports_upgrade_force)] || $build_override == 1 
    3387         || ![registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)])} { 
     3402    if {$will_install && 
     3403        ([info exists options(ports_upgrade_force)] 
     3404            || $build_override == 1 
     3405            || ![registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)])} { 
    33883406        set will_build yes 
    33893407    } 
    33903408 
    33913409    # first upgrade dependencies 
    3392     if {![info exists options(ports_nodeps)]} { 
     3410    if {![info exists options(ports_nodeps)] && !$is_revupgrade} { 
    33933411        set status [_upgrade_dependencies portinfo depscache variationslist options $will_build] 
    33943412        if {$status != 0 && $status != 2 && ![ui_isset ports_processall]} { 
     
    39333951        foreach port $topsort_ports { 
    39343952            if {![info exists depscache(port:[$port name])]} { 
    3935                 array set variations {} 
    3936                  
    3937                 set strindex 0 
    3938                 set variantsstr "[$port variants][$port negated_variants]" 
    3939                 while {$strindex != [string length $variantsstr]} { 
    3940                         set type [string index $variantsstr $strindex] 
    3941                         if {$type != "+" && $type != "-"} { 
    3942                             # ignore char not starting a variant definition 
    3943                             incr $strindex 
    3944                             continue 
    3945                         } 
    3946  
    3947                         set endpidx [string first "+" $variantsstr $strindex+1] 
    3948                         set endmidx [string first "-" $variantsstr $strindex+1] 
    3949                         set endidx [expr $endpidx < $endmidx ? $endpidx : $endmidx] 
    3950  
    3951                         if {$endidx != -1} { 
    3952                             set variantname [string trim [string range $variantsstr $strindex+1 $endidx]] 
    3953                             set strindex $endidx 
    3954                         } else { 
    3955                             # end of string 
    3956                             set variantname [string trim [string range $variantsstr $strindex+1 end]] 
    3957                             set strindex [string length $variantsstr] 
    3958                         } 
    3959  
    3960                         set variations($variantname) $type 
    3961                 } 
    3962  
    3963                 # make macports::upgrade behave like calling port -f -n upgrade [$port name] 
    3964                 set status [macports::upgrade [$port name] "port:[$port name]" [array get variations] {ports_upgrade_force yes ports_nodeps yes} depscache] 
    3965                 if {$status != 0 && ![macports::ui_isset ports_processall]} { 
     3953 
     3954                # convert variations into the format macports::upgrade needs 
     3955                set minusvariant [lrange [split [$port negated_variants] "-"] 1 end] 
     3956                set plusvariant  [lrange [split [$port variants]         "+"] 1 end] 
     3957                set variants     [list] 
     3958                foreach v $minusvariant { 
     3959                    lappend variants $v "-" 
     3960                } 
     3961                foreach v $plusvariant { 
     3962                    lappend variants $v "+" 
     3963                } 
     3964                array set variations $variants 
     3965 
     3966                set macports::global_options(ports_revupgrade) "yes" 
     3967                unset -nocomplain macports::global_options(ports_revupgrade_second_run) 
     3968                if {$broken_port_counts([$port name]) > 1} { 
     3969                    set macports::global_options(ports_revupgrade_second_run) yes 
     3970                } 
     3971 
     3972                # call macports::upgrade with ports_revupgrade option to rebuild the port 
     3973                set status [macports::upgrade [$port name] "port:[$port name]" \ 
     3974                    [array get variations] [array get macports::global_options] depscache] 
     3975                if {$status != 0} { 
    39663976                    error "Error rebuilding [$port name]" 
    39673977                } 
    3968  
    39693978            } 
    39703979        } 
Note: See TracChangeset for help on using the changeset viewer.