[48618] users/toby/objcports

toby at macports.org toby at macports.org
Thu Mar 26 01:05:31 PDT 2009


Revision: 48618
          http://trac.macports.org/changeset/48618
Author:   toby at macports.org
Date:     2009-03-26 01:05:30 -0700 (Thu, 26 Mar 2009)
Log Message:
-----------
cleanup, lockdown interpreter a bit more

Modified Paths:
--------------
    users/toby/objcports/MPParser.m
    users/toby/objcports/MPPort.m
    users/toby/objcports/variables.plist

Modified: users/toby/objcports/MPParser.m
===================================================================
--- users/toby/objcports/MPParser.m	2009-03-26 07:52:19 UTC (rev 48617)
+++ users/toby/objcports/MPParser.m	2009-03-26 08:05:30 UTC (rev 48618)
@@ -20,11 +20,20 @@
 	_port = [port retain];
 
 	_interp = Tcl_CreateInterp();
-	//Tcl_MakeSafe(_interp); // XXX: should probably remove even more functionality
+	Tcl_MakeSafe(_interp);
+	Tcl_UnsetVar(_interp, "tcl_version", 0);
+	Tcl_UnsetVar(_interp, "tcl_patchLevel", 0);
+	Tcl_UnsetVar(_interp, "tcl_platform", 0);
+	Tcl_DeleteCommand(_interp, "tell");
+	Tcl_DeleteCommand(_interp, "eof");
+	// XXX: etc?
 
 	@try {
 		Tcl_Preserve(_interp);
 
+		Tcl_CreateObjCommand(_interp, "nslog", _nslog, NULL, NULL); // XXX: debugging
+		//Tcl_Eval(_interp, "nslog [info commands]");
+
 		command_create(_interp, "PortSystem", self);
 		command_create(_interp, "PortGroup", self);
 		command_create(_interp, "platform", self);
@@ -48,8 +57,6 @@
 			Tcl_TraceVar(_interp, [var UTF8String], TCL_TRACE_READS, variable_read, port);
 		}
 
-		Tcl_CreateObjCommand(_interp, "nslog", _nslog, NULL, NULL); // XXX: debugging
-
 		// bogus targets
 		Tcl_CreateObjCommand(_interp, "pre-activate", _nslog, NULL, NULL); // XXX: debugging
 		Tcl_CreateObjCommand(_interp, "post-activate", _nslog, NULL, NULL); // XXX: debugging

Modified: users/toby/objcports/MPPort.m
===================================================================
--- users/toby/objcports/MPPort.m	2009-03-26 07:52:19 UTC (rev 48617)
+++ users/toby/objcports/MPPort.m	2009-03-26 08:05:30 UTC (rev 48618)
@@ -5,6 +5,9 @@
 #include "MPPort.h"
 #include "MPParser.h"
 
+static NSString *kPortVariableAllowSet = @"AllowSet";
+static NSString *kPortVariableAllowAppendDelete = @"AllowAppendDelete";
+
 @implementation MPPort
 
 - (id)initWithPortfile:(NSString *)portfile options:(NSDictionary *)options
@@ -37,12 +40,12 @@
 	for (NSString *command in commands) {
 		[_variableInfo setObject:[NSDictionary dictionary] forKey:[NSString stringWithFormat:@"use_%@", command]];
 		[_variableInfo setObject:[NSDictionary dictionary] forKey:[NSString stringWithFormat:@"%@.dir", command]];
-		[_variableInfo setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"AppendDelete"] forKey:[NSString stringWithFormat:@"%@.pre_args", command]];
-		[_variableInfo setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"AppendDelete"] forKey:[NSString stringWithFormat:@"%@.args", command]];
-		[_variableInfo setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"AppendDelete"] forKey:[NSString stringWithFormat:@"%@.post_args", command]];
-		[_variableInfo setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"AppendDelete"] forKey:[NSString stringWithFormat:@"%@.env", command]];
+		[_variableInfo setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:kPortVariableAllowAppendDelete] forKey:[NSString stringWithFormat:@"%@.pre_args", command]];
+		[_variableInfo setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:kPortVariableAllowAppendDelete] forKey:[NSString stringWithFormat:@"%@.args", command]];
+		[_variableInfo setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:kPortVariableAllowAppendDelete] forKey:[NSString stringWithFormat:@"%@.post_args", command]];
+		[_variableInfo setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:kPortVariableAllowAppendDelete] forKey:[NSString stringWithFormat:@"%@.env", command]];
 		[_variableInfo setObject:[NSDictionary dictionary] forKey:[NSString stringWithFormat:@"%@.type", command]];
-		[_variableInfo setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"AppendDelete"] forKey:[NSString stringWithFormat:@"%@.cmd", command]];
+		[_variableInfo setObject:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:kPortVariableAllowAppendDelete] forKey:[NSString stringWithFormat:@"%@.cmd", command]];
 	}
 
 	_parser = [[MPParser alloc] initWithPort:self];
@@ -118,7 +121,9 @@
 {
 	NSMutableArray *ret = [NSMutableArray arrayWithCapacity:0];
 	for (NSString *var in [self variables]) {
-		if (![[[_variableInfo objectForKey:var] objectForKey:@"Constant"] boolValue]) {
+		NSNumber *allowSet = [[_variableInfo objectForKey:var] objectForKey:kPortVariableAllowSet];
+		/* Default is YES, so nil is good. */
+		if (allowSet == nil || [allowSet boolValue] == YES) {
 			[ret addObject:var];
 		}
 	}
@@ -134,7 +139,9 @@
 {
 	NSMutableArray *ret = [NSMutableArray arrayWithCapacity:0];
 	for (NSString *var in [self variables]) {
-		if ([[[_variableInfo objectForKey:var] objectForKey:@"AppendDelete"] boolValue]) {
+		NSNumber *allowAppendDelete = [[_variableInfo objectForKey:var] objectForKey:kPortVariableAllowAppendDelete];
+		/* Default is NO, so it must be set. */
+		if ([allowAppendDelete boolValue]) {
 			[ret addObject:var];
 		}
 	}

Modified: users/toby/objcports/variables.plist
===================================================================
--- users/toby/objcports/variables.plist	2009-03-26 07:52:19 UTC (rev 48617)
+++ users/toby/objcports/variables.plist	2009-03-26 08:05:30 UTC (rev 48618)
@@ -4,14 +4,14 @@
 <dict>
 	<key>applications_dir</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>build.jobs</key>
 	<dict/>
 	<key>build.target</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>buildmakejobs</key>
@@ -20,26 +20,26 @@
 	<dict/>
 	<key>categories</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>checksums</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>configure.awk</key>
 	<dict/>
 	<key>configure.cc</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>configure.ccache</key>
 	<dict/>
 	<key>configure.cflags</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>configure.compiler</key>
@@ -48,14 +48,14 @@
 	<dict/>
 	<key>configure.cppflags</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>configure.cxx</key>
 	<dict/>
 	<key>configure.cxxflags</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>configure.distcc</key>
@@ -68,7 +68,7 @@
 	<dict/>
 	<key>configure.fcflags</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>configure.install</key>
@@ -77,7 +77,7 @@
 	<dict/>
 	<key>configure.ldflags</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>configure.libs</key>
@@ -94,17 +94,17 @@
 	<dict/>
 	<key>configure.universal_archs</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>configure.universal_args</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>configure.universal_ldflags</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>cvs.date</key>
@@ -119,41 +119,41 @@
 	<dict/>
 	<key>default_variants</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>depends_build</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>depends_lib</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>depends_run</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>description</key>
 	<dict/>
 	<key>destroot</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>destroot.destdir</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>destroot.keepdirs</key>
 	<dict/>
 	<key>destroot.target</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>destroot.violate_mtree</key>
@@ -162,7 +162,7 @@
 	<dict/>
 	<key>distfiles</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>distname</key>
@@ -187,13 +187,13 @@
 	<dict/>
 	<key>filespath</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>frameworks_dir</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>git.url</key>
 	<dict/>
@@ -221,7 +221,7 @@
 	<dict/>
 	<key>master_sites</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>master_sites.mirror_subdir</key>
@@ -230,34 +230,34 @@
 	<dict/>
 	<key>os.arch</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>os.endian</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>os.major</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>os.platform</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>os.version</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>patch_sites</key>
 	<dict/>
 	<key>patchfiles</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>perl5.bin</key>
@@ -276,8 +276,8 @@
 	<dict/>
 	<key>prefix</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>python.bin</key>
 	<dict/>
@@ -335,8 +335,8 @@
 	<dict/>
 	<key>sysroot</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>test.run</key>
 	<dict/>
@@ -356,26 +356,26 @@
 	<dict/>
 	<key>workpath</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>worksrcdir</key>
 	<dict/>
 	<key>worksrcpath</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>x11font.setup</key>
 	<dict/>
 	<key>x11prefix</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>xcode.build.settings</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>xcode.configuration</key>
@@ -384,7 +384,7 @@
 	<dict/>
 	<key>xcode.destroot.settings</key>
 	<dict>
-		<key>AppendDelete</key>
+		<key>AllowAppendDelete</key>
 		<true/>
 	</dict>
 	<key>xcode.destroot.type</key>
@@ -395,8 +395,8 @@
 	<dict/>
 	<key>xcodeversion</key>
 	<dict>
-		<key>Constant</key>
-		<true/>
+		<key>AllowSet</key>
+		<false/>
 	</dict>
 	<key>zope.need_subdir</key>
 	<dict/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090326/c1bff113/attachment-0001.html>


More information about the macports-changes mailing list