[78086] trunk/base/src/registry2.0

jmr at macports.org jmr at macports.org
Sat Apr 23 03:07:01 PDT 2011


Revision: 78086
          http://trac.macports.org/changeset/78086
Author:   jmr at macports.org
Date:     2011-04-23 03:06:58 -0700 (Sat, 23 Apr 2011)
Log Message:
-----------
more specific messages when dependents prevent removing a port, and allow deactivating ports that only have inactive dependents

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

Modified: trunk/base/src/registry2.0/portimage.tcl
===================================================================
--- trunk/base/src/registry2.0/portimage.tcl	2011-04-23 07:59:09 UTC (rev 78085)
+++ trunk/base/src/registry2.0/portimage.tcl	2011-04-23 10:06:58 UTC (rev 78086)
@@ -268,7 +268,7 @@
         }
 
         if {![info exists options(ports_nodepcheck)] || ![string is true -strict $options(ports_nodepcheck)]} {
-            registry::check_dependents $requested $force
+            registry::check_dependents $requested $force "deactivate"
         }
 
         _deactivate_contents $requested [$requested files] $force

Modified: trunk/base/src/registry2.0/portuninstall.tcl
===================================================================
--- trunk/base/src/registry2.0/portuninstall.tcl	2011-04-23 07:59:09 UTC (rev 78085)
+++ trunk/base/src/registry2.0/portuninstall.tcl	2011-04-23 10:06:58 UTC (rev 78086)
@@ -139,7 +139,7 @@
             }
         } else {
             # check its dependents
-            registry::check_dependents $port ${uninstall.force}
+            registry::check_dependents $port ${uninstall.force} "uninstall"
         }
         # if it's active, deactivate it
         if { [string equal [$port state] installed] } {

Modified: trunk/base/src/registry2.0/registry_util.tcl
===================================================================
--- trunk/base/src/registry2.0/registry_util.tcl	2011-04-23 07:59:09 UTC (rev 78085)
+++ trunk/base/src/registry2.0/registry_util.tcl	2011-04-23 10:06:58 UTC (rev 78086)
@@ -60,18 +60,28 @@
 ##
 ## @param [in] port  a registry::entry to check
 ## @param [in] force if true, continue even if there are dependents
-proc check_dependents {port force} {
+proc check_dependents {port force {action "uninstall/deactivate"}} {
     global UI_PREFIX
     if {[$port state] == "installed" || [llength [registry::entry imaged [$port name]]] == 1} {
-        # Check and make sure no ports depend on this one
+        # Check if any installed ports depend on this one
         set deplist [$port dependents]
+        if {$action == "deactivate"} {
+            set active_deplist {}
+            # Check if any active ports depend on this one
+            foreach p $deplist {
+                if {[$p state] == "installed"} {
+                    lappend active_deplist $p
+                }
+            }
+            set deplist $active_deplist
+        }
         if { [llength $deplist] > 0 } {
-            ui_msg "$UI_PREFIX [format [msgcat::mc "Unable to uninstall/deactivate %s @%s_%s%s, the following ports depend on it:"] [$port name] [$port version] [$port revision] [$port variants]]"
+            ui_msg "$UI_PREFIX [format [msgcat::mc "Unable to %s %s @%s_%s%s, the following ports depend on it:"] $action [$port name] [$port version] [$port revision] [$port variants]]"
             foreach depport $deplist {
                 ui_msg "$UI_PREFIX [format [msgcat::mc "	%s @%s_%s%s"] [$depport name] [$depport version] [$depport revision] [$depport variants]]"
             }
             if { [string is true -strict $force] } {
-                ui_warn "Uninstall/deactivate forced.  Proceeding despite dependencies."
+                ui_warn "[string totitle $action] forced.  Proceeding despite dependencies."
             } else {
                 throw registry::uninstall-error "Please uninstall the ports that depend on [$port name] first."
             }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110423/eb928748/attachment.html>


More information about the macports-changes mailing list