[57188] branches/gsoc09-gui/MacPorts_Framework

juanger at macports.org juanger at macports.org
Sun Sep 6 22:35:59 PDT 2009


Revision: 57188
          http://trac.macports.org/changeset/57188
Author:   juanger at macports.org
Date:     2009-09-06 22:35:58 -0700 (Sun, 06 Sep 2009)
Log Message:
-----------
Now the port state is updated after a port operation is run.

Modified Paths:
--------------
    branches/gsoc09-gui/MacPorts_Framework/MPPort.m
    branches/gsoc09-gui/MacPorts_Framework/MPRegistry.h

Modified: branches/gsoc09-gui/MacPorts_Framework/MPPort.m
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPPort.m	2009-09-07 05:30:55 UTC (rev 57187)
+++ branches/gsoc09-gui/MacPorts_Framework/MPPort.m	2009-09-07 05:35:58 UTC (rev 57188)
@@ -230,7 +230,13 @@
 		  procedure, [self name], v, opts]
 													error:execError];		
 	}
-	
+    // I must get the new state of the port from the registry
+	// instead of just [self setState:MPPortStateLearnState];
+    //NSArray *receipts  = [[[MPRegistry sharedRegistry] installed:[self name]] objectForKey:[self name]];
+    //[self setStateFromReceipts:receipts];
+    [self removeObjectForKey:@"receipts"];
+    [self setState:MPPortStateLearnState];
+    
 	[[MPNotifications sharedListener] setPerformingTclCommand:@""];
 	[self sendGlobalExecNotification:procedure withStatus:@"Finished"];
 }
@@ -260,23 +266,14 @@
 	//NSString * tclCmd = [@"YES_" stringByAppendingString:target];
 	[[MPNotifications sharedListener] setPerformingTclCommand:target];
 	
-	if ([parentMacPortsInstance authorizationMode]) {
-		[interpreter evaluateStringWithMPHelperTool:
-		 [NSString stringWithFormat:
-		  @"set portHandle [mportopen  %@  %@  %@]; mportexec  $portHandle %@; mportclose $portHandle", 
-		  [self valueForKey:@"porturl"], opts, vrnts, target]
-												error:execError];
-	}
-	else {
-		[interpreter evaluateStringWithPossiblePrivileges:
-		 [NSString stringWithFormat:
-		  @"set portHandle [mportopen  %@  %@  %@]; mportexec  $portHandle %@; mportclose $portHandle", 
-		  [self valueForKey:@"porturl"], opts, vrnts, target]
-													error:execError];
-	}
+    [interpreter evaluateStringWithPossiblePrivileges:
+        [NSString stringWithFormat:
+            @"set portHandle [mportopen  %@  %@  %@]; mportexec  $portHandle %@; mportclose $portHandle", 
+            [self valueForKey:@"porturl"], opts, vrnts, target]
+        error:execError];
 	
 	
-	
+	[self setState:MPPortStateLearnState];
 	[[MPNotifications sharedListener] setPerformingTclCommand:@""];
 	[self sendGlobalExecNotification:target withStatus:@"Finished"];
 	
@@ -414,7 +411,12 @@
 
 - (id)objectForKey:(id)aKey {
 	if ([aKey isEqualToString:@"receipts"] && ![super objectForKey:aKey]) {
-		[self setObject:[[[MPRegistry sharedRegistry] installed:[self objectForKey:@"name"]] objectForKey:[self objectForKey:@"name"]]forKey:aKey];
+        NSArray *receipts = [[[MPRegistry sharedRegistry] installed:[self objectForKey:@"name"]] objectForKey:[self objectForKey:@"name"]];
+        if (receipts == nil) {
+            return nil;
+        } else {
+            [self setObject:receipts forKey:aKey];
+        }
 	}
 	return [super objectForKey:aKey];
 }
@@ -460,7 +462,7 @@
 }
 
 - (void)setStateFromReceipts:(NSArray *)receipts {
-	[self setObject:receipts forKey:@"receipts"];
+    [self setObject:receipts forKey:@"receipts"];
 	[self setState:MPPortStateLearnState];
 }
 

Modified: branches/gsoc09-gui/MacPorts_Framework/MPRegistry.h
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPRegistry.h	2009-09-07 05:30:55 UTC (rev 57187)
+++ branches/gsoc09-gui/MacPorts_Framework/MPRegistry.h	2009-09-07 05:35:58 UTC (rev 57188)
@@ -60,7 +60,7 @@
 - (NSDictionary *)installed;
 
 /*
- @brief Calls [self installed:name version:@""]
+ @brief Calls [self installed:name withVersion:@""]
  @param name Text to match the port name
  */
 - (NSDictionary *)installed:(NSString *)name;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090906/8d7e452e/attachment-0001.html>


More information about the macports-changes mailing list