- Timestamp:
- Mar 17, 2009, 12:07:42 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301/psModules
- Files:
-
- 9 edited
- 2 copied
-
. (modified) (1 prop)
-
src/config/Makefile.am (modified) (3 diffs)
-
src/config/pmConfig.c (modified) (12 diffs)
-
src/config/pmConfigCamera.c (modified) (2 diffs)
-
src/config/pmConfigDump.c (modified) (1 diff)
-
src/config/pmConfigRecipes.c (modified) (6 diffs)
-
src/config/pmConfigRecipes.h (modified) (3 diffs)
-
src/config/pmConfigRun.c (copied) (copied from trunk/psModules/src/config/pmConfigRun.c )
-
src/config/pmConfigRun.h (copied) (copied from trunk/psModules/src/config/pmConfigRun.h )
-
src/config/pmVersion.c (modified) (1 diff)
-
src/config/pmVersion.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301/psModules
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/cnb_branches/cnb_branch_20090215/psModules merged eligible /trunk/psModules merged eligible /branches/cnb_branch_20090215/psModules 21495-22685 /branches/eam_branches/eam_branch_20090303/psModules 23158-23228
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/cnb_branches/cnb_branch_20090301/psModules/src/config/Makefile.am
r18905 r23351 1 1 noinst_LTLIBRARIES = libpsmodulesconfig.la 2 2 3 libpsmodulesconfig_la_CPPFLAGS = $(SRCINC) $(PSMODULES_CFLAGS) 3 # PSMODULES_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 # PSMODULES_BRANCH=`if [ -e ../../BRANCH ]; then cat ../../BRANCH; else svn info | sed -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'; fi` 5 # PSMODULES_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 7 # Force recompilation of pmVersion.c, since it gets the version information 8 # pmVersion.c: FORCE 9 # touch pmVersion.c 10 # FORCE: ; 11 12 libpsmodulesconfig_la_CPPFLAGS = $(SRCINC) $(PSMODULES_CFLAGS) -DPSMODULES_VERSION=$(SVN_VERSION) -DPSMODULES_BRANCH=$(SVN_BRANCH) -DPSMODULES_SOURCE=$(SVN_SOURCE) 4 13 libpsmodulesconfig_la_LDFLAGS = -release $(PACKAGE_VERSION) 5 14 libpsmodulesconfig_la_SOURCES = \ … … 10 19 pmConfigMask.c \ 11 20 pmConfigDump.c \ 21 pmConfigRun.c \ 12 22 pmVersion.c \ 13 23 pmErrorCodes.c … … 20 30 pmConfigMask.h \ 21 31 pmConfigDump.h \ 32 pmConfigRun.h \ 22 33 pmVersion.h \ 23 34 pmErrorCodes.h -
branches/cnb_branches/cnb_branch_20090301/psModules/src/config/pmConfig.c
r21314 r23351 13 13 14 14 #include <stdio.h> 15 #include <stdlib.h> 15 16 #include <string.h> 16 17 #include <strings.h> /* for strn?casecmp */ … … 24 25 #include <pslib.h> 25 26 26 #include "pmConfig.h"27 27 #include "pmErrorCodes.h" 28 28 #include "pmFPALevel.h" 29 29 #include "pmConfigRecipes.h" 30 30 #include "pmConfigCamera.h" 31 #include "pmConfigRun.h" 32 33 #include "pmConfig.h" 31 34 32 35 #ifdef HAVE_NEBCLIENT … … 142 145 config->format = NULL; 143 146 config->formatName = NULL; 144 config->recipes = psMetadataAlloc();147 config->recipes = NULL; 145 148 config->recipesRead = PM_RECIPE_SOURCE_NONE; 146 149 config->recipesCamera = psMetadataAlloc(); … … 432 435 // variable will contain the name of the configuration file. 433 436 434 char *configFile = NULL; 435 // 437 char *configFile = NULL; // Name of configuration file 438 436 439 // First, try command line 437 //438 440 psS32 argNum = psArgumentGet(*argc, argv, "-ipprc"); 439 441 if (argNum != 0) { … … 447 449 } 448 450 } 449 // 451 450 452 // Next, try environment variable 451 //452 453 if (!configFile) { 453 454 configFile = getenv(IPPRC_ENV); 454 455 if (configFile) { 455 configFile = psStringCopy (configFile); 456 } 457 } 458 459 // 456 configFile = psStringCopy(configFile); 457 } 458 } 459 460 460 // Last chance is ~/.ipprc 461 //462 461 if (!configFile) { 463 462 char *home = getenv("HOME"); … … 466 465 } 467 466 468 // We have the configuration filename; now we read and parse the config 469 // file and store in psMetadata struct user. 467 // Read and parse the config file and store in struct user. 470 468 // XXX move this section to pmConfigReadUser.c ? 471 472 469 if (!pmConfigFileRead(&config->user, configFile, "user")) { 473 470 psFree(config); … … 477 474 psFree(configFile); 478 475 479 // XXX why was this being called here? Is someone calling pmConfigRead multiple times? 480 // pmConfigDone(); 481 assert (configPath == NULL); 476 pmConfigRunCommand(config, *argc, argv); 482 477 483 478 // define the config-file search path (configPath). 479 psAssert(configPath == NULL, "Configuration path is already defined."); 484 480 psString path = psMetadataLookupStr(NULL, config->user, "PATH"); 485 pmConfigSet (path);481 pmConfigSet(path); 486 482 487 483 // read the SITE file … … 525 521 psLogSetLevel(logLevel); 526 522 } 527 528 523 529 524 // Set logging format … … 648 643 } 649 644 645 // Set the random number generator seed 646 { 647 psU64 seed = 0; // RNG seed 648 int argNum = psArgumentGet(*argc, argv, "-seed"); // Argument number 649 if (argNum > 0) { 650 psArgumentRemove(argNum, argc, argv); 651 if (argNum >= *argc) { 652 psWarning("-seed command-line switch provided without the required seed value --- ignored."); 653 } else { 654 char *end = NULL; // Pointer to end of consumed string 655 seed = strtoll(argv[argNum], &end, 0); 656 if (strlen(end) > 0) { 657 psError(PS_ERR_IO, true, "Unable to read random number generator seed: %s", argv[argNum]); 658 psFree(config); 659 return NULL; 660 } 661 psArgumentRemove(argNum, argc, argv); 662 } 663 } 664 pmConfigRunSeed(config, seed); 665 } 666 650 667 // Next, we do a similar thing for the camera configuration file. The 651 668 // file is read and parsed into psMetadata struct "camera". … … 1110 1127 // camera. If we are discovering the camera (config->camera == NULL), then we also load the 1111 1128 // recipe files for the camera. 1112 psMetadata *pmConfigCameraFormatFromHeader(psMetadata **camera, psString *cameraName, psString *formatName, 1113 pmConfig *config, const psMetadata *header, bool readRecipes)1129 psMetadata *pmConfigCameraFormatFromHeader(psMetadata **camera, psString *cameraName, psString *formatName, 1130 pmConfig *config, const psMetadata *header, bool readRecipes) 1114 1131 { 1115 1132 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 1672 1689 // if the object does not exist and create isn't set, then we 1673 1690 // should puke 1674 psError(PM_ERR_SYS, true, "Unable to access file %s ", filename);1691 psError(PM_ERR_SYS, true, "Unable to access file %s: %s", filename, nebErr(server)); 1675 1692 nebServerFree(server); 1676 1693 return NULL; … … 1685 1702 if (trunc) { 1686 1703 if(truncate(path, 0) != 0) { 1687 psError(PS_ERR_IO, true, "Failed to truncate Nebulous file %s (real name %s)\n", filename, path); 1704 psError(PS_ERR_IO, true, "Failed to truncate Nebulous file %s (real name %s)\n", 1705 filename, path); 1688 1706 return NULL; 1689 1707 } -
branches/cnb_branches/cnb_branch_20090301/psModules/src/config/pmConfigCamera.c
r22700 r23351 213 213 psStringAppend(&newName, "_%s-SKYCELL", name); 214 214 if (psMetadataLookup(oldCameras, newName)) { 215 psFree(newName); 215 216 return true; 216 217 } … … 469 470 psStringAppend(&newName, "_%s-%s", name, mosaicLevel == PM_FPA_LEVEL_CHIP ? "CHIP" : "FPA"); 470 471 if (psMetadataLookup(oldCameras, newName)) { 472 psFree(newName); 471 473 return true; 472 474 } -
branches/cnb_branches/cnb_branch_20090301/psModules/src/config/pmConfigDump.c
r19399 r23351 54 54 psArray *keep = psStringSplitArray(save, " ,;", false); // List of items to keep 55 55 56 bool result = configCull(config->recipes, keep); // Result of culling 56 if (!configCull(config->recipes, keep)) { 57 psError(PS_ERR_UNKNOWN, false, "Unable to cull system recipes."); 58 psFree(keep); 59 return false; 60 } 57 61 psFree(keep); 58 62 59 return result; 63 // Need to cull recipes from all cameras as well 64 psMetadata *cameras = psMetadataLookupMetadata(NULL, config->system, "CAMERAS"); // Known cameras 65 if (!cameras) { 66 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find CAMERAS in the system configuration.\n"); 67 return false; 68 } 69 70 psMetadataIterator *iter = psMetadataIteratorAlloc(cameras, PS_LIST_HEAD, NULL); // Iterator for cameras 71 psMetadataItem *item; // Item from iteration 72 keep = psArrayAllocEmpty(1); 73 while ((item = psMetadataGetAndIncrement(iter))) { 74 psAssert(item->type == PS_DATA_METADATA, "Should only be metadata types on the camera list."); 75 psMetadata *camera = item->data.md; // Camera configuration 76 bool mdok; // Status of MD lookup 77 psMetadata *recipes = psMetadataLookupMetadata(&mdok, camera, "RECIPES"); // Recipe overrides 78 if (!recipes) { 79 continue; 80 } 81 if (!configCull(recipes, keep)) { 82 psError(PS_ERR_UNKNOWN, false, "Unable to cull recipes for camera %s", item->name); 83 psFree(iter); 84 psFree(keep); 85 return false; 86 } 87 } 88 psFree(iter); 89 psFree(keep); 90 91 return true; 60 92 } 61 93 -
branches/cnb_branches/cnb_branch_20090301/psModules/src/config/pmConfigRecipes.c
r21387 r23351 11 11 #include "pmConfigRecipes.h" 12 12 13 static bool loadRecipeSystem(bool *status, pmConfig *config , psMetadata *source);13 static bool loadRecipeSystem(bool *status, pmConfig *config); 14 14 static bool loadRecipeCamera(bool *status, pmConfig *config, psMetadata *source); 15 15 static bool loadRecipeSymbols(bool *status, pmConfig *config, pmRecipeSource source); … … 56 56 PS_ASSERT_PTR_NON_NULL(config, false); 57 57 58 if (!config->recipes) {59 config->recipes = psMetadataAlloc();60 }61 62 58 // Read the recipe file names from the system configuration and camera configuration 63 59 // It is an error for config->system:recipes not to exist. all programs install their 64 60 // master recipe files in the system:recipe location when they are built. 65 61 psAssert(config->system, "base config data defined"); 66 if ( source & PM_RECIPE_SOURCE_SYSTEM) {67 if (!loadRecipeSystem(&status, config , config->system)) {62 if (!config->recipes || (source & PM_RECIPE_SOURCE_SYSTEM)) { 63 if (!loadRecipeSystem(&status, config)) { 68 64 psError(PS_ERR_IO, false, "Failed to read recipes from system config"); 69 65 return false; … … 321 317 // Load the recipe files for SYSTEM : REQUIRED 322 318 static bool loadRecipeSystem(bool *status, 323 pmConfig *config, // The configuration into which to read the recipes 324 psMetadata *source // The source configuration, from which to read the filenames 319 pmConfig *config // The configuration into which to read the recipes 325 320 ) 326 321 { … … 329 324 *status = false; 330 325 331 if (! source) {326 if (!config->system) { 332 327 psError(PS_ERR_IO, true, 333 328 "The system configuration has not been read --- cannot read recipes from this location.\n"); … … 336 331 } 337 332 338 psMetadata *recipes = psMetadataLookupMetadata(NULL, source, "RECIPES"); // The list of recipes339 if (!recipes) {340 psError(PS_ERR_IO, false, "RECIPES not found in the system configuration\n");341 return false;342 }343 344 // Copy contents of the filenames to config->recipes from the "RECIPES" metadata in the source.345 // We could use psMetadataCopy for this, but it's better to check that everything's of the correct type. 346 // If it's not of the correct type, we can tell the user which file it's in, so they can find it easier.347 psMetadataIterator *recipesIter = psMetadataIteratorAlloc( recipes, PS_LIST_HEAD, NULL); // Iterator333 if (!config->recipes) { 334 config->recipes = psMemIncrRefCounter(psMetadataLookupMetadata(NULL, config->system, "RECIPES")); // The list of recipes 335 if (!config->recipes) { 336 psError(PS_ERR_IO, false, "RECIPES not found in the system configuration\n"); 337 return false; 338 } 339 } 340 341 // Read in the component recipes 342 psMetadataIterator *recipesIter = psMetadataIteratorAlloc(config->recipes, PS_LIST_HEAD, NULL); // Iterator 348 343 psMetadataItem *item = NULL; // MD item containing the filename, from recipe iteration 349 344 while ((item = psMetadataGetAndIncrement(recipesIter))) { … … 353 348 psFree(recipesIter); 354 349 return false; 355 } 356 357 // add the contents of this recipe file to config->recipes 358 psMetadataAdd(config->recipes, PS_LIST_TAIL, item->name, PS_DATA_METADATA | PS_META_REPLACE, 359 item->comment, item->data.md); 350 } 360 351 } 361 352 psFree(recipesIter); -
branches/cnb_branches/cnb_branch_20090301/psModules/src/config/pmConfigRecipes.h
r12916 r23351 1 1 /* @file pmConfigRecipes.h 2 2 * @brief Configuration Recipe functions 3 * 3 * 4 4 * @author ?, MHPCC 5 5 * @author Paul Price, IfA 6 6 * @author Eugene Magnier, IfA 7 * 7 * 8 8 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 9 9 * @date $Date: 2007-04-19 02:10:12 $ … … 13 13 #ifndef PM_CONFIG_RECIPES_H 14 14 #define PM_CONFIG_RECIPES_H 15 16 #include <pmConfig.h> 15 17 16 18 /// @addtogroup Config Configuration System … … 26 28 27 29 28 bool pmConfigLoadRecipeArguments (int *argc, char **argv, pmConfig *config);29 bool pmConfigLoadRecipeOptions (int *argc, char **argv, pmConfig *config, char *flag);30 psMetadata *pmConfigRecipeOptions (pmConfig *config, char *recipe);30 bool pmConfigLoadRecipeArguments(int *argc, char **argv, pmConfig *config); 31 bool pmConfigLoadRecipeOptions(int *argc, char **argv, pmConfig *config, char *flag); 32 psMetadata *pmConfigRecipeOptions(pmConfig *config, char *recipe); 31 33 32 34 /// @} -
branches/cnb_branches/cnb_branch_20090301/psModules/src/config/pmVersion.c
r10291 r23351 8 8 #include "pmVersion.h" 9 9 10 static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name 10 #ifndef PSMODULES_VERSION 11 #error "PSMODULES_VERSION is not set" 12 #endif 13 #ifndef PSMODULES_BRANCH 14 #error "PSMODULES_BRANCH is not set" 15 #endif 16 #ifndef PSMODULES_SOURCE 17 #error "PSMODULES_SOURCE is not set" 18 #endif 19 20 #define xstr(s) str(s) 21 #define str(s) #s 11 22 12 23 psString psModulesVersion(void) 13 24 { 14 psString version = NULL; // Version, to return15 psStringAppend(&v ersion, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION);16 return v ersion;25 char *value = NULL; 26 psStringAppend(&value, "%s@%s", xstr(PSMODULES_BRANCH), xstr(PSMODULES_VERSION)); 27 return value; 17 28 } 29 30 psString psModulesSource(void) 31 { 32 return psStringCopy(xstr(PSMODULES_SOURCE)); 33 } 34 18 35 19 36 psString psModulesVersionLong(void) 20 37 { 21 psString version = psModulesVersion(); // Version, to return22 psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag38 psString version = psModulesVersion(); // Version, to return 39 psString source = psModulesSource(); // Source 23 40 24 psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__); 41 psStringPrepend(&version, "psModules "); 42 psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__); 43 psFree(source); 25 44 26 psFree(tag); 45 #ifdef __OPTIMIZE__ 46 psStringAppend(&version, " optimised"); 47 #else 48 psStringAppend(&version, " unoptimised"); 49 #endif 50 51 #ifdef HAVE_NEBCLIENT 52 psStringAppend(&version, " with nebclient"); 53 #else 54 psStringAppend(&version, " without nebclient"); 55 #endif 56 27 57 return version; 58 }; 59 60 61 bool psModulesVersionHeader(psMetadata *header) 62 { 63 PS_ASSERT_METADATA_NON_NULL(header, false); 64 65 psString version = psModulesVersion(); // Software version 66 psString source = psModulesSource(); // Software source 67 68 psStringPrepend(&version, "psModules version: "); 69 psStringPrepend(&source, "psModules source: "); 70 71 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, version); 72 psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, source); 73 74 psFree(version); 75 psFree(source); 76 77 return true; 28 78 } -
branches/cnb_branches/cnb_branch_20090301/psModules/src/config/pmVersion.h
r12696 r23351 1 1 /* @file pmVersion.h 2 2 * @brief Version functions 3 * 3 * 4 4 * @author Paul Price, IfA 5 5 * @author Eugene Magnier, IfA 6 * 6 * 7 7 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 8 8 * @date $Date: 2007-03-30 21:12:56 $ … … 22 22 * @return psString: String with version name. 23 23 */ 24 psString psModulesVersion( 25 void 26 ); 24 psString psModulesVersion(void); 25 26 /** Get current psModules source 27 * 28 * Returns the current psModules source as a string. 29 * 30 * @return psString: String with source. 31 */ 32 psString psModulesSource(void); 27 33 28 34 /** Get current psModules version (full identification) … … 34 40 psString psModulesVersionLong(void); 35 41 42 /// Populate a header with version information 43 bool psModulesVersionHeader( 44 psMetadata *header ///< Header to populate 45 ); 46 47 36 48 /// @} 37 49 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
