[47781] trunk/base/src/macports1.0/macports.tcl

jmr at macports.org jmr at macports.org
Thu Mar 5 19:09:13 PST 2009


Revision: 47781
          http://trac.macports.org/changeset/47781
Author:   jmr at macports.org
Date:     2009-03-05 19:09:11 -0800 (Thu, 05 Mar 2009)
Log Message:
-----------
Uninstall all inactive versions after upgrading a port with -u, not just one.

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2009-03-06 02:54:47 UTC (rev 47780)
+++ trunk/base/src/macports1.0/macports.tcl	2009-03-06 03:09:11 UTC (rev 47781)
@@ -2540,12 +2540,12 @@
                 ui_error "Deactivating $portname ${version_active}_${revision_active} 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
-                set uninstall_later yes
-            }
         }
+        if {[info exists options(port_uninstall_old)]} {
+            # uninstalling now could fail due to dependents when not forced,
+            # because the new version is not installed
+            set uninstall_later yes
+        }
     }
 
     if {$is_dryrun eq "yes"} {
@@ -2557,15 +2557,23 @@
         return 1
     }
     
-    if { [info exists uninstall_later] && $uninstall_later == yes } {
-        ui_debug "Uninstalling $portname ${version_active}_${revision_active}${variant_active}"
-        if {$is_dryrun eq "yes"} {
-            ui_msg "Skipping uninstall $portname @${version_active}_${revision_active}${variant_active} (dry run)"
-        } elseif {[catch {portuninstall::uninstall $portname ${version_active}_${revision_active}${variant_active} $optionslist} result]} {
-            global errorInfo
-            ui_debug "$errorInfo"
-            ui_error "Uninstall $portname ${version_active}_${revision_active}${variant_active} failed: $result"
-            return 1
+    if {[info exists uninstall_later] && $uninstall_later == yes} {
+        foreach i $ilist {
+            set version [lindex $i 1]
+            set revision [lindex $i 2]
+            set variant [lindex $i 3]
+            if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants)} {
+                continue
+            }
+            ui_debug "Uninstalling $portname ${version}_${revision}${variant}"
+            if {$is_dryrun eq "yes"} {
+                ui_msg "Skipping uninstall $portname @${version}_${revision}${variant} (dry run)"
+            } elseif {[catch {portuninstall::uninstall $portname ${version}_${revision}${variant} $optionslist} result]} {
+                global errorInfo
+                ui_debug "$errorInfo"
+                ui_error "Uninstall $portname @${version}_${revision}${variant} failed: $result"
+                return 1
+            }
         }
     }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090305/9b63c631/attachment-0001.html>


More information about the macports-changes mailing list