[70635] branches/gsoc10-gui/MacPorts_Framework
juanger at macports.org
juanger at macports.org
Sun Aug 15 12:20:37 PDT 2010
Revision: 70635
http://trac.macports.org/changeset/70635
Author: juanger at macports.org
Date: 2010-08-15 12:20:36 -0700 (Sun, 15 Aug 2010)
Log Message:
-----------
MacPorts 1.9 compatibility fixed.
Modified Paths:
--------------
branches/gsoc10-gui/MacPorts_Framework/init.tcl
branches/gsoc10-gui/MacPorts_Framework/interpInit.tcl
branches/gsoc10-gui/MacPorts_Framework/portProcessInit.tcl
Modified: branches/gsoc10-gui/MacPorts_Framework/init.tcl
===================================================================
--- branches/gsoc10-gui/MacPorts_Framework/init.tcl 2010-08-15 19:13:05 UTC (rev 70634)
+++ branches/gsoc10-gui/MacPorts_Framework/init.tcl 2010-08-15 19:20:36 UTC (rev 70635)
@@ -1,89 +1,14 @@
package require macports
package require notifications
-
-#Set ui_options to log all messages to stdout and notify system
-#filtering is done on the Obj-C side of things
-# set ui_options(ports_debug) "yes"
-set ui_options(ports_verbose) "yes"
-
-# ui_options accessor
-proc ui_isset {val} {
- global ui_options
- if {[info exists ui_options($val)]} {
- if {$ui_options($val) == "yes"} {
- return 1
- }
- }
- return 0
-}
-
-# UI Callback
-proc ui_prefix {priority} {
+proc ui_init {priority prefix channels message} {
switch $priority {
- debug {
- return ""
- }
- error {
- return "Error: "
- }
- warn {
- return "Warning: "
- }
- default {
- return ""
- }
- }
-}
-
-proc ui_channels {priority} {
- global logfd
- switch $priority {
- debug {
- if {[ui_isset ports_debug]} {
- return {stderr}
- } else {
- return {}
- }
- }
- info {
- if {[ui_isset ports_verbose]} {
- return {stdout}
- } else {
- return {}
- }
- }
- msg {
- if {[ui_isset ports_quiet]} {
- return {}
- } else {
- return {stdout}
- }
- }
- error {
- return {stderr}
- }
- default {
- return {stdout}
- }
- }
-}
-
-
-
-
-#Modifying UI initialization to enable notifications
-#Redefine ui_$pritority to throw global notifications
-#This is currently under works ... a reasonable solution
-#should be coming up soon
-proc macports::ui_init {priority args} {
- switch $priority {
msg {
set nottype "MPMsgNotification"
}
debug {
set nottype "MPDebugNotification"
- puts "Recieved Debug"
+ puts "Recieved Debug init"
}
warn {
set nottype "MPWarnNotification"
@@ -100,67 +25,20 @@
set nottype "MPDefaultNotification"
}
}
-
- # Get the list of channels.
- if {[llength [info commands ui_channels]] > 0} {
- set channels [ui_channels $priority]
- } else {
- set channels [ui_channels_default $priority]
- }
- # Simplify ui_$priority.
- set nbchans [llength $channels]
- if {$nbchans == 0} {
- proc ::ui_$priority {args} [subst {
- notifications send $nottype "$chan $prefix" "\$str"
- }]
- } else {
- if {[llength [info commands ui_prefix]] > 0} {
- set prefix [ui_prefix $priority]
- } else {
- set prefix [ui_prefix_default $priority]
- }
-
- if {[llength [info commands ::ui_init]] > 0} {
- eval ::ui_init $priority $prefix $channels $args
- } else {
- if {$nbchans == 1} {
- set chan [lindex $channels 0]
- proc ::ui_$priority {args} [subst {
- if {\[lindex \$args 0\] == "-nonewline"} {
- puts $chan "$prefix\[lindex \$args 1\]"
- notifications send $nottype "$chan $prefix" "\[lindex \$args 1\]"
- } else {
- puts -nonewline $chan "$prefix\[lindex \$args 1\]"
- notifications send $nottype "$chan $prefix" "\[lindex \$args 0\]"
- }
- }]
- } else {
- proc ::ui_$priority {args} [subst {
- foreach chan \$channels {
- if {\[lindex \$args 0\] == "-nonewline"} {
- puts $chan "$prefix\[lindex \$args 1\]"
- notifications send $nottype "$chan $prefix" "\[lindex \$args 1\]"
- } else {
- puts -nonewline $chan "$prefix\[lindex \$args 1\]"
- notifications send $nottype "$chan $prefix" "\[lindex \$args 0\]"
- }
- }
- }]
- }
- }
-
- # Call ui_$priority
- eval ::ui_$priority $args
- }
+ proc ::ui_$priority {message} [subst {
+ notifications send $nottype "$channels($priority) $prefix" "\$message"
+ ui_message $priority $prefix "" "\$message"
+ }]
}
+
#Wrapping the following API routines to catch errors
#and log error Information in a similar fashion to code
#in macports.tcl.
proc mportuninstall {portname {v ""} {optionslist ""}} {
- if {[catch {portuninstall::uninstall $portname $v $optionslist} result]} {
+ if {[catch {registry_uninstall::uninstall $portname $v $optionslist} result]} {
global errorInfo
ui_debug "$errorInfo"
Modified: branches/gsoc10-gui/MacPorts_Framework/interpInit.tcl
===================================================================
--- branches/gsoc10-gui/MacPorts_Framework/interpInit.tcl 2010-08-15 19:13:05 UTC (rev 70634)
+++ branches/gsoc10-gui/MacPorts_Framework/interpInit.tcl 2010-08-15 19:20:36 UTC (rev 70635)
@@ -2,169 +2,44 @@
package require simplelog
-
-#Set ui_options to log all messages to stdout and notify system
-#filtering is done on the Obj-C side of things
-set ui_options(ports_debug) "yes"
-set ui_options(ports_verbose) "yes"
-
-# ui_options accessor
-proc ui_isset {val} {
- global ui_options
- if {[info exists ui_options($val)]} {
- if {$ui_options($val) == "yes"} {
- return 1
- }
- }
- return 0
-}
-
-# UI Callback
-proc ui_prefix {priority} {
+proc ui_init {priority prefix channels message} {
switch $priority {
- debug {
- return "DEBUG: "
- }
- error {
- return "Error: "
- }
- warn {
- return "Warning: "
- }
- default {
- return ""
- }
- }
-}
+ msg {
+ set nottype "MPMsgNotification"
+ }
+ debug {
+ set nottype "MPDebugNotification"
+ puts "Recieved Debug init"
+ }
+ warn {
+ set nottype "MPWarnNotification"
+ }
+ error {
+ set nottype "MPErrorNotification"
+ puts "Recieved Error"
+ }
+ info {
+ set nottype "MPInfoNotification"
+ puts "Recieved Info"
+ }
+ default {
+ set nottype "MPDefaultNotification"
+ }
+ }
-proc ui_channels {priority} {
- global logfd
- switch $priority {
- debug {
- if {[ui_isset ports_debug]} {
- return {stderr}
- } else {
- return {}
- }
- }
- info {
- if {[ui_isset ports_verbose]} {
- return {stdout}
- } else {
- return {}
- }
- }
- msg {
- if {[ui_isset ports_quiet]} {
- return {}
- } else {
- return {stdout}
- }
- }
- error {
- return {stderr}
- }
- default {
- return {stdout}
- }
- }
+ proc ::ui_$priority {message} [subst {
+ simplelog "$nottype $channels($priority) $prefix" "\$message"
+ ui_message $priority $prefix "" "\$message"
+ }]
}
-
-#Modifying UI initialization to enable notifications
-#Redefine ui_$pritority to throw global notifications
-#This is currently under works ... a reasonable solution
-#should be coming up soon
-proc macports::ui_init {priority args} {
- switch $priority {
- msg {
- set nottype "MPMsgNotification"
- }
- debug {
- set nottype "MPDebugNotification"
- puts "Recieved Debug"
- }
- warn {
- set nottype "MPWarnNotification"
- }
- error {
- set nottype "MPErrorNotification"
- puts "Recieved Error"
- }
- info {
- set nottype "MPInfoNotification"
- puts "Recieved Info"
- }
- default {
- set nottype "MPDefaultNotification"
- }
- }
-
- # Get the list of channels.
- if {[llength [info commands ui_channels]] > 0} {
- set channels [ui_channels $priority]
- } else {
- set channels [ui_channels_default $priority]
- }
-
- #set channels [ui_channels $priority]
-
- # Simplify ui_$priority.
- set nbchans [llength $channels]
- if {$nbchans == 0} {
- proc ::ui_$priority {str} [subst {
- simplelog "$nottype $chan $prefix" "\$str"
- }]
- } else {
- if {[llength [info commands ui_prefix]] > 0} {
- set prefix [ui_prefix $priority]
- } else {
- set prefix [ui_prefix_default $priority]
- }
-
- if {[llength [info commands ::ui_init]] > 0} {
- eval ::ui_init $priority $prefix $channels $args
- } else {
- if {$nbchans == 1} {
- set chan [lindex $channels 0]
-
- proc ::ui_$priority {args} [subst {
- if {\[lindex \$args 0\] == "-nonewline"} {
- puts $chan "$prefix\[lindex \$args 1\]"
- simplelog "$nottype $chan $prefix" "\[lindex \$args 1\]"
- } else {
- puts -nonewline $chan "$prefix\[lindex \$args 1\]"
- simplelog "$nottype $chan $prefix" "\[lindex \$args 0\]"
- }
- }]
- } else {
- proc ::ui_$priority {args} [subst {
- foreach chan \$channels {
- if {\[lindex \$args 0\] == "-nonewline"} {
- puts $chan "$prefix\[lindex \$args 1\]"
- simplelog "$nottype $chan $prefix" "\[lindex \$args 1\]"
- } else {
- puts -nonewline $chan "$prefix\[lindex \$args 1\]"
- simplelog "$nottype $chan $prefix" "\[lindex \$args 0\]"
- }
- }
- }]
- }
- }
-
- # Call ui_$priority
- eval ::ui_$priority $args
- }
-}
-
-
#Wrapping the following API routines to catch errors
#and log error Information in a similar fashion to code
#in macports.tcl. Note optionslist is not being used for now
set mp_empty_list [list]
proc mportuninstall {portname {v ""} {optionslist ""} } {
- if {[catch {portuninstall::uninstall $portname $v [array get options]} result]} {
+ if {[catch {registry_uninstall::uninstall $portname $v [array get options]} result]} {
global errorInfo
ui_debug "$errorInfo"
Modified: branches/gsoc10-gui/MacPorts_Framework/portProcessInit.tcl
===================================================================
--- branches/gsoc10-gui/MacPorts_Framework/portProcessInit.tcl 2010-08-15 19:13:05 UTC (rev 70634)
+++ branches/gsoc10-gui/MacPorts_Framework/portProcessInit.tcl 2010-08-15 19:20:36 UTC (rev 70635)
@@ -2,88 +2,14 @@
package require simplelog
-
-#Set ui_options to log all messages to stdout and notify system
-#filtering is done on the Obj-C side of things
-set ui_options(ports_debug) "yes"
-set ui_options(ports_verbose) "yes"
-
-# ui_options accessor
-proc ui_isset {val} {
- global ui_options
- if {[info exists ui_options($val)]} {
- if {$ui_options($val) == "yes"} {
- return 1
- }
- }
- return 0
-}
-
-# UI Callback
-proc ui_prefix {priority} {
+proc ui_init {priority prefix channels message} {
switch $priority {
- debug {
- return "DEBUG: "
- }
- error {
- return "Error: "
- }
- warn {
- return "Warning: "
- }
- default {
- return ""
- }
- }
-}
-
-proc ui_channels {priority} {
- global logfd
- switch $priority {
- debug {
- if {[ui_isset ports_debug]} {
- return {stderr}
- } else {
- return {}
- }
- }
- info {
- if {[ui_isset ports_verbose]} {
- return {stdout}
- } else {
- return {}
- }
- }
- msg {
- if {[ui_isset ports_quiet]} {
- return {}
- } else {
- return {stdout}
- }
- }
- error {
- return {stderr}
- }
- default {
- return {stdout}
- }
- }
-}
-
-
-
-#Modifying UI initialization to enable notifications
-#Redefine ui_$pritority to throw global notifications
-#This is currently under works ... a reasonable solution
-#should be coming up soon
-proc macports::ui_init {priority args} {
- switch $priority {
msg {
set nottype "MPMsgNotification"
}
debug {
set nottype "MPDebugNotification"
- puts "Recieved Debug"
+ puts "Recieved Debug init"
}
warn {
set nottype "MPWarnNotification"
@@ -100,59 +26,11 @@
set nottype "MPDefaultNotification"
}
}
-
- # Get the list of channels.
- if {[llength [info commands ui_channels]] > 0} {
- set channels [ui_channels $priority]
- } else {
- set channels [ui_channels_default $priority]
- }
- # Simplify ui_$priority.
- set nbchans [llength $channels]
- if {$nbchans == 0} {
- proc ::ui_$priority {args} [subst {
- simplelog "$nottype $chan $prefix" "\$str"
- }]
- } else {
- if {[llength [info commands ui_prefix]] > 0} {
- set prefix [ui_prefix $priority]
- } else {
- set prefix [ui_prefix_default $priority]
- }
-
- if {[llength [info commands ::ui_init]] > 0} {
- eval ::ui_init $priority $prefix $channels $args
- } else {
- if {$nbchans == 1} {
- set chan [lindex $channels 0]
- proc ::ui_$priority {args} [subst {
- if {\[lindex \$args 0\] == "-nonewline"} {
- puts $chan "$prefix\[lindex \$args 1\]"
- simplelog "$nottype $chan $prefix" "\[lindex \$args 1\]"
- } else {
- puts -nonewline $chan "$prefix\[lindex \$args 1\]"
- simplelog "$nottype $chan $prefix" "\[lindex \$args 0\]"
- }
- }]
- } else {
- proc ::ui_$priority {args} [subst {
- foreach chan \$channels {
- if {\[lindex \$args 0\] == "-nonewline"} {
- puts $chan "$prefix\[lindex \$args 1\]"
- simplelog "$nottype $chan $prefix" "\[lindex \$args 1\]"
- } else {
- puts -nonewline $chan "$prefix\[lindex \$args 1\]"
- simplelog "$nottype $chan $prefix" "\[lindex \$args 0\]"
- }
- }
- }]
- }
- }
-
- # Call ui_$priority
- eval ::ui_$priority $args
- }
+ proc ::ui_$priority {message} [subst {
+ simplelog "$nottype $channels($priority) $prefix" "\$message"
+ ui_message $priority $prefix "" "\$message"
+ }]
}
@@ -161,7 +39,7 @@
#in macports.tcl. Note optionslist is not being used for now
set mp_empty_list [list]
proc mportuninstall {portname {v ""} {optionslist ""} } {
- if {[catch {portuninstall::uninstall $portname $v [array get options]} result]} {
+ if {[catch {registry_uninstall::uninstall $portname $v [array get options]} result]} {
global errorInfo
ui_debug "$errorInfo"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100815/0e8b78d1/attachment-0001.html>
More information about the macports-changes
mailing list