[47773] branches/release_1_7/base/src/macports1.0/macports.tcl
jmr at macports.org
jmr at macports.org
Thu Mar 5 16:42:05 PST 2009
Revision: 47773
http://trac.macports.org/changeset/47773
Author: jmr at macports.org
Date: 2009-03-05 16:42:04 -0800 (Thu, 05 Mar 2009)
Log Message:
-----------
Backport part of r47771 to the 1.7 branch. Fixes #16085.
Improvements for the upgrade proc:
* Don't mess with which version is active at the start
* The variants from the active version are now used for the new version, unless there is no active version in which case it uses the most recent version
* Epoch is now considered when finding the most recent installed version
Modified Paths:
--------------
branches/release_1_7/base/src/macports1.0/macports.tcl
Modified: branches/release_1_7/base/src/macports1.0/macports.tcl
===================================================================
--- branches/release_1_7/base/src/macports1.0/macports.tcl 2009-03-05 23:54:53 UTC (rev 47772)
+++ branches/release_1_7/base/src/macports1.0/macports.tcl 2009-03-06 00:42:04 UTC (rev 47773)
@@ -2024,29 +2024,31 @@
# XXX this sets $version_installed to $version_in_tree even if not installed!!
set version_installed $version_in_tree
set revision_installed $revision_in_tree
+ set epoch_installed $epoch_in_tree
set iname $portname
# That was a very dirty hack showing how ugly our depencendy and upgrade code is.
# To get it working when user provides -f, we also need to set the variant to
# avoid a future failure.
set variant ""
} else {
- # a port could be installed but not activated
- # so, deactivate all and save newest for activation later
+ # find latest version installed and active version (if any)
set num 0
set variant ""
foreach i $ilist {
set variant [lindex $i 3]
set version [lindex $i 1]
set revision [lindex $i 2]
- if { $version_installed == {} ||
- [rpm-vercomp $version $version_installed] > 0
- || ([rpm-vercomp $version $version_installed] == 0
+ set epoch [lindex $i 5]
+ if { $version_installed == {} || $epoch > $epoch_installed ||
+ ($epoch == $epoch_installed && [rpm-vercomp $version $version_installed] > 0)
+ || ($epoch == $epoch_installed
+ && [rpm-vercomp $version $version_installed] == 0
&& [rpm-vercomp $revision $revision_installed] > 0)} {
set iname [lindex $i 0]
set version_installed $version
set revision_installed $revision
set variant_installed $variant
- set epoch_installed [registry::property_retrieve [registry::open_entry $iname [lindex $i 1] [lindex $i 2] $variant] epoch]
+ set epoch_installed $epoch
set num $i
}
@@ -2059,32 +2061,17 @@
set variant_active $variant
}
}
- if { $anyactive && ([rpm-vercomp $version_installed $version_active] != 0
- || [rpm-vercomp $revision_installed $revision_active] != 0
- || [string compare $variant_installed $variant_active] != 0)} {
- # deactivate version
- if {[catch {portimage::deactivate $active_name ${version_active}_${revision_active}${variant_active} $optionslist} result]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "Deactivating $active_name @${version_active}_${revision_active} failed: $result"
- return 1
- }
- }
- if { [lindex $num 4] == 0 && 0 == [string compare "image" ${macports::registry.installtype}] } {
- # activate the latest installed version
- if {[catch {portimage::activate $iname ${version_installed}_${revision_installed}$variant $optionslist} result]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "Activating $iname @${version_installed}_${revision_installed} failed: $result"
- return 1
- }
- }
}
# output version numbers
ui_debug "epoch: in tree: $epoch_in_tree installed: $epoch_installed"
ui_debug "$portname ${version_in_tree}_$revision_in_tree exists in the ports tree"
- ui_debug "$iname ${version_installed}_$revision_installed is installed"
+ ui_debug "$iname ${version_installed}_${revision_installed}${variant_installed} is installed"
+ if {$anyactive} {
+ ui_debug "$active_name ${version_active}_${revision_active}${variant_active} is active"
+ } else {
+ ui_debug "no version of $portname is active"
+ }
# set the nodeps option
if {![info exists options(ports_nodeps)]} {
@@ -2166,7 +2153,11 @@
}
# check if the variants is present in $version_in_tree
- set oldvariant $variant
+ if {$anyactive} {
+ set variant $variant_active
+ } else {
+ set variant $variant_installed
+ }
set variant [split $variant +]
ui_debug "variants to install $variant"
if {[info exists portinfo(variants)]} {
@@ -2205,30 +2196,32 @@
return 1
}
+ if { 0 == [string compare "image" ${macports::registry.installtype}] } {
+ # deactivate version_active
+ if {[catch {portimage::deactivate $active_name ${version_active}_${revision_active}${variant_active} $optionslist} result]} {
+ global errorInfo
+ ui_debug "$errorInfo"
+ ui_error "Deactivating $active_name ${version_active}_${revision_active} failed: $result"
+ return 1
+ }
+ }
# uninstall old ports
if { $epoch_override == 1 || [info exists options(ports_force)] || 0 != [string compare "image" ${macports::registry.installtype}] } {
# uninstall old
- ui_debug "Uninstalling $iname ${version_installed}_$revision_installed$oldvariant"
+ ui_debug "Uninstalling $iname ${version_installed}_${revision_installed}${variant_installed}"
# we have to force the uninstall in case of dependents
set force_cur [info exists options(ports_force)]
set options(ports_force) yes
- if {[catch {portuninstall::uninstall $iname ${version_installed}_$revision_installed$oldvariant [array get options]} result]} {
+ if {[catch {portuninstall::uninstall $iname ${version_installed}_${revision_installed}${variant_installed} [array get options]} result]} {
global errorInfo
ui_debug "$errorInfo"
- ui_error "Uninstall $iname ${version_installed}_$revision_installed$oldvariant failed: $result"
+ ui_error "Uninstall $iname ${version_installed}_${revision_installed}${variant_installed} failed: $result"
return 1
}
if {!$force_cur} {
unset options(ports_force)
}
} else {
- # XXX deactivate version_installed
- if {[catch {portimage::deactivate $iname ${version_installed}_$revision_installed$oldvariant $optionslist} result]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "Deactivating $iname ${version_installed}_$revision_installed failed: $result"
- return 1
- }
if { [info exists options(port_uninstall_old)] } {
# uninstalling now could fail due to dependents when not forced,
# because the new version is not installed
@@ -2239,16 +2232,16 @@
if {[catch {set result [mportexec $workername install]} result]} {
global errorInfo
ui_debug "$errorInfo"
- ui_error "Couldn't activate $portname ${version_in_tree}_$revision_in_tree$oldvariant: $result"
+ ui_error "Couldn't activate $portname ${version_in_tree}_${revision_in_tree}: $result"
return 1
}
if { [info exists uninstall_later] && $uninstall_later == yes } {
- ui_debug "Uninstalling $iname ${version_installed}_$revision_installed$oldvariant"
- if {[catch {portuninstall::uninstall $iname ${version_installed}_$revision_installed$oldvariant $optionslist} result]} {
+ ui_debug "Uninstalling $active_name ${version_active}_${revision_active}${variant_active}"
+ if {[catch {portuninstall::uninstall $active_name ${version_active}_${revision_active}${variant_active} $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
- ui_error "Uninstall $iname ${version_installed}_$revision_installed$oldvariant failed: $result"
+ ui_error "Uninstall $active_name ${version_active}_${revision_active}${variant_active} failed: $result"
return 1
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090305/f0714ee4/attachment.html>
More information about the macports-changes
mailing list