[53711] trunk/base/src/registry1.0/portimage.tcl

jmr at macports.org jmr at macports.org
Sun Jul 12 07:59:39 PDT 2009


Revision: 53711
          http://trac.macports.org/changeset/53711
Author:   jmr at macports.org
Date:     2009-07-12 07:59:39 -0700 (Sun, 12 Jul 2009)
Log Message:
-----------
when activating, if another version of the same port is active, deactivate it first instead of erroring out (#10571)

Modified Paths:
--------------
    trunk/base/src/registry1.0/portimage.tcl

Modified: trunk/base/src/registry1.0/portimage.tcl
===================================================================
--- trunk/base/src/registry1.0/portimage.tcl	2009-07-12 14:53:13 UTC (rev 53710)
+++ trunk/base/src/registry1.0/portimage.tcl	2009-07-12 14:59:39 UTC (rev 53711)
@@ -82,13 +82,8 @@
 	set version [lindex $ilist 1]
 	set revision [lindex $ilist 2]
 	set	variants [lindex $ilist 3]
-	
-    if {$v != ""} {
-        ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $v]"
-    } else {
-        ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s"] $name]"
-    }
 
+	# if another version of this port is active, deactivate it first
 	set ilist [registry::installed $name]
 	if { [llength $ilist] > 1 } {
 		foreach i $ilist {
@@ -98,10 +93,16 @@
 			set	ivariants [lindex $i 3]
 			set iactive [lindex $i 4]
 			if { ![string equal ${iversion}_${irevision}${ivariants} ${version}_${revision}${variants}] && $iactive == 1 } {
-				return -code error "Image error: Another version of this port ($iname @${iversion}_${irevision}${ivariants}) is already active."
+				deactivate $iname ${iversion}_${irevision}${ivariants} $optionslist
 			}
 		}
 	}
+	
+    if {$v != ""} {
+        ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $v]"
+    } else {
+        ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s"] $name]"
+    }
 
 	set ref [registry::open_entry $name $version $revision $variants]
 	
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090712/877044f1/attachment.html>


More information about the macports-changes mailing list