[39218] branches/gsoc08-framework/MacPorts_Framework_Release
armahg at macports.org
armahg at macports.org
Tue Aug 12 11:51:01 PDT 2008
Revision: 39218
http://trac.macosforge.org/projects/macports/changeset/39218
Author: armahg at macports.org
Date: 2008-08-12 11:51:00 -0700 (Tue, 12 Aug 2008)
Log Message:
-----------
Cleaned up code for MPMacPorts. Renamed port exec methods based on blbmp's suggestion
Modified Paths:
--------------
branches/gsoc08-framework/MacPorts_Framework_Release/MPMacPorts.h
branches/gsoc08-framework/MacPorts_Framework_Release/MPMacPorts.m
branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.h
branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.m
Modified: branches/gsoc08-framework/MacPorts_Framework_Release/MPMacPorts.h
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework_Release/MPMacPorts.h 2008-08-12 18:13:21 UTC (rev 39217)
+++ branches/gsoc08-framework/MacPorts_Framework_Release/MPMacPorts.h 2008-08-12 18:51:00 UTC (rev 39218)
@@ -148,7 +148,7 @@
@Discussion See -exec: withOptions: withVariants: in @link //apple_ref/doc/header/MPPort.h MPPort @/link for discussion
of this method.
*/
-- (void)exec:(MPPort *)port withTarget:(NSString *)target withOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)execError;
+- (void)exec:(MPPort *)port withTarget:(NSString *)target options:(NSArray *)options variants:(NSArray *)variants error:(NSError **)execError;
/*!
@brief Returns the NSString path to the directory where ports are installed.
Modified: branches/gsoc08-framework/MacPorts_Framework_Release/MPMacPorts.m
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework_Release/MPMacPorts.m 2008-08-12 18:13:21 UTC (rev 39217)
+++ branches/gsoc08-framework/MacPorts_Framework_Release/MPMacPorts.m 2008-08-12 18:51:00 UTC (rev 39218)
@@ -112,12 +112,6 @@
result = [interpreter evaluateStringAsString:@"mportsync" error:sError];
- //Testing DO implementation
- //result = [interpreter evaluateStringWithMPHelperTool:@"mportsync"];
- //[interpreter evaluateStringWithSimpleMPDOPHelperTool:@"mportsync"];
-
- //result = [interpreter getTclCommandResult];
-
[[MPNotifications sharedListener] setPerformingTclCommand:@""];
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"MacPortsSyncFinished" object:nil];
@@ -149,8 +143,6 @@
}
- (NSDictionary *)search:(NSString *)query caseSensitive:(BOOL)sensitivity matchStyle:(NSString *)style field:(NSString *)fieldName {
- //Should I notify for searches? Will do for now just in case
- //[[MPNotifications sharedListener] setPerformingTclCommand:@"YES_search"];
NSMutableDictionary *result, *newResult;
NSEnumerator *enumerator;
@@ -161,17 +153,7 @@
} else {
caseSensitivity = @"no";
}
- /*result = [NSMutableDictionary dictionaryWithDictionary:
- [interpreter dictionaryFromTclListAsString:
- [[interpreter evaluateArrayAsString:
- [NSArray arrayWithObjects:
- @"return [mportsearch",
- query,
- caseSensitivity,
- style,
- fieldName,
- @"]",
- nil]] objectForKey:TCL_RETURN_STRING] ]];*/
+
NSError * sError;
result = [NSMutableDictionary dictionaryWithDictionary:
@@ -187,7 +169,7 @@
[newResult setObject:[[MPPort alloc] initWithTclListAsString:[result objectForKey:key]] forKey:key];
}
- //[[MPNotifications sharedListener] setPerformingTclCommand:@""];
+
return [NSDictionary dictionaryWithDictionary:newResult];
}
@@ -198,11 +180,11 @@
- (void)exec:(MPPort *)port
withTarget:(NSString *)target
- withOptions:(NSArray *)options
-withVariants:(NSArray *)variants
+ options:(NSArray *)options
+ variants:(NSArray *)variants
error:(NSError **)execError
{
- [port exec:target withOptions:options withVariants:variants error:execError ];
+ [port exec:target withOptions:options variants:variants error:execError ];
}
#pragma settings
@@ -231,11 +213,11 @@
- (NSURL *)pathToPortIndex:(NSString *)source {
- NSError * pError;
+
return [NSURL fileURLWithPath:
[interpreter evaluateStringAsString:
[NSString stringWithFormat:@"return [macports::getindex %@ ]", source]
- error:&pError]];
+ error:nil]];
}
Modified: branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.h
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.h 2008-08-12 18:13:21 UTC (rev 39217)
+++ branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.h 2008-08-12 18:51:00 UTC (rev 39218)
@@ -155,7 +155,7 @@
ADD SOMETHING HERE ABOUT VARIANTS AND OPTIONS
*/
--(void)exec:(NSString *)target withOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)execError;
+-(void)exec:(NSString *)target withOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)execError;
/*Convenience methods based on the exec: withTarget: method
These methods and -exec: need to be rewritten to handle variants
@@ -170,32 +170,32 @@
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
*/
--(void)configureWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)configureWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Builds this port.
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
*/
--(void)buildWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)buildWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Tests this port.
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
*/
--(void)testWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)testWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Installs this port to a temporary directory
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
*/
--(void)destrootWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)destrootWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Installs this port.
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
@discussion Installing a port automatically activates it.
*/
--(void)installWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)installWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Archives port for later unarchving.
@discussion Archive mode must be enabled for this command to work.
@@ -203,53 +203,53 @@
located in ${prefix}/etc/macports/macports.conf. With archive mode enabled,
binary archives are created automatically whenever an install is performed.
*/
--(void)archiveWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)archiveWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Creates an internet-enabled disk image containing OS X package of this
port
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
*/
--(void)createDmgWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)createDmgWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Create an internet-enabled disk image containing an OS X metapackage of this
port
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
*/
--(void)createMdmgWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)createMdmgWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Creates an OS X installer package of this port
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
*/
--(void)createPkgWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)createPkgWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Creates an OS X installer metapackage of this this port and
its dependencies
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
*/
--(void)createMpkgWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)createMpkgWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Creates and RPM binary package of this port. This is similar to a
tgz "archive".
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
*/
--(void)createRpmWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)createRpmWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Creates a DEB binary package of this port.
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
*/
--(void)createDpkgWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)createDpkgWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Creates an SRPM source package of this port, similar to a xar "portpkg".
@param options An NSArray of NSStrings of the various options for this target
@param variants An NSArray of NSStrings of the various variants for this target
*/
--(void)createSrpmWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError**)mError;
+-(void)createSrpmWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError**)mError;
/*!
@brief Sets the attributes of this MPPort using the given string
Modified: branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.m
===================================================================
--- branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.m 2008-08-12 18:13:21 UTC (rev 39217)
+++ branches/gsoc08-framework/MacPorts_Framework_Release/MPPort.m 2008-08-12 18:51:00 UTC (rev 39218)
@@ -26,8 +26,8 @@
* 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
+ * 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.
@@ -99,7 +99,7 @@
[self setObject:[interpreter arrayFromTclListAsString:[self objectForKey:@"depends_run"]] forKey:@"depends_run"];
[self addDependencyAsPortName:@"depends_run"];
}
-
+
@try {
if ([[self valueForKey:@"long_description"] characterAtIndex:0] == '{') {
[self setValue:[self valueForKey:@"description"] forKey:@"long_description"];
@@ -107,11 +107,11 @@
}
@catch (NSException *e) {
[self setValue:[NSString stringWithFormat:
- NSLocalizedStringWithDefaultValue(@"setPortWithTclListAsStringDescreiptionError",
- @"Localizable",
- [NSBundle mainBundle],
- @"Port has an invalid desciption or long_description key.",
- @"Error statement for exception raised when testing long_description.")]
+ NSLocalizedStringWithDefaultValue(@"setPortWithTclListAsStringDescreiptionError",
+ @"Localizable",
+ [NSBundle mainBundle],
+ @"Port has an invalid desciption or long_description key.",
+ @"Error statement for exception raised when testing long_description.")]
forKey:@"long_description"];
}
// set the status flag to unknown
@@ -138,7 +138,7 @@
- (NSArray *)depends {
return [[[NSArray arrayWithArray:[self valueForKey:@"depends_build"]]
- arrayByAddingObjectsFromArray:[self valueForKey:@"depends_lib"]]
+ arrayByAddingObjectsFromArray:[self valueForKey:@"depends_lib"]]
arrayByAddingObjectsFromArray:[self valueForKey:@"depends_run"]];
}
@@ -224,8 +224,8 @@
//Used for the rest of other exec procedures
-(void) exec:(NSString *)target
- withOptions:(NSArray *)options
-withVariants:(NSArray *)variants
+ withOptions:(NSArray *)options
+ variants:(NSArray *)variants
error:(NSError **)execError{
NSString *opts;
@@ -277,62 +277,62 @@
[self execPortProc:@"mportdeactivate" withOptions:options withVersion:version error:mError];
}
--(void)configureWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError {
- [self exec:@"configure" withOptions:options withVariants:variants error:mError];
+-(void)configureWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError {
+ [self exec:@"configure" withOptions:options variants:variants error:mError];
}
--(void)buildWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError {
- [self exec:@"build" withOptions:options withVariants:variants error:mError];
+-(void)buildWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError {
+ [self exec:@"build" withOptions:options variants:variants error:mError];
}
--(void)testWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError {
- [self exec:@"test" withOptions:options withVariants:variants error:mError];
+-(void)testWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError {
+ [self exec:@"test" withOptions:options variants:variants error:mError];
}
--(void)destrootWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError {
- [self exec:@"destroot" withOptions:options withVariants:variants error:mError];
+-(void)destrootWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError {
+ [self exec:@"destroot" withOptions:options variants:variants error:mError];
}
--(void)installWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError {
- [self exec:@"install" withOptions:options withVariants:variants error:mError];
+-(void)installWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError {
+ [self exec:@"install" withOptions:options variants:variants error:mError];
}
--(void)archiveWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError {
- [self exec:@"archive" withOptions:options withVariants:variants error:mError];
+-(void)archiveWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError {
+ [self exec:@"archive" withOptions:options variants:variants error:mError];
}
--(void)createDmgWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError {
- [self exec:@"dmg" withOptions:options withVariants:variants error:mError];
+-(void)createDmgWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError {
+ [self exec:@"dmg" withOptions:options variants:variants error:mError];
}
--(void)createMdmgWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError {
- [self exec:@"mdmg" withOptions:options withVariants:variants error:mError];
+-(void)createMdmgWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError {
+ [self exec:@"mdmg" withOptions:options variants:variants error:mError];
}
--(void)createPkgWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError {
- [self exec:@"pkg" withOptions:options withVariants:variants error:mError];
+-(void)createPkgWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError {
+ [self exec:@"pkg" withOptions:options variants:variants error:mError];
}
--(void)createMpkgWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError {
- [self exec:@"mpkg" withOptions:options withVariants:variants error:mError];
+-(void)createMpkgWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError {
+ [self exec:@"mpkg" withOptions:options variants:variants error:mError];
}
--(void)createRpmWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError{
- [self exec:@"rpm" withOptions:options withVariants:variants error:mError];
+-(void)createRpmWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError{
+ [self exec:@"rpm" withOptions:options variants:variants error:mError];
}
--(void)createDpkgWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError{
- [self exec:@"dpkg" withOptions:options withVariants:variants error:mError];
+-(void)createDpkgWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError{
+ [self exec:@"dpkg" withOptions:options variants:variants error:mError];
}
--(void)createSrpmWithOptions:(NSArray *)options withVariants:(NSArray *)variants error:(NSError **)mError{
- [self exec:@"srpm" withOptions:options withVariants:variants error:mError];
+-(void)createSrpmWithOptions:(NSArray *)options variants:(NSArray *)variants error:(NSError **)mError{
+ [self exec:@"srpm" withOptions:options variants:variants error:mError];
}
# pragma mark -
-#pragma mark MPMutableDictionary Protocal
+#pragma mark MPMutableDictionary Protocol
- (id)objectForKey:(id)aKey {
if ([aKey isEqualToString:@"receipts"] && ![super objectForKey:aKey]) {
@@ -350,34 +350,34 @@
id receipt;
NSEnumerator *receiptsEnumerator;
switch (state) {
- case MPPortStateLearnState:
- if ([self objectForKey:@"receipts"]) {
- receiptsEnumerator = [[self objectForKey:@"receipts"] objectEnumerator];
- // 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
- [self setState:MPPortStateInstalled];
- while (receipt = [receiptsEnumerator nextObject]) {
- if ([receipt valueForKey:@"active"]) {
- [self setState:MPPortStateActive];
- [self setObject:receipt forKey:@"active"];
- if (![[receipt valueForKey:@"compositeVersion"] isEqualToString:[self valueForKey:@"compositeVersion"]]) {
- [self setState:MPPortStateOutdated];
+ case MPPortStateLearnState:
+ if ([self objectForKey:@"receipts"]) {
+ receiptsEnumerator = [[self objectForKey:@"receipts"] objectEnumerator];
+ // 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
+ [self setState:MPPortStateInstalled];
+ while (receipt = [receiptsEnumerator nextObject]) {
+ if ([receipt valueForKey:@"active"]) {
+ [self setState:MPPortStateActive];
+ [self setObject:receipt forKey:@"active"];
+ if (![[receipt valueForKey:@"compositeVersion"] isEqualToString:[self valueForKey:@"compositeVersion"]]) {
+ [self setState:MPPortStateOutdated];
+ }
}
}
+ } else {
+ [self setState:MPPortStateNotInstalled];
}
- } else {
- [self setState:MPPortStateNotInstalled];
- }
- break;
- case MPPortStateUnknown:
- [self removeObjectForKey:@"active"];
- [self removeObjectForKey:@"receipts"];
- [super setObject:[NSNumber numberWithInt:MPPortStateUnknown] forKey:@"state"];
- break;
- default:
- [super setObject:[NSNumber numberWithInt:state] forKey:@"state"];
- break;
+ break;
+ case MPPortStateUnknown:
+ [self removeObjectForKey:@"active"];
+ [self removeObjectForKey:@"receipts"];
+ [super setObject:[NSNumber numberWithInt:MPPortStateUnknown] forKey:@"state"];
+ break;
+ default:
+ [super setObject:[NSNumber numberWithInt:state] forKey:@"state"];
+ break;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080812/586ca0d4/attachment-0001.html
More information about the macports-changes
mailing list