mirror of
https://github.com/macports/pallet.git
synced 2026-07-12 18:18:47 -07:00
Rewrote Notifications_Send function for MPInterpreter class. Added some dubgging code to init.tcl file
git-svn-id: https://svn.macports.org/repository/macports/branches/gsoc08-framework@38997 d073be05-634f-4543-b044-5fe20cf6d1d6
This commit is contained in:
@@ -1,134 +1,47 @@
|
||||
/*
|
||||
* MPHelperTool.c
|
||||
* MacPorts.Framework
|
||||
* $Id$
|
||||
* MacPorts.Framework
|
||||
*
|
||||
* Created by George Armah on 8/2/08.
|
||||
* Copyright 2008 Lafayette College. All rights reserved.
|
||||
* Authors:
|
||||
* George Armah <armahg@macports.org>
|
||||
*
|
||||
* Copyright (c) 2008 George Armah <armahg@macports.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright owner nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
//#include <netinet/in.h>
|
||||
#include <stdio.h>
|
||||
//#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include "BetterAuthorizationSampleLib.h"
|
||||
#include "MPHelperCommon.h"
|
||||
#import "MPInterpreterProtocol.h"
|
||||
|
||||
static OSStatus DoEvaluateTclString (
|
||||
AuthorizationRef auth,
|
||||
const void * userData,
|
||||
CFDictionaryRef request,
|
||||
CFMutableDictionaryRef response,
|
||||
aslclient asl,
|
||||
aslmsg aslMsg
|
||||
)
|
||||
{
|
||||
|
||||
OSStatus retval = noErr;
|
||||
|
||||
|
||||
//Pre conditions
|
||||
assert(auth != NULL);
|
||||
//userData may be NULL
|
||||
assert(request != NULL);
|
||||
assert(response != NULL);
|
||||
//asl may be null
|
||||
//aslMsg may be null
|
||||
|
||||
//Get the string that was passed in the request dictionary
|
||||
CFStringRef cTclCmd = (CFStringRef)CFDictionaryGetValue(request, CFSTR(kTclStringToBeEvaluated));
|
||||
//cTclCmd = CFRetain(cTclCmd);
|
||||
if (cTclCmd == NULL) {
|
||||
retval = coreFoundationUnknownErr;
|
||||
}
|
||||
|
||||
//Testing Distributed Objects Implementation
|
||||
NSString * tclCmd = (NSString *) cTclCmd;
|
||||
id distributedMPInterpreterObject = nil;
|
||||
NSConnection * mpConn = [NSConnection connectionWithRegisteredName:MP_DOSERVER
|
||||
host:nil];
|
||||
distributedMPInterpreterObject = [mpConn rootProxy];
|
||||
|
||||
|
||||
//CFDictionaryAddValue(response, CFSTR("NSConnection stats"), [[NSConnection defaultConnection] statistics]);
|
||||
if ( distributedMPInterpreterObject == nil ) {
|
||||
CFDictionaryAddValue(response, CFSTR(kMPInterpreterDistObj), CFSTR("NO"));
|
||||
retval = coreFoundationUnknownErr;
|
||||
}
|
||||
else { //We successfully obtained the distObj
|
||||
NSLog(@"IN HERE");
|
||||
CFDictionaryAddValue(response, CFSTR(kMPInterpreterDistObj), CFSTR("YES"));
|
||||
[distributedMPInterpreterObject setProtocolForProxy:@protocol(MPInterpreterProtocol)];
|
||||
NSString * result = [distributedMPInterpreterObject
|
||||
evaluateStringFromMPHelperTool:tclCmd];
|
||||
|
||||
if (result != nil) { //successful execution
|
||||
CFDictionaryAddValue(response, CFSTR(kTclStringEvaluationResult), CFSTR("Port operation Failed not"));
|
||||
retval = noErr;
|
||||
}
|
||||
else {
|
||||
CFDictionaryAddValue(response, CFSTR(kTclStringEvaluationResult), CFSTR("Port operation Failed"));
|
||||
retval = coreFoundationUnknownErr;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int numcon = [[NSConnection allConnections] count];
|
||||
CFDictionaryAddValue(response, CFSTR("NSConnections"), CFStringCreateWithFormat(kCFAllocatorDefault , NULL, CFSTR("%u"),numcon) );
|
||||
|
||||
CFDictionaryAddValue(response, CFSTR("NSConnection Stats"), [[NSConnection defaultConnection] statistics]);
|
||||
/*
|
||||
if( retval == noErr) {
|
||||
|
||||
CFDictionaryAddValue(response, CFSTR(kTclStringEvaluationResult), cTclCmd);
|
||||
}
|
||||
else{
|
||||
//Try setting the user data pointer to the error
|
||||
CFDictionaryAddValue(response, CFSTR(kTclStringEvaluationResult), CFSTR("BAAD"));
|
||||
}*/
|
||||
|
||||
assert(response != NULL);
|
||||
//I think I should release cTclCmd
|
||||
//CFRelease(cTclCmd);
|
||||
//CFDictionaryAddValue(response, CFSTR(kTclStringEvaluationResult), CFSTR("Port operation Failed not"));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#pragma mark ***** Tool Infrastructure
|
||||
|
||||
/*
|
||||
IMPORTANT
|
||||
---------
|
||||
This array must be exactly parallel to the kMPHelperCommandSet array
|
||||
in "MPHelperCommon.c".
|
||||
*/
|
||||
|
||||
static const BASCommandProc kMPHelperCommandProcs[] = {
|
||||
DoEvaluateTclString,
|
||||
NULL
|
||||
};
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
//Should I just do stuff in main and use the above method to
|
||||
//just retrieve the string to be evaluated as a tcl command?
|
||||
|
||||
int main(int argc, char const * argv[]) {
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
[[NSRunLoop currentRunLoop] run];
|
||||
// Go directly into BetterAuthorizationSampleLib code.
|
||||
|
||||
// IMPORTANT
|
||||
// BASHelperToolMain doesn't clean up after itself, so once it returns
|
||||
// we must quit.
|
||||
int result = BASHelperToolMain(kMPHelperCommandSet, kMPHelperCommandProcs);
|
||||
|
||||
|
||||
[pool release];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -70,6 +70,7 @@
|
||||
|
||||
Tcl_Interp* _interpreter;
|
||||
NSString * helperToolInterpCommand;
|
||||
NSString * helperToolCommandResult;
|
||||
|
||||
}
|
||||
|
||||
@@ -176,6 +177,7 @@
|
||||
- (NSString *)getVariableAsString:(NSString *)variable;
|
||||
|
||||
|
||||
//For testing helper tool
|
||||
//For testing helper tools
|
||||
-(NSString *)evaluateStringWithMPHelperTool:(NSString *)statement;
|
||||
-(NSString *)evaluateStringWithSimpleMPDOPHelperTool:(NSString *)statement;
|
||||
@end
|
||||
|
||||
@@ -49,18 +49,23 @@ static AuthorizationRef mpAuth;
|
||||
|
||||
#pragma mark Notifications Code
|
||||
int Notifications_Send(int objc, Tcl_Obj *CONST objv[], int global, Tcl_Interp *interpreter) {
|
||||
|
||||
NSString *name;
|
||||
NSMutableString *msg;
|
||||
NSMutableDictionary *info = nil;
|
||||
|
||||
//Our info dictionary is of size 4 and contains the following keys
|
||||
//Channel - eg. stdout, stderr
|
||||
//Prefix - prefix string for this message e.g. DEBUG:
|
||||
//Function - the function whose operation led to this notification eg. sync, selfupdate
|
||||
//Message - the message logged to channel
|
||||
NSMutableDictionary *info = [NSMutableDictionary dictionaryWithCapacity:4];
|
||||
MPNotifications *mln = [MPNotifications sharedListener];
|
||||
|
||||
int tclCount;
|
||||
int tclResult;
|
||||
int i;
|
||||
const char **tclElements;
|
||||
|
||||
name = [NSString stringWithUTF8String:Tcl_GetString(*objv)];
|
||||
NSLog(@"name is %@", name);
|
||||
|
||||
//Name and Notification constants should match. Convention
|
||||
//used is MPPriorityNotification. Is it ok to just return TCL_OK ?
|
||||
@@ -68,20 +73,32 @@ int Notifications_Send(int objc, Tcl_Obj *CONST objv[], int global, Tcl_Interp *
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
|
||||
++objv; --objc;
|
||||
|
||||
tclResult = Tcl_SplitList(interpreter, Tcl_GetString(*objv), &tclCount, &tclElements);
|
||||
//NSLog(@"tclElements is %S and tclCount is %i", &tclElements, tclCount);
|
||||
|
||||
if (tclResult == TCL_OK) {
|
||||
info = [NSMutableDictionary dictionaryWithCapacity:(tclCount / 2)];
|
||||
for (i = 0; i < tclCount; i +=2) {
|
||||
[info setObject:[NSString stringWithUTF8String:tclElements[i + 1]] forKey:[NSString stringWithUTF8String:tclElements[i]]];
|
||||
|
||||
//I have sacrificed generality for simplicity in the code below
|
||||
if (tclElements > 0) {
|
||||
[info setObject:[NSString stringWithUTF8String:tclElements[0]] forKey:@"Channel"];
|
||||
|
||||
if(tclElements[1])
|
||||
[info setObject:[NSString stringWithUTF8String:tclElements[1]] forKey:@"Prefix"];
|
||||
else
|
||||
[info setObject:@"None" forKey:@"Prefix"];
|
||||
}
|
||||
else {
|
||||
[info setObject:@"None" forKey:@"Channel"];
|
||||
[info setObject:@"None" forKey:@"Prefix"];
|
||||
}
|
||||
|
||||
//Get ui_* message separately
|
||||
|
||||
//Get ui_* message separately Hopefully this should never be null
|
||||
++objv; --objc;
|
||||
if(objv != NULL) {
|
||||
msg = [NSMutableString stringWithUTF8String:Tcl_GetString(*objv)];
|
||||
//NSLog(@"Message is %@", msg);
|
||||
|
||||
//strip off "--->" over here
|
||||
NSArray * temp = [msg componentsSeparatedByString:@"--->"];
|
||||
@@ -96,7 +113,7 @@ int Notifications_Send(int objc, Tcl_Obj *CONST objv[], int global, Tcl_Interp *
|
||||
//if code is working right, this value should always be YES
|
||||
//when we are in this part of the code
|
||||
if([cmd count] > 0) {
|
||||
NSLog(@"Class type is %@", NSStringFromClass([[cmd objectAtIndex:0] class]));
|
||||
//NSLog(@"Class type is %@", NSStringFromClass([[cmd objectAtIndex:0] class]));
|
||||
|
||||
if( [[cmd objectAtIndex:0] isEqualToString:@"YES"]) {
|
||||
[info setObject:[cmd objectAtIndex:1] forKey:@"Function"];
|
||||
@@ -179,8 +196,8 @@ int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int ob
|
||||
|
||||
AuthorizationFlags envFlags;
|
||||
envFlags = kAuthorizationFlagDefaults |
|
||||
kAuthorizationFlagExtendRights |
|
||||
kAuthorizationFlagPreAuthorize;
|
||||
kAuthorizationFlagExtendRights |
|
||||
kAuthorizationFlagPreAuthorize;
|
||||
|
||||
|
||||
junk = AuthorizationCreate(NULL, &env, envFlags, &mpAuth);
|
||||
@@ -211,14 +228,14 @@ int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int ob
|
||||
|
||||
[defaultConn setRootObject:self];
|
||||
|
||||
NSLog(@"Connection Created ... %@, %@", defaultConn, [defaultConn statistics]);
|
||||
NSLog(@"Connection Created ... "); //%@, %@", defaultConn, [defaultConn statistics]);
|
||||
return [defaultConn registerName:MP_DOSERVER];
|
||||
|
||||
}
|
||||
|
||||
- (bycopy NSString *) evaluateStringFromMPHelperTool:(in bycopy NSString *)statement {
|
||||
//- (NSString *) evaluateStringFromMPHelperTool:(NSString *)statement {
|
||||
//TO DO -> error:(inout NSError **)evalError {
|
||||
//- (NSString *) evaluateStringFromMPHelperTool:(NSString *)statement {
|
||||
//TO DO -> error:(inout NSError **)evalError {
|
||||
//NSError * evalError;
|
||||
NSString * result = [self evaluateStringAsString:statement error:nil];
|
||||
|
||||
@@ -229,6 +246,32 @@ int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int ob
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
- (void) setTclCommand:(in bycopy NSString *)tclCmd {
|
||||
if (![helperToolInterpCommand isEqualToString:tclCmd]) {
|
||||
|
||||
[helperToolInterpCommand release];
|
||||
helperToolInterpCommand = [tclCmd copy];
|
||||
}
|
||||
|
||||
}
|
||||
- (bycopy NSString *)getTclCommand {
|
||||
return helperToolInterpCommand;
|
||||
}
|
||||
|
||||
- (void) setTclCommandResult:(in bycopy NSString *)tclCmdResult {
|
||||
if (![helperToolCommandResult isEqualToString:tclCmdResult]) {
|
||||
[helperToolCommandResult release];
|
||||
helperToolCommandResult = [tclCmdResult copy];
|
||||
}
|
||||
}
|
||||
- (bycopy NSString *) getTclCommandResult {
|
||||
return helperToolCommandResult;
|
||||
}
|
||||
|
||||
- (void) log :(in bycopy id) logOutput {
|
||||
NSLog(@"MPInterpreterProtocol Logging : %@", logOutput);
|
||||
}
|
||||
#pragma mark -
|
||||
|
||||
#pragma mark MPInterpreter Code
|
||||
@@ -265,9 +308,9 @@ int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int ob
|
||||
}
|
||||
|
||||
/*if( Tcl_EvalFile(_interpreter, [[[NSBundle bundleWithIdentifier:@"org.macports.frameworks.macports"] pathForResource:@"init" ofType:@"tcl"] UTF8String]) != TCL_OK) {
|
||||
NSLog(@"Error in Tcl_EvalFile init.tcl: %s", Tcl_GetStringResult(_interpreter));
|
||||
Tcl_DeleteInterp(_interpreter);
|
||||
}*/
|
||||
NSLog(@"Error in Tcl_EvalFile init.tcl: %s", Tcl_GetStringResult(_interpreter));
|
||||
Tcl_DeleteInterp(_interpreter);
|
||||
}*/
|
||||
|
||||
if( Tcl_EvalFile(_interpreter, [[[NSBundle bundleWithIdentifier:@"org.macports.frameworks.macports"]
|
||||
pathForResource:@"init"
|
||||
@@ -278,6 +321,7 @@ int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int ob
|
||||
|
||||
//Initialize helperToolInterpCommand
|
||||
helperToolInterpCommand = @"";
|
||||
helperToolCommandResult = @"";
|
||||
|
||||
//Initialize the Run Loop because we don't know if framework will be
|
||||
//run in a Foundation Kit or App Kit. Hopefully this won't hurt if the
|
||||
@@ -293,7 +337,7 @@ int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int ob
|
||||
}
|
||||
else
|
||||
NSLog(@"MPInterpreter Initialized ...");
|
||||
|
||||
|
||||
|
||||
}
|
||||
return self;
|
||||
@@ -366,17 +410,17 @@ int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int ob
|
||||
}
|
||||
|
||||
/*- (NSDictionary *)evaluateArrayAsString:(NSArray *)statement {
|
||||
return [self evaluateStringAsString:[statement componentsJoinedByString:@" "]];
|
||||
}
|
||||
|
||||
*/
|
||||
return [self evaluateStringAsString:[statement componentsJoinedByString:@" "]];
|
||||
}
|
||||
|
||||
*/
|
||||
- (NSString *)evaluateStringAsString:(NSString *)statement error:(NSError**)mportError{
|
||||
NSLog(@"Calling evaluateStringAsString with argument %@", statement);
|
||||
//NSLog(@"Calling evaluateStringAsString with argument %@", statement);
|
||||
|
||||
int return_code = Tcl_Eval(_interpreter, [statement UTF8String]);
|
||||
|
||||
//Should I check for (return_code != TCL_Ok && return_code != TCL_RETURN) instead ?
|
||||
if (return_code == TCL_ERROR) {
|
||||
if (return_code != TCL_OK) {
|
||||
|
||||
Tcl_Obj * interpObj = Tcl_GetObjResult(_interpreter);
|
||||
int length, errCode;
|
||||
@@ -413,13 +457,13 @@ int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int ob
|
||||
|
||||
|
||||
/*
|
||||
- (NSDictionary *)evaluateStringAsString:(NSString *)statement {
|
||||
int return_code = Tcl_Eval(_interpreter, [statement UTF8String]);
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInt:return_code], TCL_RETURN_CODE,
|
||||
[NSString stringWithUTF8String:Tcl_GetStringResult(_interpreter)], TCL_RETURN_STRING, nil];
|
||||
}
|
||||
*/
|
||||
- (NSDictionary *)evaluateStringAsString:(NSString *)statement {
|
||||
int return_code = Tcl_Eval(_interpreter, [statement UTF8String]);
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInt:return_code], TCL_RETURN_CODE,
|
||||
[NSString stringWithUTF8String:Tcl_GetStringResult(_interpreter)], TCL_RETURN_STRING, nil];
|
||||
}
|
||||
*/
|
||||
|
||||
- (NSArray *)arrayFromTclListAsString:(NSString *)list {
|
||||
NSMutableArray *array;
|
||||
@@ -464,6 +508,8 @@ int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int ob
|
||||
return [NSString stringWithUTF8String:Tcl_GetVar(_interpreter, [variable UTF8String], 0)];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Helper Tool(s) Code
|
||||
- (NSString *) evaluateStringWithMPHelperTool:(NSString *) statement {
|
||||
OSStatus err;
|
||||
BASFailCode failCode;
|
||||
@@ -479,7 +525,7 @@ int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int ob
|
||||
assert(request != NULL);
|
||||
|
||||
bundleID = [[NSBundle bundleForClass:[self class]] bundleIdentifier];
|
||||
|
||||
|
||||
assert(bundleID != NULL);
|
||||
|
||||
|
||||
@@ -526,30 +572,48 @@ int Notifications_Command(ClientData clientData, Tcl_Interp *interpreter, int ob
|
||||
|
||||
|
||||
/*
|
||||
NSString * fakeResult = @"Frustrated";
|
||||
return fakeResult;
|
||||
|
||||
//Read from file and see if it was written to
|
||||
NSString * testFilePath = [[NSBundle bundleForClass:[self class]]
|
||||
pathForResource:@"TestFile" ofType:@"test"];
|
||||
NSError * readError = nil;
|
||||
NSString * result = [NSString stringWithContentsOfFile:testFilePath
|
||||
encoding:NSUTF8StringEncoding
|
||||
error:&readError];
|
||||
if (readError) {
|
||||
NSLog(@"Error is %@", [readError description]);
|
||||
return @"There was an error Reading";
|
||||
}
|
||||
else if ([result isEqualToString:@""]) {
|
||||
return @"An empty string was read";
|
||||
}
|
||||
else if (result == nil) {
|
||||
return @"Resulting String is NIL";
|
||||
}
|
||||
else
|
||||
return result;
|
||||
|
||||
return @"This shouldn't happen";
|
||||
*/
|
||||
NSString * fakeResult = @"Frustrated";
|
||||
return fakeResult;
|
||||
|
||||
//Read from file and see if it was written to
|
||||
NSString * testFilePath = [[NSBundle bundleForClass:[self class]]
|
||||
pathForResource:@"TestFile" ofType:@"test"];
|
||||
NSError * readError = nil;
|
||||
NSString * result = [NSString stringWithContentsOfFile:testFilePath
|
||||
encoding:NSUTF8StringEncoding
|
||||
error:&readError];
|
||||
if (readError) {
|
||||
NSLog(@"Error is %@", [readError description]);
|
||||
return @"There was an error Reading";
|
||||
}
|
||||
else if ([result isEqualToString:@""]) {
|
||||
return @"An empty string was read";
|
||||
}
|
||||
else if (result == nil) {
|
||||
return @"Resulting String is NIL";
|
||||
}
|
||||
else
|
||||
return result;
|
||||
|
||||
return @"This shouldn't happen";
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
-(NSString *) evaluateStringWithSimpleMPDOPHelperTool:(NSString *)statement {
|
||||
NSTask * task = [[NSTask alloc] init];
|
||||
[task setLaunchPath:[[NSBundle bundleForClass:[MPInterpreter class]]
|
||||
pathForResource:@"SimpleDOMPHelperTool"
|
||||
ofType:nil]];
|
||||
[task setArguments:[NSArray arrayWithObjects:statement, nil]];
|
||||
[task launch];
|
||||
|
||||
[task waitUntilExit];
|
||||
|
||||
[task terminationStatus];
|
||||
|
||||
return [self getTclCommandResult];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
- (void)testInitialization;
|
||||
- (void)testGetVariableAsArray;
|
||||
- (void)testMPHelperTool;
|
||||
//- (void)testMPHelperTool;
|
||||
//- (void)testMutableDictionaryFromTclListAsString;
|
||||
//- (void)testEvaluateStringAsString;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
- (void)testMPHelperTool {
|
||||
|
||||
//Here goes nothing
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
- (NSString *)version;
|
||||
|
||||
|
||||
//Notifications stuff
|
||||
//Notifications stuff for private use and testing purposes
|
||||
-(void)registerForLocalNotifications;
|
||||
-(void)respondToLocalNotification:(NSNotification *) notification;
|
||||
|
||||
|
||||
@@ -113,7 +113,10 @@
|
||||
//result = [interpreter evaluateStringAsString:@"mportsync" error:sError];
|
||||
|
||||
//Testing DO implementation
|
||||
result = [interpreter evaluateStringWithMPHelperTool:@"mportsync"];
|
||||
//result = [interpreter evaluateStringWithMPHelperTool:@"mportsync"];
|
||||
[interpreter evaluateStringWithSimpleMPDOPHelperTool:@"mportsync"];
|
||||
|
||||
result = [interpreter getTclCommandResult];
|
||||
|
||||
[[MPNotifications sharedListener] setPerformingTclCommand:@""];
|
||||
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"MacPortsSyncFinished" object:nil];
|
||||
@@ -247,10 +250,10 @@ withVariants:(NSArray *)variants
|
||||
|
||||
#pragma mark Testing MacPorts Notifications
|
||||
-(void) registerForLocalNotifications {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(respondToLocalNotification:)
|
||||
name:MPINFO
|
||||
object:nil];
|
||||
//[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
// selector:@selector(respondToLocalNotification:)
|
||||
// name:MPINFO
|
||||
// object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(respondToLocalNotification:)
|
||||
@@ -267,6 +270,16 @@ withVariants:(NSArray *)variants
|
||||
name:MPWARN
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(respondToLocalNotification:)
|
||||
name:MPDEBUG
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(respondToLocalNotification:)
|
||||
name:MPDEFAULT
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(respondToLocalNotification:)
|
||||
name:@"testMacPortsNotification"
|
||||
@@ -278,9 +291,9 @@ withVariants:(NSArray *)variants
|
||||
|
||||
//Just NSLog it for now
|
||||
if(sentDict == nil)
|
||||
NSLog(@"Looooocaaaaal");
|
||||
NSLog(@"MPMacPorts received notification with empty userInfo Dictionary");
|
||||
else
|
||||
NSLog(@"%@" , [sentDict description]);
|
||||
NSLog(@"MPMacPorts received notification with userInfo %@" , [sentDict description]);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
-(void) testPathToPortIndex;
|
||||
//-(void) testDepends;
|
||||
//-(void) testSearch;
|
||||
//-(void) testSync;
|
||||
-(void) testSync;
|
||||
-(void) testVersion;
|
||||
//-(void) testInstall;
|
||||
//-(void) testMPHelperTool;
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
STAssertNotNil(searchResults, @"This dictionary should have at least %d key value pairs", [searchResults count]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
-(void) testSync {
|
||||
NSError * syncError = nil;
|
||||
[testPort sync:&syncError];
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
-(void) testSelfupdate {
|
||||
//The only way to test this that I know of is to listen for the posted notifications
|
||||
//and take actions as appropriate
|
||||
|
||||
@@ -1,10 +1,37 @@
|
||||
//
|
||||
// MPMutableDictionary.h
|
||||
// MacPorts.Framework
|
||||
//
|
||||
// Created by Randall Hansen Wood on 26/9/2007.
|
||||
// Copyright 2007 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
/*
|
||||
* $Id$
|
||||
* MacPorts.Framework
|
||||
*
|
||||
* Authors:
|
||||
* Randall H. Wood <rhwood@macports.org>
|
||||
*
|
||||
* Copyright (c) 2007 Randall H. Wood <rhwood@macports.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright owner nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*!
|
||||
@header
|
||||
|
||||
@@ -1,10 +1,37 @@
|
||||
//
|
||||
// MPMutableDictionary.m
|
||||
// MacPorts.Framework
|
||||
//
|
||||
// Created by Randall Hansen Wood on 26/9/2007.
|
||||
// Copyright 2007 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
/*
|
||||
* $Id$
|
||||
* MacPorts.Framework
|
||||
*
|
||||
* Authors:
|
||||
* Randall H. Wood <rhwood@macports.org>
|
||||
*
|
||||
* Copyright (c) 2007 Randall H. Wood <rhwood@macports.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright owner nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#import "MPMutableDictionary.h"
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#define MPDEFAULT @"MPDefaultNotification"
|
||||
#define MPMSG @"MPMsgNotification"
|
||||
#define MPINFO @"MPInfoNotification"
|
||||
#define MPWARN @"MPWarnNotification"
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
6EB6FA420E43ECCE0057962C /* MPHelperTool in Resources */ = {isa = PBXBuildFile; fileRef = 6ED12A4A0E3E552F0026773D /* MPHelperTool */; };
|
||||
6EB6FA460E43ECD60057962C /* MPHelperInstallTool in Resources */ = {isa = PBXBuildFile; fileRef = 6EC260870E426FF10013BC48 /* MPHelperInstallTool */; };
|
||||
6EB6FB270E448EE20057962C /* TestFile.test in Resources */ = {isa = PBXBuildFile; fileRef = 6EB6FB260E448EE20057962C /* TestFile.test */; };
|
||||
6EB6FB630E44AF140057962C /* MPHelperTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 6EB6FB620E44AF140057962C /* MPHelperTool.m */; };
|
||||
6EB6FC6A0E45AC610057962C /* MPInterpreterProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EB6FC690E45AC610057962C /* MPInterpreterProtocol.h */; };
|
||||
6EB6FC6B0E45AC610057962C /* MPInterpreterProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EB6FC690E45AC610057962C /* MPInterpreterProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
6EB6FC910E45DEA80057962C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EB6FC900E45DEA80057962C /* Foundation.framework */; };
|
||||
@@ -61,6 +60,14 @@
|
||||
6EC2609A0E4272D20013BC48 /* MPHelperCommon.c in Sources */ = {isa = PBXBuildFile; fileRef = 6EC260960E4272D20013BC48 /* MPHelperCommon.c */; };
|
||||
6EC2609B0E4273920013BC48 /* BetterAuthorizationSampleLibInstallTool.c in Sources */ = {isa = PBXBuildFile; fileRef = 6EC260720E426FC80013BC48 /* BetterAuthorizationSampleLibInstallTool.c */; };
|
||||
6EC2609E0E42950C0013BC48 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EC2609D0E42950C0013BC48 /* CoreFoundation.framework */; };
|
||||
6ECD96FB0E465BF100488335 /* SimpleDOMPHelperTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 6ECD96F90E465BF100488335 /* SimpleDOMPHelperTool.m */; };
|
||||
6ECD97090E465C2A00488335 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EB6FC900E45DEA80057962C /* Foundation.framework */; };
|
||||
6ECD970E0E465C7800488335 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6ECD970D0E465C7800488335 /* Security.framework */; };
|
||||
6ECD970F0E465C7800488335 /* Tcl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EA0F56E0DFEB55E00C15082 /* Tcl.framework */; };
|
||||
6ECD97120E465C8500488335 /* SimpleDOMPHelperTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 6ECD96F90E465BF100488335 /* SimpleDOMPHelperTool.m */; };
|
||||
6ECD97180E465CB300488335 /* MPInterpreterProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EB6FC690E45AC610057962C /* MPInterpreterProtocol.h */; };
|
||||
6ECD973F0E465F6A00488335 /* SimpleDOMPHelperTool in Resources */ = {isa = PBXBuildFile; fileRef = 6ECD97050E465C0F00488335 /* SimpleDOMPHelperTool */; };
|
||||
6ECD98110E484E8400488335 /* MPHelperTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 6ECD98100E484E8400488335 /* MPHelperTool.m */; };
|
||||
6ED12A550E3E55DF0026773D /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6ED12A540E3E55DF0026773D /* Security.framework */; };
|
||||
6ED12A560E3E55DF0026773D /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6ED12A540E3E55DF0026773D /* Security.framework */; };
|
||||
6ED12AF10E3E9E210026773D /* Tcl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EA0F56E0DFEB55E00C15082 /* Tcl.framework */; };
|
||||
@@ -83,6 +90,13 @@
|
||||
remoteGlobalIDString = 6EC260860E426FF10013BC48;
|
||||
remoteInfo = MPHelperInstallTool;
|
||||
};
|
||||
6ECD97400E465F7400488335 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 6ECD97040E465C0F00488335 /* SimpleDOMPHelperTool */;
|
||||
remoteInfo = SimpleDOMPHelperTool;
|
||||
};
|
||||
6ED12A520E3E55A50026773D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||
@@ -129,7 +143,7 @@
|
||||
6EA0F56E0DFEB55E00C15082 /* Tcl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Tcl.framework; path = System/Library/Frameworks/Tcl.framework; sourceTree = SDKROOT; };
|
||||
6EAFD8B70DEC614E00E97270 /* dummycommit.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dummycommit.test; sourceTree = "<group>"; };
|
||||
6EB6FB260E448EE20057962C /* TestFile.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TestFile.test; sourceTree = "<group>"; };
|
||||
6EB6FB620E44AF140057962C /* MPHelperTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPHelperTool.m; sourceTree = "<group>"; };
|
||||
6EB6FB620E44AF140057962C /* MPHelperTool.m.old2 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MPHelperTool.m.old2; sourceTree = "<group>"; };
|
||||
6EB6FC690E45AC610057962C /* MPInterpreterProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPInterpreterProtocol.h; sourceTree = "<group>"; };
|
||||
6EB6FC900E45DEA80057962C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
6EC260700E426FC80013BC48 /* BetterAuthorizationSampleLib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = BetterAuthorizationSampleLib.c; sourceTree = "<group>"; };
|
||||
@@ -139,6 +153,10 @@
|
||||
6EC260950E4272D20013BC48 /* MPHelperCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPHelperCommon.h; sourceTree = "<group>"; };
|
||||
6EC260960E4272D20013BC48 /* MPHelperCommon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = MPHelperCommon.c; sourceTree = "<group>"; };
|
||||
6EC2609D0E42950C0013BC48 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
|
||||
6ECD96F90E465BF100488335 /* SimpleDOMPHelperTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimpleDOMPHelperTool.m; sourceTree = "<group>"; };
|
||||
6ECD97050E465C0F00488335 /* SimpleDOMPHelperTool */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SimpleDOMPHelperTool; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6ECD970D0E465C7800488335 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
||||
6ECD98100E484E8400488335 /* MPHelperTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPHelperTool.m; sourceTree = "<group>"; };
|
||||
6ED12A4A0E3E552F0026773D /* MPHelperTool */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = MPHelperTool; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
6ED12A540E3E55DF0026773D /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = /System/Library/Frameworks/Security.framework; sourceTree = "<absolute>"; };
|
||||
6ED12AA60E3E7E900026773D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
||||
@@ -162,6 +180,16 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6ECD97030E465C0F00488335 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6ECD97090E465C2A00488335 /* Foundation.framework in Frameworks */,
|
||||
6ECD970E0E465C7800488335 /* Security.framework in Frameworks */,
|
||||
6ECD970F0E465C7800488335 /* Tcl.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6ED12A480E3E552F0026773D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -193,6 +221,7 @@
|
||||
489DD8F40C94365F00595506 /* Test.octest */,
|
||||
6ED12A4A0E3E552F0026773D /* MPHelperTool */,
|
||||
6EC260870E426FF10013BC48 /* MPHelperInstallTool */,
|
||||
6ECD97050E465C0F00488335 /* SimpleDOMPHelperTool */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -200,7 +229,7 @@
|
||||
0867D691FE84028FC02AAC07 /* MacPorts Foundation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6ED12A460E3E54A80026773D /* MPHelperTool */,
|
||||
6ED12A460E3E54A80026773D /* MPHelperTools */,
|
||||
6EA293540E05C8C600902D12 /* Tcl Notifications */,
|
||||
6E88D1760DF46A2600684E9F /* Tests */,
|
||||
08FB77AEFE84172EC02AAC07 /* Classes */,
|
||||
@@ -213,6 +242,7 @@
|
||||
6ED12AA60E3E7E900026773D /* Cocoa.framework */,
|
||||
6EC2609D0E42950C0013BC48 /* CoreFoundation.framework */,
|
||||
6EB6FC900E45DEA80057962C /* Foundation.framework */,
|
||||
6ECD970D0E465C7800488335 /* Security.framework */,
|
||||
);
|
||||
name = "MacPorts Foundation";
|
||||
sourceTree = "<group>";
|
||||
@@ -319,7 +349,7 @@
|
||||
name = "Tcl Notifications ";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
6ED12A460E3E54A80026773D /* MPHelperTool */ = {
|
||||
6ED12A460E3E54A80026773D /* MPHelperTools */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
6EC260700E426FC80013BC48 /* BetterAuthorizationSampleLib.c */,
|
||||
@@ -327,14 +357,24 @@
|
||||
6EC260720E426FC80013BC48 /* BetterAuthorizationSampleLibInstallTool.c */,
|
||||
6EC260950E4272D20013BC48 /* MPHelperCommon.h */,
|
||||
6EC260960E4272D20013BC48 /* MPHelperCommon.c */,
|
||||
6EB6FB620E44AF140057962C /* MPHelperTool.m */,
|
||||
6EB6FB620E44AF140057962C /* MPHelperTool.m.old2 */,
|
||||
6ECD96F90E465BF100488335 /* SimpleDOMPHelperTool.m */,
|
||||
6ECD98100E484E8400488335 /* MPHelperTool.m */,
|
||||
);
|
||||
name = MPHelperTool;
|
||||
name = MPHelperTools;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
6ECD97190E465CD100488335 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6ECD97180E465CB300488335 /* MPInterpreterProtocol.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6ED12AD30E3E9AE10026773D /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -402,6 +442,23 @@
|
||||
productReference = 6EC260870E426FF10013BC48 /* MPHelperInstallTool */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
6ECD97040E465C0F00488335 /* SimpleDOMPHelperTool */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 6ECD970A0E465C4900488335 /* Build configuration list for PBXNativeTarget "SimpleDOMPHelperTool" */;
|
||||
buildPhases = (
|
||||
6ECD97190E465CD100488335 /* Headers */,
|
||||
6ECD97020E465C0F00488335 /* Sources */,
|
||||
6ECD97030E465C0F00488335 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = SimpleDOMPHelperTool;
|
||||
productName = SimpleDOMPHelperTool;
|
||||
productReference = 6ECD97050E465C0F00488335 /* SimpleDOMPHelperTool */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
6ED12A490E3E552F0026773D /* MPHelperTool */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 6ED12A500E3E55660026773D /* Build configuration list for PBXNativeTarget "MPHelperTool" */;
|
||||
@@ -435,6 +492,7 @@
|
||||
dependencies = (
|
||||
6ED12A530E3E55A50026773D /* PBXTargetDependency */,
|
||||
6EC2608C0E4270110013BC48 /* PBXTargetDependency */,
|
||||
6ECD97410E465F7400488335 /* PBXTargetDependency */,
|
||||
);
|
||||
name = MacPorts;
|
||||
productInstallPath = "$(HOME)/Library/Frameworks";
|
||||
@@ -458,6 +516,7 @@
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
6ECD97040E465C0F00488335 /* SimpleDOMPHelperTool */,
|
||||
6EC260860E426FF10013BC48 /* MPHelperInstallTool */,
|
||||
6ED12A490E3E552F0026773D /* MPHelperTool */,
|
||||
8DC2EF4F0486A6940098B216 /* MacPorts */,
|
||||
@@ -486,6 +545,7 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6ECD973F0E465F6A00488335 /* SimpleDOMPHelperTool in Resources */,
|
||||
6EB6FA460E43ECD60057962C /* MPHelperInstallTool in Resources */,
|
||||
6EB6FA420E43ECCE0057962C /* MPHelperTool in Resources */,
|
||||
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
|
||||
@@ -509,7 +569,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n\n#rm -rf notifications.dylib\necho removing BAStuff\n\ncd ~\nsh mptooluninstall.sh\n\necho done removing BAStuff";
|
||||
shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n\n#rm -rf notifications.dylib\n\n\n\ncd ~\nif [ -f /Library/LaunchDaemons/org.macports.frameworks.macports.plist ]\nthen\n\techo removing BAStuff\n\tsh mptooluninstall.sh\n\techo done removing BAStuff\nelse\n\techo nothing to Remove\nfi";
|
||||
};
|
||||
6E49F4F40E00DD520030C3AF /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
@@ -557,13 +617,21 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6ECD97020E465C0F00488335 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6ECD97120E465C8500488335 /* SimpleDOMPHelperTool.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
6ED12A470E3E552F0026773D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6EC260730E426FC80013BC48 /* BetterAuthorizationSampleLib.c in Sources */,
|
||||
6EC260980E4272D20013BC48 /* MPHelperCommon.c in Sources */,
|
||||
6EB6FB630E44AF140057962C /* MPHelperTool.m in Sources */,
|
||||
6ECD98110E484E8400488335 /* MPHelperTool.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -581,6 +649,7 @@
|
||||
6E270D0A0E158CED00BAE687 /* MPNotifications.m in Sources */,
|
||||
6EC260760E426FC80013BC48 /* BetterAuthorizationSampleLib.c in Sources */,
|
||||
6EC2609A0E4272D20013BC48 /* MPHelperCommon.c in Sources */,
|
||||
6ECD96FB0E465BF100488335 /* SimpleDOMPHelperTool.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -597,6 +666,11 @@
|
||||
target = 6EC260860E426FF10013BC48 /* MPHelperInstallTool */;
|
||||
targetProxy = 6EC2608B0E4270110013BC48 /* PBXContainerItemProxy */;
|
||||
};
|
||||
6ECD97410E465F7400488335 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 6ECD97040E465C0F00488335 /* SimpleDOMPHelperTool */;
|
||||
targetProxy = 6ECD97400E465F7400488335 /* PBXContainerItemProxy */;
|
||||
};
|
||||
6ED12A530E3E55A50026773D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 6ED12A490E3E552F0026773D /* MPHelperTool */;
|
||||
@@ -791,6 +865,36 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
6ECD97070E465C1100488335 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = SimpleDOMPHelperTool;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
6ECD97080E465C1100488335 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = SimpleDOMPHelperTool;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
6ED12A4C0E3E55300026773D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -881,6 +985,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
6ECD970A0E465C4900488335 /* Build configuration list for PBXNativeTarget "SimpleDOMPHelperTool" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
6ECD97070E465C1100488335 /* Debug */,
|
||||
6ECD97080E465C1100488335 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
6ED12A500E3E55660026773D /* Build configuration list for PBXNativeTarget "MPHelperTool" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
||||
@@ -42,3 +42,5 @@
|
||||
|
||||
//Including this file for testing the Notifications listener
|
||||
#import <MacPorts/MPNotifications.h>;
|
||||
//for testing Distributed objects
|
||||
#import <MacPorts/MPInterpreterProtocol.h>;
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
package require macports
|
||||
package require notifications
|
||||
|
||||
|
||||
#Set ui_options to log all messages to stdout and notify system
|
||||
#filtering is done on the Obj-C side of things
|
||||
set ui_options(ports_debug) "yes"
|
||||
set ui_options(ports_verbose) "yes"
|
||||
|
||||
# ui_options accessor
|
||||
proc ui_isset {val} {
|
||||
global ui_options
|
||||
@@ -79,6 +85,7 @@ proc ui_channels {priority} {
|
||||
#This is currently under works ... a reasonable solution
|
||||
#should be coming up soon
|
||||
proc ui_init {priority prefix channels message} {
|
||||
puts "INSIDE ui_init priority with prefix $prefix and message $message"
|
||||
|
||||
switch $priority {
|
||||
msg {
|
||||
@@ -86,15 +93,18 @@ proc ui_init {priority prefix channels message} {
|
||||
}
|
||||
debug {
|
||||
set "MPDebugNotification"
|
||||
#puts "Recieved Debug"
|
||||
}
|
||||
warn {
|
||||
set nottype "MPWarnNotification"
|
||||
}
|
||||
error {
|
||||
set nottype "MPErrorNotification"
|
||||
#puts "Recieved Error"
|
||||
}
|
||||
info {
|
||||
set nottype "MPInfoNotification"
|
||||
#puts "Recieved Info"
|
||||
}
|
||||
default {
|
||||
set nottype "MPDefaultNotification"
|
||||
@@ -107,12 +117,14 @@ proc ui_init {priority prefix channels message} {
|
||||
} catch * {
|
||||
set channels [ui_channels_default $priority]
|
||||
}
|
||||
|
||||
|
||||
#set channels [ui_channels $priority]
|
||||
|
||||
# Simplify ui_$priority.
|
||||
set nbchans [llength $channels]
|
||||
if {$nbchans == 0} {
|
||||
proc ::ui_$priority {str} [subst {
|
||||
notifications send $nottype "Channel $chan Prefix $prefix" "\$str"
|
||||
notifications send $nottype "$chan $prefix" "\$str"
|
||||
}]
|
||||
} else {
|
||||
try {
|
||||
@@ -120,19 +132,21 @@ proc ui_init {priority prefix channels message} {
|
||||
} catch * {
|
||||
set prefix [ui_prefix_default $priority]
|
||||
}
|
||||
|
||||
|
||||
#set prefix [ui_prefix $priority]
|
||||
|
||||
if {$nbchans == 1} {
|
||||
set chan [lindex $channels 0]
|
||||
|
||||
proc ::ui_$priority {str} [subst {
|
||||
puts $chan "$prefix\$str"
|
||||
notifications send $nottype "Channel $chan Prefix $prefix" "\$str"
|
||||
notifications send $nottype "$chan $prefix" "\$str"
|
||||
}]
|
||||
} else {
|
||||
proc ::ui_$priority {str} [subst {
|
||||
foreach chan \$channels {
|
||||
puts $chan "$prefix\$str"
|
||||
notifications send $nottype "Channel $chan Prefix $prefix" "\$str"
|
||||
notifications send $nottype "$chan $prefix" "\$str"
|
||||
}
|
||||
}]
|
||||
}
|
||||
@@ -177,6 +191,7 @@ proc mportdeactivate {portname v optionslist} {
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Initialize dport
|
||||
# This must be done following parse of global options, as some options are
|
||||
# evaluated by dportinit.
|
||||
|
||||
Reference in New Issue
Block a user