[70011] branches/gsoc10-gui
tzikis at macports.org
tzikis at macports.org
Mon Jul 26 04:08:33 PDT 2010
Revision: 70011
http://trac.macports.org/changeset/70011
Author: tzikis at macports.org
Date: 2010-07-26 04:08:32 -0700 (Mon, 26 Jul 2010)
Log Message:
-----------
Moved the default_variants checking from the Framework to Pallet. This way, we don't call it while loading for every port, but every time we choose install_with_variants instead.
Modified Paths:
--------------
branches/gsoc10-gui/MacPorts_Framework/MPInterpreter.m
branches/gsoc10-gui/Pallet/MPActionsController.m
Modified: branches/gsoc10-gui/MacPorts_Framework/MPInterpreter.m
===================================================================
--- branches/gsoc10-gui/MacPorts_Framework/MPInterpreter.m 2010-07-26 11:04:46 UTC (rev 70010)
+++ branches/gsoc10-gui/MacPorts_Framework/MPInterpreter.m 2010-07-26 11:08:32 UTC (rev 70011)
@@ -368,11 +368,6 @@
int tclCount;
int tclResult;
int i;
-
- if([list rangeOfString:@"depends_run"].location != NSNotFound)
- {
- //NSLog(@"%@", list);
- }
const char **tclElements;
tclResult = Tcl_SplitList(_interpreter, [list UTF8String], &tclCount, &tclElements);
if (tclResult == TCL_OK) {
Modified: branches/gsoc10-gui/Pallet/MPActionsController.m
===================================================================
--- branches/gsoc10-gui/Pallet/MPActionsController.m 2010-07-26 11:04:46 UTC (rev 70010)
+++ branches/gsoc10-gui/Pallet/MPActionsController.m 2010-07-26 11:08:32 UTC (rev 70011)
@@ -94,15 +94,41 @@
}
//NSLog(@"Port variants:");
- NSArray *defaultsArray = [port valueForKey:@"default_variants"];
- //defaultsArray = [NSArray arrayWithObject:@"universal"];
- NSLog(@"Default variants count: %i", [defaultsArray count]);
+ //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, [[port 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]);
for(UInt i=0; i<[[port valueForKey:@"variants"] count];i++)
{
//NSLog(@"%@",[[port valueForKey:@"variants"] objectAtIndex:i]);
- if(defaultsArray != nil && [defaultsArray indexOfObject:[[port valueForKey:@"variants"] objectAtIndex:i]] != NSNotFound)
+ if(defaultVariants != nil && [defaultVariants indexOfObject:[[port valueForKey:@"variants"] objectAtIndex:i]] != NSNotFound)
{
//NSLog(@"Default %@", [[port valueForKey:@"variants"] objectAtIndex:i]);
[checkboxes[i] setState:NSOnState];
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100726/1c68503a/attachment.html>
More information about the macports-changes
mailing list