[72222] contrib/MacPorts_Framework
juanger at macports.org
juanger at macports.org
Thu Oct 7 13:27:03 PDT 2010
Revision: 72222
http://trac.macports.org/changeset/72222
Author: juanger at macports.org
Date: 2010-10-07 13:27:00 -0700 (Thu, 07 Oct 2010)
Log Message:
-----------
Merging tzikis work during gsoc-10
Modified Paths:
--------------
contrib/MacPorts_Framework/MPHelperTool.m
contrib/MacPorts_Framework/MPPort.h
contrib/MacPorts_Framework/MPPort.m
contrib/MacPorts_Framework/MPPortProcess.m
contrib/MacPorts_Framework/MacPorts.Framework.xcodeproj/project.pbxproj
contrib/MacPorts_Framework/init.tcl
contrib/MacPorts_Framework/interpInit.tcl
contrib/MacPorts_Framework/portProcessInit.tcl
Property Changed:
----------------
contrib/MacPorts_Framework/
Property changes on: contrib/MacPorts_Framework
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/gsoc09-gui/MacPorts_Framework:50819-65490
+ /branches/gsoc09-gui/MacPorts_Framework:50819-65490
/branches/gsoc10-gui/MacPorts_Framework:67321-72221
Modified: contrib/MacPorts_Framework/MPHelperTool.m
===================================================================
--- contrib/MacPorts_Framework/MPHelperTool.m 2010-10-07 18:40:53 UTC (rev 72221)
+++ contrib/MacPorts_Framework/MPHelperTool.m 2010-10-07 20:27:00 UTC (rev 72222)
@@ -59,6 +59,7 @@
//I'll save that here when retrieving info.
//fromt he request dictionary
int notificationsFileDescriptor;
+static int hasInstalledSignalToSocket = 0;
BOOL hasSetFileDescriptor = NO;
NSString * ipcFilePath;
@@ -590,7 +591,7 @@
}
// Organise to have SIGINT delivered to a runloop callback.
- if (err == 0) {
+ if (err == 0 && hasInstalledSignalToSocket == 0) {
sigset_t justSIGINT;
(void) sigemptyset(&justSIGINT);
@@ -603,6 +604,8 @@
SIGINTRunLoopCallback,
NULL
);
+
+ hasInstalledSignalToSocket = 1;
//asl_NSLog(logClient , logMsg, ASL_LEVEL_DEBUG, @"MPHelperTool: IgnoreSigPipe Successful");
[ASLLogger logString:@"MPHelperTool: IgnoreSigPipe Successful"];
}
@@ -657,7 +660,7 @@
}
// Organise to have SIGINT delivered to a runloop callback.
- if (err == 0) {
+ if (err == 0 && hasInstalledSignalToSocket == 0) {
sigset_t justSIGINT;
(void) sigemptyset(&justSIGINT);
@@ -670,6 +673,9 @@
SIGINTRunLoopCallback,
NULL
);
+
+ hasInstalledSignalToSocket = 1;
+
[ASLLogger logString:@"MPHelperTool: IgnoreSigPipe Successful"];
}
Modified: contrib/MacPorts_Framework/MPPort.h
===================================================================
--- contrib/MacPorts_Framework/MPPort.h 2010-10-07 18:40:53 UTC (rev 72221)
+++ contrib/MacPorts_Framework/MPPort.h 2010-10-07 20:27:00 UTC (rev 72222)
@@ -149,6 +149,16 @@
/*!
+ @brief Computes the NSMutableArray object for key "defaults_variants" of the port
+ */
+- (void)checkDefaults;
+
+/*!
+ @brief Computes the conflicts of the port
+ */
+- (void)checkConflicts;
+
+/*!
@brief Executes the specified target for this MPPort
@param target NSString target to be executed for this MPPort
@param options An NSArray of NSStrings for the various options for this target
Modified: contrib/MacPorts_Framework/MPPort.m
===================================================================
--- contrib/MacPorts_Framework/MPPort.m 2010-10-07 18:40:53 UTC (rev 72221)
+++ contrib/MacPorts_Framework/MPPort.m 2010-10-07 20:27:00 UTC (rev 72222)
@@ -90,6 +90,12 @@
// tokenize the properties
// create sets of the depends_* tokenized properties that contain only the dependency name, not the dependency type
// make the descriptions readable
+
+ if([string rangeOfString:@"default_variants"].location != NSNotFound)
+ {
+ NSLog(@"%@", string);
+ }
+
if ([self objectForKey:@"maintainers"] != nil) {
[self setObject:[self objectForKey:@"maintainers"] forKey:@"maintainersAsString"];
[self setObject:[interpreter arrayFromTclListAsString:[self objectForKey:@"maintainers"]] forKey:@"maintainers"];
@@ -117,7 +123,25 @@
[self setObject:[interpreter arrayFromTclListAsString:[self objectForKey:@"depends_run"]] forKey:@"depends_run"];
[self addDependencyAsPortName:@"depends_run"];
}
+ if ([self objectForKey:@"depends_fetch"] != nil) {
+ [self setObject:[self objectForKey:@"depends_fetch"] forKey:@"depends_fetchAsString"];
+ [self setObject:[interpreter arrayFromTclListAsString:[self objectForKey:@"depends_fetch"]] forKey:@"depends_fetch"];
+ [self addDependencyAsPortName:@"depends_fetch"];
+ }
+ if ([self objectForKey:@"depends_extract"] != nil) {
+ [self setObject:[self objectForKey:@"depends_extract"] forKey:@"depends_extractAsString"];
+ [self setObject:[interpreter arrayFromTclListAsString:[self objectForKey:@"depends_extract"]] forKey:@"depends_extract"];
+ [self addDependencyAsPortName:@"depends_extract"];
+ }
+ //Code for fetching default variants
+ if ([self objectForKey:@"default_variants"] != nil) {
+ //NSLog(@"Default Variants str: %@", string);
+ [self setObject:[self objectForKey:@"default_variants"] forKey:@"default_variantsAsString"];
+ [self setObject:[interpreter arrayFromTclListAsString:[self objectForKey:@"default_variants"]] forKey:@"default_variants"];
+ }
+
+
@try {
if ([[self valueForKey:@"description"] characterAtIndex:0] == '{') {
[self setValue:[self valueForKey:@"description"] forKey:@"description"];
@@ -247,25 +271,39 @@
variants:(NSArray *)variants
error:(NSError **)execError{
- NSString *opts;
- NSString *vrnts;
+ NSMutableString *opts;
+ NSMutableString *vrnts;
MPInterpreter *interpreter;
- opts = [NSString stringWithString:@" "];
- vrnts = [NSString stringWithString:@" "];
+ opts = [NSMutableString stringWithCapacity:50];
+ [opts setString:@"{ "];
+ vrnts = [NSMutableString stringWithCapacity:50];
+ [vrnts setString:@"{ "];
interpreter = [MPInterpreter sharedInterpreter];
+
if (options != NULL) {
- opts = [NSString stringWithString:[options componentsJoinedByString:@" "]];
+ [opts appendString: [NSString stringWithString:[options componentsJoinedByString:@" "]]];
}
+
+ [opts appendString: @" }"];
+
if (variants != NULL) {
- vrnts = [NSString stringWithString:[variants componentsJoinedByString:@" "]];
+ [vrnts appendString: [NSString stringWithString:[variants componentsJoinedByString:@" "]]];
}
+ [vrnts appendString: @" }"];
+
+ //NSLog(@"Variants String: %@", vrnts);
//Send Global Notifications and update MPNotifications variable
[self sendGlobalExecNotification:target withStatus:@"Started"];
//NSString * tclCmd = [@"YES_" stringByAppendingString:target];
[[MPNotifications sharedListener] setPerformingTclCommand:target];
+ /*
+ NSLog(@"Interpreter string:\n%@",[NSString stringWithFormat:
+ @"set portHandle [mportopen %@ %@ %@]; mportexec $portHandle %@; mportclose $portHandle",
+ [self valueForKey:@"porturl"], opts, vrnts, target]);
+ */
[interpreter evaluateStringWithPossiblePrivileges:
[NSString stringWithFormat:
@"set portHandle [mportopen %@ %@ %@]; mportexec $portHandle %@; mportclose $portHandle",
@@ -351,6 +389,108 @@
[self execPortProc:@"mportupgrade" withOptions:nil version:@"" error:mError];
}
+//This function is called to initialize the array for the'default_variants' key for a port, which we can't do for all ports when loading
+- (void)checkDefaults
+{
+ //Check for default variants only if this is the first time we are checking
+ if ([self objectForKey:@"default_variants"] == nil)
+ {
+ //NSArray *defaultVariants = [port valueForKey:@"defaultVariants"];
+ NSMutableArray *defaultVariants= [NSMutableArray arrayWithCapacity:10];
+ char port_command[256];
+
+ //Build the port variants command
+ strcpy(port_command, "port variants ");
+ strcat(port_command, [[self objectForKey:@"name"] cStringUsingEncoding: NSASCIIStringEncoding]);
+ strcat(port_command, " | grep \"\\[+]\" | sed 's/.*\\]//; s/:.*//' >> mpfw_default_variants");
+
+ //Make the CLI call
+ system(port_command);
+ //Open the output file
+ FILE * file = fopen("mpfw_default_variants", "r");
+
+ //Read all default_variants
+ char buffer[256];
+ while(!feof(file))
+ {
+ char * temp = fgets(buffer,256,file);
+ if(temp == NULL) continue;
+ buffer[strlen(buffer)-1]='\0';
+ //Add the variant in the Array
+ [defaultVariants addObject:[NSString stringWithCString:buffer]];
+ }
+ //Close and delete
+ fclose(file);
+ unlink("mpfw_default_variants");
+
+ NSLog(@"Default variants count: %i", [defaultVariants count]);
+ //Code for fetching default variants
+ [self setObject:[NSString stringWithString:[defaultVariants componentsJoinedByString:@" "]] forKey:@"default_variantsAsString"];
+ [self setObject:defaultVariants forKey:@"default_variants"];
+ }
+
+}
+
+//This function is called to initiate the conflicts for a specific port, which we can't do for all ports when loading, much like
+//the default_variants
+- (void)checkConflicts;
+{
+ //Check for only if this is the first time we are checking
+ if ([self objectForKey:@"conflicts"] == nil)
+ {
+
+ NSMutableArray *conflicts = [NSMutableArray arrayWithCapacity:20];
+
+ char *script= " | python -c \"import re,sys;lines=sys.stdin.readlines();print '\\n'.join('%s,%s' % (re.sub(r'[\\W]','',lines[i-1].split()[0].rstrip(':')),','.join(l.strip().split()[3:])) for i, l in enumerate(lines) if l.strip().startswith('* conflicts'))\" >> /tmp/mpfw_conflict";
+ char command[512];
+ strcpy(command,"port variants ");
+ strcat(command, [[self name] UTF8String]);
+ strcat(command, script);
+ //printf("\n%s\n", command);
+ system(command);
+
+ //Open the output file
+ FILE * file = fopen("/tmp/mpfw_conflict", "r");
+
+ //Read all conflicts
+ char buffer[256];
+ while(!feof(file))
+ {
+ char * temp = fgets(buffer,256,file);
+ if(temp == NULL) continue;
+ buffer[strlen(buffer)-1]='\0';
+ //Add the variant in the Array
+ //printf("buffer:\n%s\n",buffer);
+
+ char *token;
+ char *search = ",";
+
+ token = strtok(buffer, search);
+ //printf("token: %s\n",token);
+ if(token == NULL) break;
+
+ NSString *variant = [NSString stringWithCString:token];
+ NSMutableArray *conflictsWith=[NSMutableArray arrayWithCapacity:10];
+ NSLog(@"%@", variant);
+ while ((token = strtok(NULL, search)) != NULL)
+ {
+ NSLog(@"token: %@",[NSString stringWithCString:token]);
+ [conflictsWith addObject:[NSString stringWithCString:token]];
+ //NSLog(@"count %i",[[checkboxes[i] conflictsWith] count]);
+ }
+
+ NSDictionary *variantConflictsWith = [NSDictionary dictionaryWithObject:conflictsWith forKey:variant];
+ [conflicts addObject:variantConflictsWith];
+ //[defaultVariants addObject:[NSString stringWithCString:buffer]];
+ }
+ //Close and delete
+ fclose(file);
+ unlink("/tmp/mpfw_conflict");
+
+ [self setObject:conflicts forKey:@"conflicts"];
+ }
+}
+
-(void)configureWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError {
[self exec:@"configure" withOptions:options variants:variants error:mError];
}
Modified: contrib/MacPorts_Framework/MPPortProcess.m
===================================================================
--- contrib/MacPorts_Framework/MPPortProcess.m 2010-10-07 18:40:53 UTC (rev 72221)
+++ contrib/MacPorts_Framework/MPPortProcess.m 2010-10-07 20:27:00 UTC (rev 72222)
@@ -81,7 +81,6 @@
NSConnection *portProcessConnection;
portProcessConnection = [NSConnection defaultConnection];
NSString *PKGPath = [[NSString alloc] initWithCString:argv[1] encoding:NSUTF8StringEncoding];
-// NSString *portProcessInitPath = [[NSString alloc] initWithCString:argv[2] encoding:NSUTF8StringEncoding];
MPPortProcess *portProcess = [[MPPortProcess alloc] initWithPKGPath:PKGPath];
Modified: contrib/MacPorts_Framework/MacPorts.Framework.xcodeproj/project.pbxproj
===================================================================
--- contrib/MacPorts_Framework/MacPorts.Framework.xcodeproj/project.pbxproj 2010-10-07 18:40:53 UTC (rev 72221)
+++ contrib/MacPorts_Framework/MacPorts.Framework.xcodeproj/project.pbxproj 2010-10-07 20:27:00 UTC (rev 72222)
@@ -705,7 +705,14 @@
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "MacPorts.Framework" */;
compatibilityVersion = "Xcode 2.4";
+ developmentRegion = English;
hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
mainGroup = 0867D691FE84028FC02AAC07 /* MacPorts Foundation */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
Modified: contrib/MacPorts_Framework/init.tcl
===================================================================
--- contrib/MacPorts_Framework/init.tcl 2010-10-07 18:40:53 UTC (rev 72221)
+++ contrib/MacPorts_Framework/init.tcl 2010-10-07 20:27:00 UTC (rev 72222)
@@ -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 "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,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: contrib/MacPorts_Framework/interpInit.tcl
===================================================================
--- contrib/MacPorts_Framework/interpInit.tcl 2010-10-07 18:40:53 UTC (rev 72221)
+++ contrib/MacPorts_Framework/interpInit.tcl 2010-10-07 20:27:00 UTC (rev 72222)
@@ -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: contrib/MacPorts_Framework/portProcessInit.tcl
===================================================================
--- contrib/MacPorts_Framework/portProcessInit.tcl 2010-10-07 18:40:53 UTC (rev 72221)
+++ contrib/MacPorts_Framework/portProcessInit.tcl 2010-10-07 20:27:00 UTC (rev 72222)
@@ -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/20101007/c12c2f89/attachment-0001.html>
More information about the macports-changes
mailing list