[138095] trunk/base/src/registry2.0/portuninstall.tcl

jmr at macports.org jmr at macports.org
Sat Jun 27 22:20:40 PDT 2015


Revision: 138095
          https://trac.macports.org/changeset/138095
Author:   jmr at macports.org
Date:     2015-06-27 22:20:40 -0700 (Sat, 27 Jun 2015)
Log Message:
-----------
recursive uninstall: correctly handle case where only some versions of a port have the requested flag, do more fine-grained dependent checking, style and efficiency improvements

Modified Paths:
--------------
    trunk/base/src/registry2.0/portuninstall.tcl

Modified: trunk/base/src/registry2.0/portuninstall.tcl
===================================================================
--- trunk/base/src/registry2.0/portuninstall.tcl	2015-06-28 03:36:46 UTC (rev 138094)
+++ trunk/base/src/registry2.0/portuninstall.tcl	2015-06-28 05:20:40 UTC (rev 138095)
@@ -249,7 +249,7 @@
         ui_msg "For $portname @${composite_spec}: skipping uninstall (dry run)"
         # allow deps to not be excluded from the list below just because this port is still a dependent
         if {[info exists options(ports_uninstall_follow-dependencies)] && [string is true -strict $options(ports_uninstall_follow-dependencies)]} {
-            set uports [list $portname]
+            set uports [list [list $portname $version $revision $variants]]
         }
     } else {
         ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s @%s"] $portname $composite_spec]"
@@ -307,25 +307,21 @@
             set uninstalling_this_dep 0
             if {![catch {set ilist [registry::installed $dep]}]} {
                 foreach i $ilist {
-                    set iversion [lindex $i 1]
-                    set irevision [lindex $i 2]
-                    set ivariants [lindex $i 3]
+                    lassign $i dep iversion irevision ivariants
+                    if {[list $dep $iversion $irevision $ivariants] in $uports} {
+                        continue
+                    }
                     set regref [registry::open_entry $dep $iversion $irevision $ivariants [lindex $i 5]]
                     if {![registry::property_retrieve $regref requested]} {
-                        set dependentlist [registry::list_dependents $dep $iversion $irevision $ivariants]
-                        set dependents {}
-                        foreach depdt $dependentlist {
-                            lappend dependents [lindex $depdt 2]
-                        }
                         set all_dependents_uninstalling 1
-                        foreach depdt $dependents {
-                            if {[lsearch -exact $uports $depdt] == -1} {
+                        foreach depdt [$regref dependents] {
+                            if {[list [$depdt name] [$depdt version] [$depdt revision] [$depdt variants]] ni $uports} {
                                 set all_dependents_uninstalling 0
                                 break
                             }
                         }
                         if {$all_dependents_uninstalling} {
-                            lappend uports $dep
+                            lappend uports [list $dep $iversion $irevision $ivariants]
                             lappend portilist $dep@${iversion}_${irevision}${ivariants}
                             set uninstalling_this_dep 1
                         }
@@ -337,7 +333,7 @@
                 foreach depref $deprefs {
                     set depdeps [registry_uninstall::generate_deplist $depref $optionslist]
                     foreach d $depdeps {
-                        if {[lsearch -exact [lrange $alldeps $j+1 end] $d] == -1} {
+                        if {$d ni [lrange $alldeps $j+1 end]} {
                             lappend alldeps $d 
                         }
                     }
@@ -354,21 +350,16 @@
 
     # uninstall all dependencies in order from uports
     foreach dp $uports {
-        if {![catch {set ilist [registry::installed $dp]}]} {
-            foreach i $ilist {
-                set iversion [lindex $i 1]
-                set irevision [lindex $i 2]
-                set ivariants [lindex $i 3]
-                set regref [registry::open_entry $dp $iversion $irevision $ivariants [lindex $i 5]]
-                if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
-                    if {$dp ne $portname} {
-                        ui_msg "For $dp @${iversion}_${irevision}${ivariants}: skipping uninstall (dry run)"
-                    }
-                } else {
-                    if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $regref uninstall [array get options]]} {
-                        registry_uninstall::uninstall $dp $iversion $irevision $ivariants [array get options]
-                    }
+        lassign $dp iname iversion irevision ivariants
+        if {![catch {registry::open_entry $iname $iversion $irevision $ivariants ""} regref]} {
+            if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
+                if {$iname ne $portname} {
+                    ui_msg "For $iname @${iversion}_${irevision}${ivariants}: skipping uninstall (dry run)"
                 }
+            } else {
+                if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $regref uninstall [array get options]]} {
+                    registry_uninstall::uninstall $iname $iversion $irevision $ivariants [array get options]
+                }
             }
         }
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150627/f05752ea/attachment.html>


More information about the macports-changes mailing list