From d1694954c7c39d8e138195f71b5ede1af9c13cd5 Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 27 Aug 2004 14:33:56 +0000 Subject: [PATCH] renamed PostgreSQL72 to PostgreSQL, install in Library/GDLAdaptors-1.1 git-svn-id: http://svn.opengroupware.org/SOPE/trunk@66 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-gdl1/GDLAccess/ChangeLog | 5 +- sope-gdl1/GDLAccess/EOAdaptor.m | 218 +++++++++++----------- sope-gdl1/GDLAccess/Version | 2 +- sope-gdl1/PostgreSQL/ChangeLog | 5 + sope-gdl1/PostgreSQL/GNUmakefile | 12 +- sope-gdl1/PostgreSQL/GNUmakefile.preamble | 6 +- sope-gdl1/PostgreSQL/Version | 2 +- 7 files changed, 132 insertions(+), 118 deletions(-) diff --git a/sope-gdl1/GDLAccess/ChangeLog b/sope-gdl1/GDLAccess/ChangeLog index b43a03b1..c160125d 100644 --- a/sope-gdl1/GDLAccess/ChangeLog +++ b/sope-gdl1/GDLAccess/ChangeLog @@ -1,4 +1,7 @@ -2004-08-27 Helge Hess +2004-08-27 Helge Hess + + * EOAdaptor.m: look for adaptor bundles in Library/GDLAdaptors-1.1/ + (v1.1.35) * increased version to v1.1 because it depends on libEOControl v4.3 (v1.1.34) diff --git a/sope-gdl1/GDLAccess/EOAdaptor.m b/sope-gdl1/GDLAccess/EOAdaptor.m index 366329e3..c63c5920 100644 --- a/sope-gdl1/GDLAccess/EOAdaptor.m +++ b/sope-gdl1/GDLAccess/EOAdaptor.m @@ -53,123 +53,129 @@ return adaptor; } ++ (NSArray *)adaptorSearchPathes { + // TODO: add support for Cocoa + static NSArray *searchPathes = nil; + NSDictionary *env; + NSMutableArray *ma; + id tmp; + + if (searchPathes != nil) return searchPathes; + + env = [[NSProcessInfo processInfo] environment]; + ma = [NSMutableArray arrayWithCapacity:8]; + + if ((tmp = [env objectForKey:@"GNUSTEP_PATHPREFIX_LIST"]) == nil) + tmp = [env objectForKey:@"GNUSTEP_PATHLIST"]; + tmp = [tmp componentsSeparatedByString:@":"]; + if ([tmp count] > 0) { + NSEnumerator *e; + + e = [tmp objectEnumerator]; + while ((tmp = [e nextObject])) { + tmp = [tmp stringByAppendingPathComponent:@"Library/GDLAdaptors-1.1"]; + if (![ma containsObject:tmp]) + [ma addObject:tmp]; + } + } + else { + NSLog(@"%s: empty library search path !", __PRETTY_FUNCTION__); + } + searchPathes = [ma copy]; + return searchPathes; +} + + (id)adaptorWithName:(NSString *)adaptorName { - int i, count; - NSBundle *bundle = [NSBundle mainBundle]; - NSString *adaptorBundlePath = nil; - NSArray *adaptorsPath = nil; - NSMutableArray *paths = nil; - Class adaptorClass = Nil; - NSProcessInfo *pInfo = nil; - NSDictionary *env = nil; - NSMutableString *gdl, *user, *local, *system; - - bundle = [NSBundle mainBundle]; + int i, count; + NSBundle *bundle; + NSString *adaptorBundlePath = nil; + Class adaptorClass = Nil; + + bundle = [NSBundle mainBundle]; + + /* Check error */ + if ((adaptorName == nil) || [adaptorName isEqual:@""]) + return nil; + + /* Look in application bundle */ + bundle = [NSBundle mainBundle]; + adaptorBundlePath = + [bundle pathForResource:adaptorName ofType:@"gdladaptor"]; + + /* Look in standard paths */ + if (adaptorBundlePath == nil) { + NSFileManager *fm; + NSString *dirname; + NSArray *paths; + + fm = [NSFileManager defaultManager]; + paths = [self adaptorSearchPathes]; + dirname = [adaptorName stringByAppendingPathExtension:@"gdladaptor"]; + + /* Loop through the paths and check each one */ + for (i = 0, count = [paths count]; i < count; i++) { + NSString *p; + BOOL isDir; + + p = [[paths objectAtIndex:i] stringByAppendingPathComponent:dirname]; + if (![fm fileExistsAtPath:p isDirectory:&isDir]) + continue; + if (!isDir) + continue; + + adaptorBundlePath = p; + break; + } + } + + /* Make adaptor bundle */ + bundle = adaptorBundlePath + ? [NSBundle bundleWithPath:adaptorBundlePath] + : nil; - /* Check error */ - if ((adaptorName == nil) || [adaptorName isEqual:@""]) - return nil; - - /* Look in application bundle */ - adaptorBundlePath = - [bundle pathForResource:adaptorName ofType:@"gdladaptor"]; - - /* Look in standard paths */ - if (adaptorBundlePath == nil) { - /* - The path of where to search for the adaptor files - is based upon environment variables. - GDL_ADAPTORS_PATH - GNUSTEP_USER_ROOT - GNUSTEP_LOCAL_ROOT - GNUSTEP_SYSTEM_ROOT - */ - pInfo = [NSProcessInfo processInfo]; - env = [pInfo environment]; - paths = [NSMutableArray array]; - - /* GDL_ADAPTORS_PATH is a separated list of paths */ - gdl = [env objectForKey: @"GDL_ADAPTORS_PATH"]; - if (gdl) adaptorsPath = [gdl componentsSeparatedByString:@":"]; - - if (adaptorsPath) [paths addObjectsFromArray: adaptorsPath]; - - user = AUTORELEASE([[env objectForKey: @"GNUSTEP_USER_ROOT"] - mutableCopyWithZone:[self zone]]); - [user appendString: @"/Libraries"]; - if (user) [paths addObject: user]; - - local = AUTORELEASE([[env objectForKey: @"GNUSTEP_LOCAL_ROOT"] - mutableCopyWithZone:[self zone]]); - [local appendString: @"/Libraries"]; - if (local) [paths addObject: local]; - - system = AUTORELEASE([[env objectForKey: @"GNUSTEP_SYSTEM_ROOT"] - mutableCopy]); - [system appendString: @"/Libraries"]; - if (system) - [paths addObject: system]; - - /* Loop through the paths and check each one */ - for(i = 0, count = [paths count]; i < count; i++) { - bundle = [NSBundle bundleWithPath: [paths objectAtIndex:i]]; - adaptorBundlePath = [bundle pathForResource:adaptorName - ofType:@"gdladaptor" - inDirectory:@"Adaptors"]; - - if((adaptorBundlePath != nil) && [adaptorBundlePath length]) - break; - } - } - - /* Make adaptor bundle */ - bundle = adaptorBundlePath - ? [NSBundle bundleWithPath:adaptorBundlePath] - : nil; - - /* Check bundle */ - if (bundle == nil) { - NSLog(@"Cannot find adaptor bundle '%@'", adaptorName); + /* Check bundle */ + if (bundle == nil) { + NSLog(@"Cannot find adaptor bundle '%@'", adaptorName); #if 0 - [[[[CannotFindAdaptorBundleException alloc] - initWithFormat:@"Cannot find adaptor bundle '%@'", - adaptorName] autorelease] raise]; + [[[[CannotFindAdaptorBundleException alloc] + initWithFormat:@"Cannot find adaptor bundle '%@'", + adaptorName] autorelease] raise]; #endif - return nil; - } + return nil; + } - /* load bundle */ + /* load bundle */ - if (![bundle load]) { - NSLog(@"Cannot load adaptor bundle '%@'", adaptorName); + if (![bundle load]) { + NSLog(@"Cannot load adaptor bundle '%@'", adaptorName); #if 1 - [[[[InvalidAdaptorBundleException alloc] - initWithFormat:@"Cannot load adaptor bundle '%@'", - adaptorName] autorelease] raise]; + [[[[InvalidAdaptorBundleException alloc] + initWithFormat:@"Cannot load adaptor bundle '%@'", + adaptorName] autorelease] raise]; #endif - return nil; - } + return nil; + } - /* Get the adaptor bundle "infoDictionary", and pricipal class, ie. the - adaptor class. Other info about the adaptor should be put in the - bundle's "Info.plist" file (property list format - see NSBundle class - documentation for details about reserved keys in this dictionary - property list containing one entry whose key is adaptorClassName. It - identifies the actual adaptor class from the bundle. */ + /* Get the adaptor bundle "infoDictionary", and pricipal class, ie. the + adaptor class. Other info about the adaptor should be put in the + bundle's "Info.plist" file (property list format - see NSBundle class + documentation for details about reserved keys in this dictionary + property list containing one entry whose key is adaptorClassName. It + identifies the actual adaptor class from the bundle. */ - adaptorClass = [bundle principalClass]; - if (adaptorClass == Nil) { - NSLog(@"The adaptor bundle '%@' at '%@' doesn't contain " - @"a principal class (infoDict=%@)", - adaptorName, [bundle bundlePath], [bundle infoDictionary]); + adaptorClass = [bundle principalClass]; + if (adaptorClass == Nil) { + NSLog(@"The adaptor bundle '%@' at '%@' doesn't contain " + @"a principal class (infoDict=%@)", + adaptorName, [bundle bundlePath], [bundle infoDictionary]); - [[[InvalidAdaptorBundleException alloc] - initWithFormat:@"The adaptor bundle '%@' doesn't contain " - @"a principal class (infoDict=%@)", - adaptorName, [bundle infoDictionary]] - raise]; - } - return AUTORELEASE([[adaptorClass alloc] initWithName:adaptorName]); + [[[InvalidAdaptorBundleException alloc] + initWithFormat:@"The adaptor bundle '%@' doesn't contain " + @"a principal class (infoDict=%@)", + adaptorName, [bundle infoDictionary]] + raise]; + } + return AUTORELEASE([[adaptorClass alloc] initWithName:adaptorName]); } - (id)initWithName:(NSString*)_name { diff --git a/sope-gdl1/GDLAccess/Version b/sope-gdl1/GDLAccess/Version index 188c9170..e9a7f011 100644 --- a/sope-gdl1/GDLAccess/Version +++ b/sope-gdl1/GDLAccess/Version @@ -1,3 +1,3 @@ # $Id: Version 1 2004-08-20 10:38:46Z znek $ -SUBMINOR_VERSION:=34 +SUBMINOR_VERSION:=35 diff --git a/sope-gdl1/PostgreSQL/ChangeLog b/sope-gdl1/PostgreSQL/ChangeLog index 89a00128..72a36a6e 100644 --- a/sope-gdl1/PostgreSQL/ChangeLog +++ b/sope-gdl1/PostgreSQL/ChangeLog @@ -1,3 +1,8 @@ +2004-08-27 Helge Hess + + * GNUmakefile*: renamed bundle to PostgreSQL, now installs in + Library/GDLAdaptors-1.1/ (v1.1.35) + 2004-08-21 Helge Hess * renamed from (misleading name) PostgreSQL72 to PostgreSQL diff --git a/sope-gdl1/PostgreSQL/GNUmakefile b/sope-gdl1/PostgreSQL/GNUmakefile index f73bb891..b70c0eb1 100644 --- a/sope-gdl1/PostgreSQL/GNUmakefile +++ b/sope-gdl1/PostgreSQL/GNUmakefile @@ -26,9 +26,9 @@ include $(GNUSTEP_MAKEFILES)/common.make -BUNDLE_NAME = PostgreSQL72 +BUNDLE_NAME = PostgreSQL -PostgreSQL72_OBJC_FILES = \ +PostgreSQL_OBJC_FILES = \ PGConnection.m \ PostgreSQL72Expression.m \ PostgreSQL72Adaptor.m \ @@ -44,15 +44,15 @@ PostgreSQL72_OBJC_FILES = \ NSCalendarDate+PGVal.m \ NSNumber+PGVal.m \ -PostgreSQL72_PRINCIPAL_CLASS = PostgreSQL72Adaptor +PostgreSQL_PRINCIPAL_CLASS = PostgreSQL72Adaptor -BUNDLE_INSTALL = PostgreSQL72 -BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Libraries/Adaptors +BUNDLE_INSTALL = PostgreSQL +BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/GDLAdaptors-1.1/ # Use .gdladaptor as the bundle extension BUNDLE_EXTENSION = .gdladaptor -PostgreSQL72_RESOURCE_FILES += Version +PostgreSQL_RESOURCE_FILES += Version # tool diff --git a/sope-gdl1/PostgreSQL/GNUmakefile.preamble b/sope-gdl1/PostgreSQL/GNUmakefile.preamble index 7202e72a..2666f41f 100644 --- a/sope-gdl1/PostgreSQL/GNUmakefile.preamble +++ b/sope-gdl1/PostgreSQL/GNUmakefile.preamble @@ -24,8 +24,8 @@ # $Id: GNUmakefile.preamble 1 2004-08-20 10:38:46Z znek $ -PostgreSQL72_BUNDLE_LIBS += -lpq -PostgreSQL72_BUNDLE_LIBS += -lGDLAccess -lEOControl +PostgreSQL_BUNDLE_LIBS += -lpq +PostgreSQL_BUNDLE_LIBS += -lGDLAccess -lEOControl gdltest_TOOL_LIBS += -lGDLAccess @@ -63,7 +63,7 @@ ADDITIONAL_LIB_DIRS += \ ifeq ($(FOUNDATION_LIB),apple) -PostgreSQL72_BUNDLE_LIBS += -lssl -lcrypto +PostgreSQL_BUNDLE_LIBS += -lssl -lcrypto ADDITIONAL_INCLUDE_DIRS += -I/Library/PostgreSQL/include/ diff --git a/sope-gdl1/PostgreSQL/Version b/sope-gdl1/PostgreSQL/Version index 188c9170..e9a7f011 100644 --- a/sope-gdl1/PostgreSQL/Version +++ b/sope-gdl1/PostgreSQL/Version @@ -1,3 +1,3 @@ # $Id: Version 1 2004-08-20 10:38:46Z znek $ -SUBMINOR_VERSION:=34 +SUBMINOR_VERSION:=35 -- 2.39.5