[29498] trunk/base/src

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 25 14:05:28 PDT 2007


Revision: 29498
          http://trac.macosforge.org/projects/macports/changeset/29498
Author:   eridius at macports.org
Date:     2007-09-25 14:05:28 -0700 (Tue, 25 Sep 2007)

Log Message:
-----------
Clean up the ui_isset and ui_channels stuff.

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

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2007-09-25 21:03:56 UTC (rev 29497)
+++ trunk/base/src/macports1.0/macports.tcl	2007-09-25 21:05:28 UTC (rev 29498)
@@ -78,10 +78,9 @@
 # not be relied upon for production code
 
 # ui_options accessor
-proc macports::ui_isset {ui_options val} {
-    upvar $ui_options up_ui_options
-    if {[info exists up_ui_options($val)]} {
-        if {$up_ui_options($val) == "yes"} {
+proc macports::ui_isset {val} {
+    if {[info exists macports::ui_options($val)]} {
+        if {$macports::ui_options($val) == "yes"} {
             return 1
         }
     }
@@ -90,10 +89,9 @@
 
 
 # global_options accessor
-proc macports::global_option_isset {global_options val} {
-    upvar $global_options up_global_options
-    if {[info exists up_global_options($val)]} {
-        if {$up_global_options($val) == "yes"} {
+proc macports::global_option_isset {val} {
+    if {[info exists macports::global_options($val)]} {
+        if {$macports::global_options($val) == "yes"} {
             return 1
         }
     }
@@ -158,13 +156,25 @@
 proc macports::ui_channels_default {priority} {
     switch $priority {
         debug {
-            return {stderr}
+            if {[ui_isset ports_debug]} {
+                return {stderr}
+            } else {
+                return {}
+            }
         }
         info {
-            return {stdout}
+            if {[ui_isset ports_verbose]} {
+                return {stdout}
+            } else {
+                return {}
+            }
         }
         msg {
-            return {stdout}
+            if {[ui_isset ports_quiet]} {
+                return {}
+            } else {    
+                return {stdout}
+            }
         }
         error {
             return {stderr}
@@ -274,17 +284,19 @@
 
 proc mportinit {{up_ui_options {}} {up_options {}} {up_variations {}}} {
     if {$up_ui_options eq ""} {
-        array set ui_options {}
+        array set macports::ui_options {}
     } else {
-        upvar $up_ui_options ui_options
+        upvar $up_ui_options temp_ui_options
+        array set macports::ui_options [array get temp_ui_options]
     }
     if {$up_options eq ""} {
-        array set options {}
+        array set macports::global_options {}
     } else {
-        upvar $up_options options
+        upvar $up_options temp_options
+        array set macports::global_options [array get temp_options]
     }
     if {$up_variations eq ""} {
-        array set $up_variations {}
+        array set variations {}
     } else {
         upvar $up_variations variations
     }
@@ -477,9 +489,9 @@
         global macports::portautoclean
     }
     # Check command line override for autoclean
-    if {[info exists options(ports_autoclean)]} {
-        if {![string equal $options(ports_autoclean) $portautoclean]} {
-            set macports::portautoclean $options(ports_autoclean)
+    if {[info exists macports::global_options(ports_autoclean)]} {
+        if {![string equal $macports::global_options(ports_autoclean) $portautoclean]} {
+            set macports::portautoclean $macports::global_options(ports_autoclean)
         }
     }
     # Trace mode, whether to use darwintrace to debug ports.
@@ -488,9 +500,9 @@
         global macports::porttrace
     }
     # Check command line override for trace
-    if {[info exists options(ports_trace)]} {
-        if {![string equal $options(ports_trace) $porttrace]} {
-            set macports::porttrace $options(ports_trace)
+    if {[info exists macports::global_options(ports_trace)]} {
+        if {![string equal $macports::global_options(ports_trace) $porttrace]} {
+            set macports::porttrace $macports::global_options(ports_trace)
         }
     }
 
@@ -503,9 +515,9 @@
         set macports::portverbose "no"
         global macports::portverbose
     }
-    if {[info exists ui_options(ports_verbose)]} {
-        if {![string equal $ui_options(ports_verbose) $portverbose]} {
-            set macports::portverbose $ui_options(ports_verbose)
+    if {[info exists macports::ui_options(ports_verbose)]} {
+        if {![string equal $macports::ui_options(ports_verbose) $portverbose]} {
+            set macports::portverbose $macports::ui_options(ports_verbose)
         }
     }
 

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2007-09-25 21:03:56 UTC (rev 29497)
+++ trunk/base/src/port/port.tcl	2007-09-25 21:05:28 UTC (rev 29498)
@@ -46,40 +46,6 @@
 # ui_options(ports_verbose) - If set, output info messages (ui_info)
 # ui_options(ports_quiet) - If set, don't output "standard messages"
 
-proc ui_channels {priority} {
-    global ui_options
-    switch $priority {
-        debug {
-            if {[macports::ui_isset ui_options ports_debug]} {
-                return {stderr}
-            } else {
-                return {}
-            }
-        }
-        info {
-            if {[macports::ui_isset ui_options ports_verbose]} {
-                return {stdout}
-            } else {
-                return {}
-            }
-        }
-        msg {
-            if {[macports::ui_isset ui_options ports_quiet]} {
-                return {}
-            } else {
-                return {stdout}
-            }
-        }
-        error {
-            return {stderr}
-        }
-        default {
-            return {stdout}
-        }
-    }
-}
-
-
 # Standard procedures
 proc print_usage {args} {
     global cmdname
@@ -174,7 +140,7 @@
 # case we continue
 proc fatal_softcontinue s {
     global global_options
-    if {[macports::global_option_isset global_options ports_force]} {
+    if {[macports::global_option_isset ports_force]} {
         ui_error $s
         return -code continue
     } else {
@@ -190,7 +156,7 @@
     global ui_options
     upvar $name_status status_var 
     ui_error $msg
-    if {[macports::ui_isset ui_options ports_processall]} {
+    if {[macports::ui_isset ports_processall]} {
         set status_var 0
         return -code continue
     } else {
@@ -559,7 +525,7 @@
                 fatal "search for portname $portname failed: $result"
             }
             if {[llength $res] < 2} {
-                if {[macports::ui_isset ui_options ports_debug]} {
+                if {[macports::ui_isset ports_debug]} {
                     puts "$portname ($installed_compound is installed; the port was not found in the port index)"
                 }
                 continue
@@ -1186,7 +1152,7 @@
         }
         
         # Figure out whether to show field name
-        set quiet [macports::ui_isset ui_options ports_quiet]
+        set quiet [macports::ui_isset ports_quiet]
         if {$quiet} {
             set show_label 0
         }
@@ -1466,7 +1432,7 @@
 proc action_uninstall { action portlist opts } {
     global global_options
     set status 0
-    if {[macports::global_option_isset global_options port_uninstall_old]} {
+    if {[macports::global_option_isset port_uninstall_old]} {
         # if -u then uninstall all inactive ports
         # (union these to any other ports user has in the port list)
         set portlist [opUnion $portlist [get_inactive_ports]]
@@ -1493,7 +1459,7 @@
     set restrictedList 0
     set ilist {}
     
-    if { [llength $portlist] || ![macports::global_option_isset global_options ports_no_args]} {
+    if { [llength $portlist] || ![macports::global_option_isset ports_no_args]} {
         set restrictedList 1
         foreachport $portlist {
             set composite_version [composite_version $portversion [array get variations]]
@@ -1548,7 +1514,7 @@
     # If port names were supplied, limit ourselves to those ports, else check all installed ports
     set ilist {}
     set restrictedList 0
-    if { [llength $portlist] || ![macports::global_option_isset global_options ports_no_args]} {
+    if { [llength $portlist] || ![macports::global_option_isset ports_no_args]} {
         set restrictedList 1
         foreach portspec $portlist {
             array set port $portspec
@@ -1596,7 +1562,7 @@
                 break_softcontinue "search for portname $portname failed: $result" 1 status
             }
             if {[llength $res] < 2} {
-                if {[macports::ui_isset ui_options ports_debug]} {
+                if {[macports::ui_isset ports_debug]} {
                     puts "$portname ($installed_compound is installed; the port was not found in the port index)"
                 }
                 continue
@@ -1638,7 +1604,7 @@
                 }
                 
                 # Emit information
-                if {$comp_result < 0 || [macports::ui_isset ui_options ports_verbose]} {
+                if {$comp_result < 0 || [macports::ui_isset ports_verbose]} {
                 
                     if { $num_outdated == 0 } {
                         puts "The following installed ports are outdated:"
@@ -1796,7 +1762,7 @@
 proc action_search { action portlist opts } {
     global global_options
     set status 0
-    if {![llength $portlist] && [macports::global_option_isset global_options ports_no_args]} {
+    if {![llength $portlist] && [macports::global_option_isset ports_no_args]} {
         ui_error "You must specify a search pattern"
         return 1
     }
@@ -1847,7 +1813,7 @@
     set status 0
     
     # Default to list all ports if no portnames are supplied
-    if {![llength $portlist] && [macports::global_option_isset global_options ports_no_args]} {
+    if {![llength $portlist] && [macports::global_option_isset ports_no_args]} {
         add_to_portlist portlist [list name "-all-"]
     }
     
@@ -2409,7 +2375,7 @@
         if {$action_status == -999} break
 
         # If we're not in exit mode then ignore the status from the command
-        if { ![macports::ui_isset ui_options ports_exit] } {
+        if { ![macports::ui_isset ports_exit] } {
             set action_status 0
         }
     }
@@ -2526,7 +2492,7 @@
     }
 
     # Be noisy, if appropriate
-    set noisy [expr $isstdin && ![macports::ui_isset ui_options ports_quiet]]
+    set noisy [expr $isstdin && ![macports::ui_isset ports_quiet]]
     if { $noisy } {
         puts "MacPorts [macports::version]"
         puts "Entering interactive mode... (\"help\" for help, \"quit\" to quit)"
@@ -2557,7 +2523,7 @@
         if {$exit_status == -999} break
         
         # Ignore status unless we're in error-exit mode
-        if { ![macports::ui_isset ui_options ports_exit] } {
+        if { ![macports::ui_isset ports_exit] } {
             set exit_status 0
         }
     }
@@ -2604,7 +2570,7 @@
         }
 
         # Ignore status unless we're in error-exit mode
-        if { ![macports::ui_isset ui_options ports_exit] } {
+        if { ![macports::ui_isset ports_exit] } {
             set exit_status 0
         }
     }

Modified: trunk/base/src/port/portindex.tcl
===================================================================
--- trunk/base/src/port/portindex.tcl	2007-09-25 21:03:56 UTC (rev 29497)
+++ trunk/base/src/port/portindex.tcl	2007-09-25 21:05:28 UTC (rev 29498)
@@ -28,38 +28,6 @@
 # ui_options(ports_verbose) - If set, output info messages (ui_info)
 # ui_options(ports_quiet) - If set, don't output "standard messages"
 
-proc ui_channels {priority} {
-    switch $priority {
-        debug {
-            if {[macports::ui_isset ui_options ports_debug]} {
-                return {stderr}
-            } else {
-                return {}
-            }
-        }
-        info {
-            if {[macports::ui_isset ui_options ports_verbose]} {
-                return {stdout}
-            } else {
-                return {}
-            }
-        }
-        msg {
-            if {[macports::ui_isset ui_options ports_quiet]} {
-                return {}
-            } else {
-                return {stdout}
-            }
-        }
-        error {
-            return {stderr}
-        }
-        default {
-            return {stdout}
-        }
-    }
-}
-
 # Standard procedures
 proc print_usage args {
     global argv0

Modified: trunk/base/src/port/portmirror.tcl
===================================================================
--- trunk/base/src/port/portmirror.tcl	2007-09-25 21:03:56 UTC (rev 29497)
+++ trunk/base/src/port/portmirror.tcl	2007-09-25 21:05:28 UTC (rev 29498)
@@ -25,38 +25,6 @@
 # ui_options(ports_verbose) - If set, output info messages (ui_info)
 # ui_options(ports_quiet) - If set, don't output "standard messages"
 
-proc ui_channels {priority} {
-    switch $priority {
-        debug {
-            if {[macports::ui_isset ui_options ports_debug]} {
-                return {stderr}
-            } else {
-                return {}
-            }
-        }
-        info {
-            if {[macports::ui_isset ui_options ports_verbose]} {
-                return {stdout}
-            } else {
-                return {}
-            }
-        }
-        msg {
-            if {[macports::ui_isset ui_options ports_quiet]} {
-                return {}
-            } else {
-                return {stdout}
-            }
-        }
-        error {
-            return {stderr}
-        }
-        default {
-            return {stdout}
-        }
-    }
-}
-
 # Iterate on dist files.
 #
 # func:     function to call on every dist file (it is passed

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070925/5b1e7319/attachment.html


More information about the macports-changes mailing list