[23416] users/rhwood/Pallet

source_changes at macosforge.org source_changes at macosforge.org
Sat Mar 31 11:01:08 PDT 2007


Revision: 23416
          http://trac.macosforge.org/projects/macports/changeset/23416
Author:   rhwood at macports.org
Date:     2007-03-31 11:01:07 -0700 (Sat, 31 Mar 2007)

Log Message:
-----------
Add MPTool/MPAgent code from dp-cocoa
Displsy depenedcies as in an  NStokenField

Modified Paths:
--------------
    users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib
    users/rhwood/Pallet/English.lproj/MainMenu.nib/keyedobjects.nib
    users/rhwood/Pallet/Pallet.xcodeproj/project.pbxproj
    users/rhwood/Pallet/PortAuthority.h
    users/rhwood/Pallet/PortAuthority.m

Modified: users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib
===================================================================
--- users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib	2007-03-31 17:25:27 UTC (rev 23415)
+++ users/rhwood/Pallet/English.lproj/MainMenu.nib/info.nib	2007-03-31 18:01:07 UTC (rev 23416)
@@ -23,10 +23,10 @@
 	</array>
 	<key>IBOpenObjects</key>
 	<array>
-		<integer>21</integer>
 		<integer>568</integer>
+		<integer>29</integer>
 		<integer>290</integer>
-		<integer>29</integer>
+		<integer>21</integer>
 	</array>
 	<key>IBSystem Version</key>
 	<string>8P135</string>

Modified: users/rhwood/Pallet/English.lproj/MainMenu.nib/keyedobjects.nib
===================================================================
(Binary files differ)

Modified: users/rhwood/Pallet/Pallet.xcodeproj/project.pbxproj
===================================================================
--- users/rhwood/Pallet/Pallet.xcodeproj/project.pbxproj	2007-03-31 17:25:27 UTC (rev 23415)
+++ users/rhwood/Pallet/Pallet.xcodeproj/project.pbxproj	2007-03-31 18:01:07 UTC (rev 23416)
@@ -22,6 +22,10 @@
 		487EB9280B4533CB001B0F72 /* getpath.c in Sources */ = {isa = PBXBuildFile; fileRef = 48BBCE870B41B37F0063A19F /* getpath.c */; };
 		487EB9490B453786001B0F72 /* AuthorizedExecutable.m in Sources */ = {isa = PBXBuildFile; fileRef = 487EB9480B453786001B0F72 /* AuthorizedExecutable.m */; };
 		48ACD7930B4284A400D34B4C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4854CE0F0B420D8C00950EE4 /* Security.framework */; };
+		48CD130E0BBE6B02002B0D0E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 48CD130A0BBE6B02002B0D0E /* main.m */; };
+		48CD131B0BBE6C24002B0D0E /* MPAgent.m in Sources */ = {isa = PBXBuildFile; fileRef = 48CD13150BBE6C24002B0D0E /* MPAgent.m */; };
+		48CD131C0BBE6C24002B0D0E /* MPInterp.m in Sources */ = {isa = PBXBuildFile; fileRef = 48CD13180BBE6C24002B0D0E /* MPInterp.m */; };
+		48CD131D0BBE6C24002B0D0E /* MPObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 48CD131A0BBE6C24002B0D0E /* MPObject.m */; };
 		48D470190AD6867C00352CE9 /* PortAuthority.m in Sources */ = {isa = PBXBuildFile; fileRef = 48D470180AD6867C00352CE9 /* PortAuthority.m */; };
 		48D470790AD6CFFB00352CE9 /* MPToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = 48D470780AD6CFFB00352CE9 /* MPToolbar.m */; };
 		48D470C90AD7256700352CE9 /* Remove.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 48D470C70AD7256600352CE9 /* Remove.tiff */; };
@@ -80,6 +84,14 @@
 		48AFB8B70BA4E20300896AF1 /* Debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Debug.h; sourceTree = "<group>"; };
 		48BBCE7D0B41B2450063A19F /* Launcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Launcher.c; sourceTree = "<group>"; };
 		48BBCE870B41B37F0063A19F /* getpath.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = getpath.c; sourceTree = "<group>"; };
+		48CD130A0BBE6B02002B0D0E /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+		48CD13140BBE6C24002B0D0E /* MPAgent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MPAgent.h; sourceTree = "<group>"; };
+		48CD13150BBE6C24002B0D0E /* MPAgent.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MPAgent.m; sourceTree = "<group>"; };
+		48CD13160BBE6C24002B0D0E /* MPAgentProtocol.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MPAgentProtocol.h; sourceTree = "<group>"; };
+		48CD13170BBE6C24002B0D0E /* MPInterp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MPInterp.h; sourceTree = "<group>"; };
+		48CD13180BBE6C24002B0D0E /* MPInterp.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MPInterp.m; sourceTree = "<group>"; };
+		48CD13190BBE6C24002B0D0E /* MPObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MPObject.h; sourceTree = "<group>"; };
+		48CD131A0BBE6C24002B0D0E /* MPObject.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MPObject.m; sourceTree = "<group>"; };
 		48D470170AD6867B00352CE9 /* PortAuthority.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PortAuthority.h; sourceTree = "<group>"; };
 		48D470180AD6867C00352CE9 /* PortAuthority.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = PortAuthority.m; sourceTree = "<group>"; };
 		48D470770AD6CFFB00352CE9 /* MPToolbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPToolbar.h; sourceTree = "<group>"; };
@@ -172,6 +184,7 @@
 		29B97314FDCFA39411CA2CEA /* Port Authority */ = {
 			isa = PBXGroup;
 			children = (
+				48CD13020BBE6B02002B0D0E /* MPTool */,
 				080E96DDFE201D6D7F000001 /* Classes */,
 				29B97315FDCFA39411CA2CEA /* Other Sources */,
 				29B97317FDCFA39411CA2CEA /* Resources */,
@@ -227,6 +240,21 @@
 			name = Frameworks;
 			sourceTree = "<group>";
 		};
+		48CD13020BBE6B02002B0D0E /* MPTool */ = {
+			isa = PBXGroup;
+			children = (
+				48CD13140BBE6C24002B0D0E /* MPAgent.h */,
+				48CD13150BBE6C24002B0D0E /* MPAgent.m */,
+				48CD13160BBE6C24002B0D0E /* MPAgentProtocol.h */,
+				48CD13170BBE6C24002B0D0E /* MPInterp.h */,
+				48CD13180BBE6C24002B0D0E /* MPInterp.m */,
+				48CD13190BBE6C24002B0D0E /* MPObject.h */,
+				48CD131A0BBE6C24002B0D0E /* MPObject.m */,
+				48CD130A0BBE6B02002B0D0E /* main.m */,
+			);
+			path = MPTool;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -327,6 +355,10 @@
 				487EB9490B453786001B0F72 /* AuthorizedExecutable.m in Sources */,
 				483A5E460B57A50900712840 /* MPPortsController.m in Sources */,
 				480062BF0B597D9A005F27E4 /* PAStatusTransformer.m in Sources */,
+				48CD130E0BBE6B02002B0D0E /* main.m in Sources */,
+				48CD131B0BBE6C24002B0D0E /* MPAgent.m in Sources */,
+				48CD131C0BBE6C24002B0D0E /* MPInterp.m in Sources */,
+				48CD131D0BBE6C24002B0D0E /* MPObject.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: users/rhwood/Pallet/PortAuthority.h
===================================================================
--- users/rhwood/Pallet/PortAuthority.h	2007-03-31 17:25:27 UTC (rev 23415)
+++ users/rhwood/Pallet/PortAuthority.h	2007-03-31 18:01:07 UTC (rev 23416)
@@ -59,7 +59,9 @@
 	NSString *macPortsPort;
 	AuthorizedExecutable *authPortTask;
 	AuthorizedExecutable *killTask;
-
+	NSMutableDictionary *portSettings;
+	NSMutableDictionary *dependencies;
+	
 	NSDictionary *portIndexes;
 
 }
@@ -72,6 +74,8 @@
 - (IBAction)upgradePort:(id)sender;
 - (IBAction)haltPortCommand:(id)sender;
 
+- (NSString *)configurationSetting:(NSString *)setting;
+
 - (void)installSinglePort:(NSString *)name;
 - (void)runPortCommand:(NSString *)action port:(NSString *)port;
 - (void)runPortCommandInThread:(id)parameters;

Modified: users/rhwood/Pallet/PortAuthority.m
===================================================================
--- users/rhwood/Pallet/PortAuthority.m	2007-03-31 17:25:27 UTC (rev 23415)
+++ users/rhwood/Pallet/PortAuthority.m	2007-03-31 18:01:07 UTC (rev 23416)
@@ -61,6 +61,8 @@
 	// Locate port
 	macPortsPath = [[[NSUserDefaultsController sharedUserDefaultsController] values] valueForKey:@"portInstallationPath"];
 	macPortsPort = [[NSString alloc] initWithString:[macPortsPath stringByAppendingPathComponent:@"bin/port"]];
+	// Initialize the port settings cache
+	portSettings = [[NSMutableDictionary alloc] init];
 	// Clean the main window
 	[status setStringValue:@""];
 	// Setup the port task
@@ -76,6 +78,9 @@
 	// UI Tweaks
 	[[portsList headerView] setMenu:portsListHeaderMenu];
 	[[portsList cornerView] setMenu:portsListHeaderMenu];
+	
+	// TESTING TESTING TESTING
+	NSLog(@"Ports Database path: %@", [self configurationSetting:@"portdbpath"]);
 }
 
 /*
@@ -162,12 +167,17 @@
 	const char **tclElements;
 	NSStringEncoding encoding;
 	NSString *key;
-	NSString *value;
+	id value;
+	NSMutableArray *values;
+	NSEnumerator *valuesEnumerator;
+	int valuesCount;
+	int valuesCounter;
 	id line;
 	arrays = [[NSMutableArray alloc] init];
 	file = [[NSString alloc] initWithContentsOfFile:index];
 	lines = [file componentsSeparatedByString:@"\n"];
 	indexEnumerator = [lines objectEnumerator];
+	// throw away the lines that contain only two words (the portname and a number)
 	while (line = [indexEnumerator nextObject]) {
 		array = [line componentsSeparatedByString:@" "];
 		if ([array count] > 2) {
@@ -184,8 +194,27 @@
 				key = [[NSString alloc] initWithCString:tclElements[counter] encoding:encoding];
 				value = [[NSString alloc] initWithCString:tclElements[counter + 1] encoding:encoding];
 				[port setValue:value forKey:key];
-				//NSLog(@"%@: %@\n", key, value);
+				NSLog(@"%@: %@\n", key, value);
 			}
+			[port setValue:[[port valueForKey:@"maintainer"] componentsSeparatedByString:@" "] forKey:@"maintainer"];
+			if ([port valueForKey:@"depends_lib"]) {
+				values = [[NSMutableArray alloc] initWithArray:[[port valueForKey:@"depends_lib"] componentsSeparatedByString:@" "]];
+				valuesCount = [values count];
+				for (valuesCounter = 0; valuesCounter < valuesCount; valuesCounter++) {
+					value = [[[values objectAtIndex:valuesCounter] componentsSeparatedByString:@":"] lastObject];
+					[values replaceObjectAtIndex:valuesCounter withObject:value];
+				}
+				[port setValue:[[NSArray alloc] initWithArray:values] forKey:@"depends_lib"];
+			}
+			if ([port valueForKey:@"depends_build"]) {
+				values = [[NSMutableArray alloc] initWithArray:[[port valueForKey:@"depends_build"] componentsSeparatedByString:@" "]];
+				valuesCount = [values count];
+				for (valuesCounter = 0; valuesCounter < valuesCount; valuesCounter++) {
+					value = [[[values objectAtIndex:valuesCounter] componentsSeparatedByString:@":"] lastObject];
+					[values replaceObjectAtIndex:valuesCounter withObject:value];
+				}
+				[port setValue:[[NSArray alloc] initWithArray:values] forKey:@"depends_build"];
+			}
 			@try {
 				if ([[port valueForKey:@"long_description"] characterAtIndex:0] == '{') {
 					[port setValue:[port valueForKey:@"description"] forKey:@"long_description"];
@@ -242,6 +271,35 @@
 	
 }
 
+#pragma mark PORT CONFIGURATION
+
+- (NSString *)configurationSetting:(NSString *)setting
+/*
+ For some reason, the below script can not find {$prefix}/etc/ports/ports.conf
+ So what we need to do is execute a tclsh resource script to get conf settings out of port
+ 
+ Better yet, create a RFE for port to dump its configuration settings so we can read all port conf files
+ without knowing where the setting came from (default, ports.conf, .portrc, wherever)...
+ */
+{
+	if ([portSettings valueForKey:setting] == nil) {
+		int tclResult;
+		Tcl_Interp *tcl;
+		NSString *script = [[NSString alloc] initWithFormat:@"source %@/etc/ports/ports.conf\nproc %@ x {puts [list %2$@ $x]}", macPortsPath, setting, nil];
+		NSLog(script);
+		tcl = Tcl_CreateInterp();
+		tclResult = Tcl_EvalEx(tcl, [script cString], -1, TCL_EVAL_GLOBAL);
+		if (tclResult == TCL_OK) {
+			NSLog(@"%s", Tcl_GetStringResult(tcl));
+			[portSettings setValue:[NSString stringWithCString:Tcl_GetStringResult(tcl)] forKey:setting];
+		} else {
+			NSLog(@"%s", Tcl_ErrnoMsg(Tcl_ErrnoId()));
+		}
+		Tcl_DeleteInterp(tcl);
+	}
+	return [portSettings valueForKey:setting];
+}
+
 #pragma mark PORT COMMANDS
 
 - (void)defaultAction:(id)items

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070331/636c2e3a/attachment.html


More information about the macports-changes mailing list