[123761] branches/gsoc14-interactive/base/src/registry2.0/registry_util.tcl

shasha at macports.org shasha at macports.org
Wed Aug 13 17:11:30 PDT 2014


Revision: 123761
          https://trac.macports.org/changeset/123761
Author:   shasha at macports.org
Date:     2014-08-13 17:11:30 -0700 (Wed, 13 Aug 2014)
Log Message:
-----------
implemented interactivity for uninstall of port having dependents

Modified Paths:
--------------
    branches/gsoc14-interactive/base/src/registry2.0/registry_util.tcl

Modified: branches/gsoc14-interactive/base/src/registry2.0/registry_util.tcl
===================================================================
--- branches/gsoc14-interactive/base/src/registry2.0/registry_util.tcl	2014-08-14 00:09:40 UTC (rev 123760)
+++ branches/gsoc14-interactive/base/src/registry2.0/registry_util.tcl	2014-08-14 00:11:30 UTC (rev 123761)
@@ -77,12 +77,29 @@
             set deplist $active_deplist
         }
         if { [llength $deplist] > 0 } {
-            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]]"
+            ## User Interaction Question
+            # ask if user wants to uninstall a port and thereby break its dependents
+            if {[info exists macports::ui_options(questions_yesno)] && ![string is true -strict $force]} { 
+                set portulist {}
+                foreach depport $deplist {
+                    lappend portulist [$depport name]@[$depport version]_[$depport revision]
+                }
+                ui_msg "Note: It is not recommended to uninstall/deactivate a port that has dependents as it breaks the dependents."
+                set retvalue [$macports::ui_options(questions_yesno) "The following ports will break:" "breakDeps" $portulist {n} 0]
+                if {$retvalue == 0} {
+                    set force "yes"
+                } else {
+                    return quit
+                }
+            } else {	
+                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 "[string totitle $action] forced.  Proceeding despite dependencies."
+                return forcedbyuser
             } else {
                 throw registry::uninstall-error "Please uninstall the ports that depend on [$port name] first."
             }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140813/8c745944/attachment.html>


More information about the macports-changes mailing list