Changeset 47757


Ignore:
Timestamp:
Mar 5, 2009, 3:34:58 PM (12 years ago)
Author:
jmr@…
Message:

upgrade: remove a redundant check (and indentation level)

File:
1 edited

Legend:

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

    r47756 r47757  
    23102310    set revision_installed {}
    23112311    set epoch_installed 0
    2312     if {$ilist == ""} {
    2313         ui_error "Port $portname should now be installed but isn't!"
    2314         exit 1
    2315     } else {
    2316         # a port could be installed but not activated
    2317         # so, deactivate all and save newest for activation later
    2318         set num 0
    2319         set variant ""
    2320         foreach i $ilist {
    2321             set variant [lindex $i 3]
    2322             set version [lindex $i 1]
    2323             set revision [lindex $i 2]
    2324             if { $version_installed == {} ||
    2325                     [rpm-vercomp $version $version_installed] > 0
    2326                     || ([rpm-vercomp $version $version_installed] == 0
    2327                         && [rpm-vercomp $revision $revision_installed] > 0)} {
    2328                 set iname [lindex $i 0]
    2329                 set version_installed $version
    2330                 set revision_installed $revision
    2331                 set variant_installed $variant
    2332                 set epoch_installed [registry::property_retrieve [registry::open_entry $iname [lindex $i 1] [lindex $i 2] $variant] epoch]
    2333                 set num $i
    2334             }
    2335 
    2336             set isactive [lindex $i 4]
    2337             if {$isactive == 1} {
    2338                 set anyactive yes
    2339                 set active_name [lindex $i 0]
    2340                 set version_active $version
    2341                 set revision_active $revision
    2342                 set variant_active $variant
    2343             }
    2344         }
    2345         if { $anyactive && ([rpm-vercomp $version_installed $version_active] != 0
    2346                             || [rpm-vercomp $revision_installed $revision_active] != 0
    2347                             || [string compare $variant_installed $variant_active] != 0)} {
    2348             # deactivate version
    2349             if {$is_dryrun eq "yes"} {
    2350                 ui_msg "Skipping deactivate $active_name @${version_active}_${revision_active} (dry run)"
    2351             } elseif {[catch {portimage::deactivate $active_name ${version_active}_${revision_active}${variant_active} $optionslist} result]} {
    2352                 global errorInfo
    2353                 ui_debug "$errorInfo"
    2354                 ui_error "Deactivating $active_name @${version_active}_${revision_active} failed: $result"
    2355                 return 1
    2356             }
    2357         }
    2358                 # record the variant of the latest version
    2359                 set variant [lindex $num 3]
    2360         if { [lindex $num 4] == 0 && 0 == [string compare "image" ${macports::registry.installtype}] } {
    2361             # activate the latest installed version
    2362             if {$is_dryrun eq "yes"} {
    2363                 ui_msg "Skipping activate $iname @${version_installed}_${revision_installed} (dry run)"
    2364             } elseif {[catch {portimage::activate $iname ${version_installed}_${revision_installed}$variant $optionslist} result]} {
    2365                 global errorInfo
    2366                 ui_debug "$errorInfo"
    2367                 ui_error "Activating $iname @${version_installed}_${revision_installed} failed: $result"
    2368                 return 1
    2369             }
     2312
     2313    # a port could be installed but not activated
     2314    # so, deactivate all and save newest for activation later
     2315    set num 0
     2316    set variant ""
     2317    foreach i $ilist {
     2318        set variant [lindex $i 3]
     2319        set version [lindex $i 1]
     2320        set revision [lindex $i 2]
     2321        if { $version_installed == {} ||
     2322                [rpm-vercomp $version $version_installed] > 0
     2323                || ([rpm-vercomp $version $version_installed] == 0
     2324                    && [rpm-vercomp $revision $revision_installed] > 0)} {
     2325            set iname [lindex $i 0]
     2326            set version_installed $version
     2327            set revision_installed $revision
     2328            set variant_installed $variant
     2329            set epoch_installed [registry::property_retrieve [registry::open_entry $iname [lindex $i 1] [lindex $i 2] $variant] epoch]
     2330            set num $i
     2331        }
     2332
     2333        set isactive [lindex $i 4]
     2334        if {$isactive == 1} {
     2335            set anyactive yes
     2336            set active_name [lindex $i 0]
     2337            set version_active $version
     2338            set revision_active $revision
     2339            set variant_active $variant
     2340        }
     2341    }
     2342    if { $anyactive && ([rpm-vercomp $version_installed $version_active] != 0
     2343                        || [rpm-vercomp $revision_installed $revision_active] != 0
     2344                        || [string compare $variant_installed $variant_active] != 0)} {
     2345        # deactivate version
     2346        if {$is_dryrun eq "yes"} {
     2347            ui_msg "Skipping deactivate $active_name @${version_active}_${revision_active} (dry run)"
     2348        } elseif {[catch {portimage::deactivate $active_name ${version_active}_${revision_active}${variant_active} $optionslist} result]} {
     2349            global errorInfo
     2350            ui_debug "$errorInfo"
     2351            ui_error "Deactivating $active_name @${version_active}_${revision_active} failed: $result"
     2352            return 1
     2353        }
     2354    }
     2355    # record the variant of the latest version
     2356    set variant [lindex $num 3]
     2357    if { [lindex $num 4] == 0 && 0 == [string compare "image" ${macports::registry.installtype}] } {
     2358        # activate the latest installed version
     2359        if {$is_dryrun eq "yes"} {
     2360            ui_msg "Skipping activate $iname @${version_installed}_${revision_installed} (dry run)"
     2361        } elseif {[catch {portimage::activate $iname ${version_installed}_${revision_installed}$variant $optionslist} result]} {
     2362            global errorInfo
     2363            ui_debug "$errorInfo"
     2364            ui_error "Activating $iname @${version_installed}_${revision_installed} failed: $result"
     2365            return 1
    23702366        }
    23712367    }
Note: See TracChangeset for help on using the changeset viewer.