[55483] branches/gsoc09-gui/MacPorts_Framework
juanger at macports.org
juanger at macports.org
Tue Aug 11 19:15:02 PDT 2009
Revision: 55483
http://trac.macports.org/changeset/55483
Author: juanger at macports.org
Date: 2009-08-11 19:15:01 -0700 (Tue, 11 Aug 2009)
Log Message:
-----------
New terminateMPHelperTool method.
Modified Paths:
--------------
branches/gsoc09-gui/MacPorts_Framework/MPHelperTool.m
branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h
branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m
branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m
branches/gsoc09-gui/MacPorts_Framework/MPPortProcess.m
Modified: branches/gsoc09-gui/MacPorts_Framework/MPHelperTool.m
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPHelperTool.m 2009-08-12 02:14:43 UTC (rev 55482)
+++ branches/gsoc09-gui/MacPorts_Framework/MPHelperTool.m 2009-08-12 02:15:01 UTC (rev 55483)
@@ -821,12 +821,6 @@
/////////////////////////////////////////////////////////////////
#pragma mark ***** Tool Infrastructure
-/*
- IMPORTANT
- ---------
- This array must be exactly parallel to the kMPHelperCommandSet array
- in "MPHelperCommon.c".
- */
static OSStatus DoEvaluateTclString
(
@@ -983,6 +977,12 @@
}
+/*
+ IMPORTANT
+ ---------
+ This array must be exactly parallel to the kMPHelperCommandSet array
+ in "MPHelperCommon.c".
+ */
static const BASCommandProc kMPHelperCommandProcs[] = {
DoEvaluateTclString,
NULL
Modified: branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h 2009-08-12 02:14:43 UTC (rev 55482)
+++ branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.h 2009-08-12 02:15:01 UTC (rev 55483)
@@ -104,6 +104,8 @@
+(void) setPKGPath:(NSString*)newPath;
++(void) terminateMPHelperTool;
+
+(NSTask*) task;
//Internal methods
Modified: branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m 2009-08-12 02:14:43 UTC (rev 55482)
+++ branches/gsoc09-gui/MacPorts_Framework/MPInterpreter.m 2009-08-12 02:15:01 UTC (rev 55483)
@@ -676,6 +676,7 @@
[theProxy evaluateString:statement];
[aTask waitUntilExit];
+
return nil;
}
@@ -683,6 +684,30 @@
return aTask;
}
++ (void) terminateMPHelperTool {
+ NSString * bundleID;
+
+ //In order to make the framework work normally by default ... we do a bare initialization
+ //of internalMacPortsAuthRef if the delegate hasn't iniitialzed it already
+ if (internalMacPortsAuthRef == NULL) {
+ OSStatus res = AuthorizationCreate (NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &internalMacPortsAuthRef);
+ assert(res == noErr);
+ }
+
+ NSBundle * mpBundle = [NSBundle bundleForClass:[self class]];
+ NSString * installToolPath = [mpBundle pathForResource:@"MPHelperInstallTool" ofType:nil];
+ bundleID = [mpBundle bundleIdentifier];
+
+ BASSetDefaultRules(internalMacPortsAuthRef,
+ kMPHelperCommandSet,
+ (CFStringRef) bundleID,
+ NULL);
+ BASTerminateCommand(internalMacPortsAuthRef,
+ [bundleID UTF8String],
+ [installToolPath UTF8String]);
+ return;
+}
+
#pragma mark -
#pragma mark Authorization Code
Modified: branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m 2009-08-12 02:14:43 UTC (rev 55482)
+++ branches/gsoc09-gui/MacPorts_Framework/MPMacPorts.m 2009-08-12 02:15:01 UTC (rev 55483)
@@ -59,6 +59,11 @@
[MPInterpreter setPKGPath:newPath];
}
+- (void) cancelCurrentCommand {
+ //[[MPNotifications sharedListener] cancel];
+ [MPInterpreter terminateMPHelperTool];
+}
+
+ (MPMacPorts *)sharedInstance {
return [self sharedInstanceWithPkgPath:[MPInterpreter PKGPath] portOptions:nil];
}
Modified: branches/gsoc09-gui/MacPorts_Framework/MPPortProcess.m
===================================================================
--- branches/gsoc09-gui/MacPorts_Framework/MPPortProcess.m 2009-08-12 02:14:43 UTC (rev 55482)
+++ branches/gsoc09-gui/MacPorts_Framework/MPPortProcess.m 2009-08-12 02:15:01 UTC (rev 55483)
@@ -25,12 +25,20 @@
- (oneway void)evaluateString:(bycopy id)statement {
// TODO Handle the posible errors and notifications
- [[NSDistributedNotificationCenter defaultCenter]
- postNotificationName:@"MPInfoNotification" object:@"Starting up"];
- Tcl_Eval(interpreter, [statement UTF8String]);
- [[NSDistributedNotificationCenter defaultCenter]
- postNotificationName:@"MPInfoNotification" object:@"Shutting down"];
- exit(0);
+ int retCode = Tcl_Eval(interpreter, [statement UTF8String]);
+// OSStatus retval = noErr;
+// if( retCode == TCL_ERROR ) {
+// //Do some error handling
+// retval = coreFoundationUnknownErr;
+// }
+// else {
+// retval = noErr;
+// }
+// NSLog(@"%i", retCode);
+ const char *result = Tcl_GetStringResult(interpreter);
+ NSLog(@"- %s - %i", result, retCode);
+
+ exit(retCode);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090811/1d3125d5/attachment-0001.html>
More information about the macports-changes
mailing list