[30441] users/rhwood/MacPorts.Framework

source_changes at macosforge.org source_changes at macosforge.org
Sat Oct 27 18:23:43 PDT 2007


Revision: 30441
          http://trac.macosforge.org/projects/macports/changeset/30441
Author:   rhwood at macports.org
Date:     2007-10-27 18:23:43 -0700 (Sat, 27 Oct 2007)

Log Message:
-----------
MPPort is MPReceipt aware.

A port can now find its initial state using [MPRegistery installed:[MPPort name]]

Modified Paths:
--------------
    users/rhwood/MacPorts.Framework/MPPort.h
    users/rhwood/MacPorts.Framework/MPPort.m

Modified: users/rhwood/MacPorts.Framework/MPPort.h
===================================================================
--- users/rhwood/MacPorts.Framework/MPPort.h	2007-10-28 01:21:50 UTC (rev 30440)
+++ users/rhwood/MacPorts.Framework/MPPort.h	2007-10-28 01:23:43 UTC (rev 30441)
@@ -41,6 +41,7 @@
 #import <Cocoa/Cocoa.h>
 #import "MPConstants.h"
 #import "MPInterpreter.h"
+#import "MPReceipt.h"
 #import "MPRegistery.h"
 
 @interface MPPort : NSMutableDictionary {

Modified: users/rhwood/MacPorts.Framework/MPPort.m
===================================================================
--- users/rhwood/MacPorts.Framework/MPPort.m	2007-10-28 01:21:50 UTC (rev 30440)
+++ users/rhwood/MacPorts.Framework/MPPort.m	2007-10-28 01:23:43 UTC (rev 30441)
@@ -79,6 +79,8 @@
 	id item;
 	interpreter = [MPInterpreter sharedInterpreter];
 	registery = [MPRegistery sharedRegistery];
+	NSString *installedVersion;
+	NSString *activeVersion;
 	
 	[self setDictionary:[interpreter dictionaryFromTclListAsString:string]];
 
@@ -130,10 +132,20 @@
 	// set the status flag to unknown
 	[self setState:MPPortStateUnknown];
 	installed = [[registery installed:[self valueForKey:@"name"]] valueForKey:[self valueForKey:@"name"]];
+	// the following logic is flawed - it makes the assuption that if the active version is not equal to the
+	// version in the PortIndex that the port is outdated + I don't know that this logic works at all on 
+	// direct installs
 	if (installed) {
+		[self setState:MPPortStateInstalled];
 		installedEnumerator = [installed objectEnumerator];
 		while (item = [installedEnumerator nextObject]) {
-			
+			if ([item valueForKey:@"active"]) {
+				[self setState:MPPortStateActive];
+				activeVersion = [[[item valueForKey:@"version"] stringByAppendingString:@"_"] stringByAppendingString:[item valueForKey:@"revision"]];
+				if (![activeVersion isEqualToString:[self valueForKey:@"compositeVersion"]]) {
+					[self setState:MPPortStateOutdated];
+				}
+			}
 		}
 	} else {
 		[self setState:MPPortStateNotInstalled];

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071027/d7587337/attachment-0001.html


More information about the macports-changes mailing list