[39291] branches/gsoc08-framework/MacPorts_Framework_Release

armahg at macports.org armahg at macports.org
Sat Aug 16 00:16:03 PDT 2008


Revision: 39291
          http://trac.macosforge.org/projects/macports/changeset/39291
Author:   armahg at macports.org
Date:     2008-08-16 00:16:02 -0700 (Sat, 16 Aug 2008)
Log Message:
-----------
Was able to perform my first --important-- port operation using MacPorts.Framework. Namely, the installation of pngcrush port. Need to do more thorough testing of more complex ports in subsequent code

Modified Paths:
--------------
    branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.m
    branches/gsoc08-framework/MacPorts_Framework_Release/MPPortManipulationTest.m

Modified: branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.m
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.m	2008-08-16 04:11:19 UTC (rev 39290)
+++ branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.m	2008-08-16 07:16:02 UTC (rev 39291)
@@ -151,7 +151,7 @@
 	//Should I be sending self as the object? Or should I send a newly created
 	//copy? What if the listener modifies this object? 
 	[[NSDistributedNotificationCenter defaultCenter] postNotificationName:notificationName 
-																   object:self]; 
+																   object:nil]; 
 }
 
 
@@ -218,10 +218,8 @@
 	
 	[interpreter evaluateStringWithPossiblePrivileges:
 	 [NSString stringWithFormat:
-	  @"set portHandle [mportopen  %@  %@  %@]; \
-	  mportexec portHandle %@; \
-	  mportclose portHandle", 
-	  [self valueForKey:@"portURL"], opts, vrnts, target]
+	  @"set portHandle [mportopen  %@  %@  %@]; mportexec  $portHandle %@; mportclose $portHandle", 
+	  [self valueForKey:@"porturl"], opts, vrnts, target]
 								  error:execError];
 	
 	[[MPNotifications sharedListener] setPerformingTclCommand:@""];

Modified: branches/gsoc08-framework/MacPorts_Framework_Release/MPPortManipulationTest.m
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework_Release/MPPortManipulationTest.m	2008-08-16 04:11:19 UTC (rev 39290)
+++ branches/gsoc08-framework/MacPorts_Framework_Release/MPPortManipulationTest.m	2008-08-16 07:16:02 UTC (rev 39291)
@@ -21,19 +21,37 @@
 }
 
 -(void) testSimpleSearch {
-	NSDictionary * searchResult = [mainPort search:@"sphinx"];
-	NSLog(@"\n\nPrinting search results for \"sphinx\"");
+	NSDictionary * searchResult = [mainPort search:@"pngcrush"];
+	NSArray * keyArray = [searchResult allKeys];
+	//NSLog(@"\n\nPrinting search results for \"sphinx\"");
 	
-	NSLog(@" %@ ", [searchResult allKeys]);
-	NSLog(@" %@ ", [searchResult allValues]);
+	//NSLog(@" %@ ", keyArray);
+	//NSLog(@" %@ ", [searchResult allValues]);
 	
 	id key;
 	NSEnumerator * k = [searchResult keyEnumerator];
 	while ( key = [k nextObject]) {
-		NSLog(@"\n\n Key: %@ \n\n MPPort object: %@ \n\n", key, [searchResult objectForKey:key]);
+		//NSLog(@"\n\n Key: %@ \n\n MPPort object: %@ \n\n", key, [searchResult objectForKey:key]);
 	}
 	
-	NSLog(@"\n\nDone searching for \"sphinx\"\n\n");
+	//NSLog(@"\n\nDone searching for \"sphinx\"\n\n");
+	
+	NSLog(@"\n\n Installing first result from search %@ \n\n", [searchResult objectForKey:[keyArray objectAtIndex:0]]);
+	NSError * iError;
+	[[searchResult objectForKey:[keyArray objectAtIndex:0]] installWithOptions:nil variants:nil error:&iError];
+	
+	//How do we check if a port is installed? Should the methods return BOOL's instead?
+	if (iError != nil) {
+		NSLog(@"\n\n Installation of %@ failed \n\n", [keyArray objectAtIndex:0]);
+	}
+	else{
+		NSLog(@"\n\n Installation successful \n\n");
+		//Double check somehow
+		MPRegistry * registry = [MPRegistry sharedRegistry];
+		NSLog(@"\n\n Result from registry is %@ \n\n", [registry installed:[keyArray objectAtIndex:0]]);
+		
+	}
+	
 }
 
 @end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080816/4bafbbd2/attachment-0001.html 


More information about the macports-changes mailing list