Changeset 16542
- Timestamp:
- Feb 19, 2008, 10:09:10 AM (18 years ago)
- Location:
- branches/eam_branch_20080219
- Files:
-
- 2 added
- 16 edited
-
PS-IPP-Config/lib/PS/IPP/Config.pm (modified) (10 diffs)
-
ippTools/src/pxadminConfig.c (modified) (1 diff)
-
ippTools/src/pxtables.c (modified) (2 diffs)
-
ippconfig (modified) (1 prop)
-
ippconfig/.cvsignore (modified) (1 diff)
-
ippconfig/ipprc.config.in (modified) (1 diff)
-
ippconfig/site.config.in (added)
-
ippconfig/system.config (added)
-
ppConfigDump/src/ppConfigDump.c (modified) (1 diff)
-
psModules/src/camera/pmFPAfileDefine.c (modified) (2 diffs)
-
psModules/src/config/pmConfig.c (modified) (33 diffs)
-
psModules/src/config/pmConfig.h (modified) (5 diffs)
-
psModules/src/config/pmConfigCamera.c (modified) (11 diffs)
-
psModules/src/config/pmConfigCommand.c (modified) (1 diff)
-
psModules/src/config/pmConfigRecipes.c (modified) (10 diffs)
-
psModules/src/detrend/pmDetrendDB.c (modified) (2 diffs)
-
psphot/src/psphotOutput.c (modified) (1 diff)
-
pswarp/src/pswarpDefineSkycell.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080219/PS-IPP-Config/lib/PS/IPP/Config.pm
r16325 r16542 1 1 # Copyright (c) 2006 Paul Price, Joshua Hoblitt 2 2 # 3 # $Id: Config.pm,v 1.75 2008-02-06 02:05:44 price Exp $3 # $Id: Config.pm,v 1.75.2.1 2008-02-19 20:09:09 eugene Exp $ 4 4 5 5 package PS::IPP::Config; … … 62 62 my $name; # Name of ipprc file 63 63 GetOptions( 'site=s' => \$name ); 64 $name = $ENV{ PS_SITE} if not defined $name;64 $name = $ENV{IPPRC} if not defined $name; 65 65 if (not defined $name and defined $ENV{HOME}) { 66 66 $name = $ENV{HOME} . '/.ipprc'; … … 90 90 filerules => undef, # File rules from the camera configuration 91 91 rejection => undef, # Rejection data 92 _ipprc => $mdc # The parsed configuration 92 _userConfig => $mdc, # The top-level user configuration 93 _siteConfig => undef, # The site configuration (from _userConfig) 94 _systemConfig => undef # The system configuration (from _userConfig) 93 95 }; 94 96 bless $self, $class; 97 98 print "load site\n"; 99 $self->load_site(); 100 101 print "load system\n"; 102 $self->load_system(); 95 103 96 104 $self->define_camera($camera) if defined $camera; … … 140 148 } 141 149 150 # Load the site config file 151 sub load_site 152 { 153 my $self = shift; # Configuration object 154 155 my $i = 0; 156 print "$i"; $i ++; 157 158 unless (defined $self) { 159 carp "Programming error"; 160 exit($PS_EXIT_PROG_ERROR); 161 } 162 print "$i"; $i ++; 163 164 my $filename = metadataLookupStr($self->{_userConfig}, 'SITE'); # Site config file 165 unless (defined $filename) { 166 carp "Unable to find site configuration file\n"; 167 exit($PS_EXIT_CONFIG_ERROR); 168 } 169 print "$i"; $i ++; 170 171 my $realfile = $self->_find_config($filename); # Resolved filename, after hunting the PATH 172 print "$i"; $i ++; 173 174 # Read the file 175 my $file; # File handle 176 unless (open $file, $realfile) { 177 carp "Unable to open site configuration file $realfile: $!"; 178 exit($PS_EXIT_CONFIG_ERROR); 179 } 180 print "$i"; $i ++; 181 182 my @contents = <$file>; 183 close $file; 184 $self->{_siteConfig} = $parser->parse( join '', @contents); # The parsed metadata config 185 print "$i"; $i ++; 186 187 ## XXXX : the error is here 188 unless (defined $self->{_siteConfig}) { 189 carp "Failure to define site configuration"; 190 exit($PS_EXIT_CONFIG_ERROR); 191 } 192 print "$i"; $i ++; 193 194 # XXX why isn't just $self being returned here? -JH 195 return $self; 196 } 197 198 # Load the system config file 199 sub load_system 200 { 201 my $self = shift; # Configuration object 202 203 unless (defined $self) { 204 carp "Programming error"; 205 exit($PS_EXIT_PROG_ERROR); 206 } 207 208 my $filename = metadataLookupStr($self->{_userConfig}, 'SYSTEM'); # System config file 209 unless (defined $filename) { 210 carp "Unable to find system configuration file\n"; 211 exit($PS_EXIT_CONFIG_ERROR); 212 } 213 214 my $realfile = $self->_find_config($filename); # Resolved filename, after hunting the PATH 215 216 # Read the file 217 my $file; # File handle 218 unless (open $file, $realfile) { 219 carp "Unable to open system configuration file $realfile: $!"; 220 exit($PS_EXIT_CONFIG_ERROR); 221 } 222 my @contents = <$file>; 223 close $file; 224 $self->{_systemConfig} = $parser->parse( join '', @contents); # The parsed metadata config 225 226 unless (defined $self->{_systemConfig}) { 227 carp "Failure to define system configuration"; 228 exit($PS_EXIT_CONFIG_ERROR); 229 } 230 231 # XXX why isn't just $self being returned here? -JH 232 return $self; 233 } 234 142 235 # Define a camera to use 143 236 sub define_camera … … 151 244 } 152 245 153 my $camera_list = metadataLookupMD($self->{_ ipprc}, 'CAMERAS'); # List of cameras246 my $camera_list = metadataLookupMD($self->{_systemConfig}, 'CAMERAS'); # List of cameras 154 247 my $filename = metadataLookupStr($camera_list, $name); # Filename of camera configuration 155 248 unless (defined $filename) { … … 233 326 } 234 327 235 my $path_list = metadataLookupMD($self->{_ ipprc}, 'DATAPATH'); # List of paths328 my $path_list = metadataLookupMD($self->{_siteConfig}, 'DATAPATH'); # List of paths 236 329 my $pathname = metadataLookupStr($path_list, $name); # Path of interest 237 330 unless (defined $pathname) { … … 258 351 return 1 if defined $self->{nebulous}; # Already started 259 352 260 my $server = metadataLookupStr( $self->{_ ipprc}, 'NEB_SERVER' ); # Nebulous server353 my $server = metadataLookupStr( $self->{_siteConfig}, 'NEB_SERVER' ); # Nebulous server 261 354 unless (defined $server) { 262 355 carp "Unable to find NEB_SERVER in camera configuration file."; … … 561 654 my @dirs = File::Spec->splitdir( $name ); 562 655 563 my $path_list = metadataLookupMD($self->{_ ipprc}, 'DATAPATH'); # List of paths656 my $path_list = metadataLookupMD($self->{_siteConfig}, 'DATAPATH'); # List of paths 564 657 my $best_path; 565 658 my $best_name; … … 790 883 my $tess_id = shift; # Tessellation identifier 791 884 792 unless (defined $self and defined $self->{_ ipprc} and defined $tess_id) {793 carp "Programming error"; 794 exit($PS_EXIT_PROG_ERROR); 795 } 796 797 my $tessellations = metadataLookupMD($self->{_ ipprc}, 'TESSELLATIONS'); # Tessellations885 unless (defined $self and defined $self->{_siteConfig} and defined $tess_id) { 886 carp "Programming error"; 887 exit($PS_EXIT_PROG_ERROR); 888 } 889 890 my $tessellations = metadataLookupMD($self->{_siteConfig}, 'TESSELLATIONS'); # Tessellations 798 891 unless (defined $tessellations) { 799 892 carp "Can't find TESSELLATIONS in site configuration.\n"; … … 817 910 } 818 911 912 913 # Return catdir for the dvo db, from DVO.CATDIRS within the site configuration 914 sub dvo_catdir 915 { 916 my $self = shift; # Configuration object 917 my $dvodb = shift; # DVO db identifier 918 919 unless (defined $self and defined $self->{_siteConfig} and defined $dvodb) { 920 carp "Programming error"; 921 exit($PS_EXIT_PROG_ERROR); 922 } 923 924 my $catdirs = metadataLookupMD($self->{_siteConfig}, 'DVO.CATDIRS'); # Tessellations 925 unless (defined $catdirs) { 926 carp "Can't find DVO.CATDIRS in site configuration.\n"; 927 exit($PS_EXIT_CONFIG_ERROR); 928 } 929 930 my $catdir = metadataLookupStr($catdirs, $dvodb); 931 unless (defined $catdir) { 932 carp "Can't find dvodb identifier $dvodb in DVO.CATDIR in site configuration.\n"; 933 exit($PS_EXIT_CONFIG_ERROR); 934 } 935 936 ### Because DVO doesn't use psModules, it doesn't understand Nebulous --- check 937 my $scheme = file_scheme($catdir); # The scheme, e.g., file, path, neb 938 if (defined $scheme and lc($scheme) eq 'neb') { 939 carp "DVO catdir $dvodb refers to a Nebulous path: $catdir\n"; 940 exit($PS_EXIT_CONFIG_ERROR); 941 } 942 943 return $catdir 944 } 945 946 # Return catdir for the psastro reference, from PSASTRO.CATDIRS within the site configuration 947 sub psastro_catdir 948 { 949 my $self = shift; # Configuration object 950 my $dvodb = shift; # DVO db identifier 951 952 unless (defined $self and defined $self->{_siteConfig} and defined $dvodb) { 953 carp "Programming error"; 954 exit($PS_EXIT_PROG_ERROR); 955 } 956 957 my $catdirs = metadataLookupMD($self->{_siteConfig}, 'PSASTRO.CATDIRS'); # Tessellations 958 unless (defined $catdirs) { 959 carp "Can't find PSASTRO.CATDIRS in site configuration.\n"; 960 exit($PS_EXIT_CONFIG_ERROR); 961 } 962 963 my $catdir = metadataLookupStr($catdirs, $dvodb); 964 unless (defined $catdir) { 965 carp "Can't find dvodb identifier $dvodb in PSASTRO.CATDIR in site configuration.\n"; 966 exit($PS_EXIT_CONFIG_ERROR); 967 } 968 969 ### Because DVO doesn't use psModules, it doesn't understand Nebulous --- check 970 my $scheme = file_scheme($catdir); # The scheme, e.g., file, path, neb 971 if (defined $scheme and lc($scheme) eq 'neb') { 972 carp "PSASTRO catdir $dvodb refers to a Nebulous path: $catdir\n"; 973 exit($PS_EXIT_CONFIG_ERROR); 974 } 975 976 return $catdir 977 } 819 978 820 979 # Return the DVO.CAMERADIR in the camera configuration -
branches/eam_branch_20080219/ippTools/src/pxadminConfig.c
r16507 r16542 35 35 fprintf (stderr, " [mode] : -create | -delete\n\n"); 36 36 37 psString dbServer = psMetadataLookupStr(&status, config->modules-> site, "DBSERVER");38 psString dbUsername = psMetadataLookupStr(&status, config->modules-> site, "DBUSER");39 psString dbName = psMetadataLookupStr(&status, config->modules-> site, "DBNAME");40 psS32 dbPort = psMetadataLookupS32(&status, config->modules-> site, "DBPORT");37 psString dbServer = psMetadataLookupStr(&status, config->modules->xxSite, "DBSERVER"); 38 psString dbUsername = psMetadataLookupStr(&status, config->modules->xxSite, "DBUSER"); 39 psString dbName = psMetadataLookupStr(&status, config->modules->xxSite, "DBNAME"); 40 psS32 dbPort = psMetadataLookupS32(&status, config->modules->xxSite, "DBPORT"); 41 41 42 42 fprintf (stderr, "connecting to %s as %s (port %d)\n", dbServer, dbUsername, dbPort); -
branches/eam_branch_20080219/ippTools/src/pxtables.c
r16508 r16542 114 114 PS_ASSERT_PTR_NON_NULL(config, false); 115 115 116 psString dbName = psMetadataLookupStr(&status, config->modules->site, "DBNAME"); 116 // XXX use the values defined in config->dbh? 117 psString dbName = psMetadataLookupStr(&status, config->modules->xxSite, "DBNAME"); 117 118 118 119 fprintf (stdout, "*** delete the chip tables from database %s? ***\n", dbName); … … 134 135 { 135 136 bool status; 136 psString dbPassword = psMetadataLookupStr(&status, config->modules-> site, "DBPASSWORD");137 psString dbPassword = psMetadataLookupStr(&status, config->modules->xxSite, "DBPASSWORD"); 137 138 if (strcmp (answer, dbPassword)) { 138 139 psError(PS_ERR_UNKNOWN, true, "tables NOT deleleted"); -
branches/eam_branch_20080219/ippconfig
- Property svn:ignore
-
old new 12 12 missing 13 13 ipprc.config 14 site.config
-
- Property svn:ignore
-
branches/eam_branch_20080219/ippconfig/.cvsignore
r11577 r16542 12 12 missing 13 13 ipprc.config 14 site.config -
branches/eam_branch_20080219/ippconfig/ipprc.config.in
r16482 r16542 1 ## # Example .ipprc file1 ## Example .ipprc file : copy to your home directory and modify as desired 2 2 3 3 # Default search path for configuration files (add $HOME if desired) 4 # Note: do not include $HOME in the distributed copy used by ippMonitor 4 5 # PATH STR @pkgdatadir@:$HOME/.ipp:. 5 PATH STR @pkgdatadir@:. 6 # note: do not include $HOME in the distributed copy used by ippMonitor 6 PATH STR @pkgdatadir@:. 7 7 8 # place your data directories here and refer to as path://PATH/remainder 9 DATAPATH METADATA 10 ALALA STR /data/alala.0/ 11 ISP STR /data/ipp000.0/isp 12 ISP_V2 STR /data/ipp000.0/isp_v2 13 ISP_V3 STR /data/ipp000.0/isp_v3 14 ISP_TEST STR /data/ipp000.0/isp_test 15 EAMTEST STR /data/alala.0/eugene/swtests/simtest/raw 16 EAMWORK STR /data/alala.0/eugene/swtests/simtest/work 17 CFH12K STR /data/ipp003.0/eugene/cfh12k 18 DATA1 STR /data/alala.0/ 19 SRESS1 STR /data/ipp003.0/SM_W/sm030927/ 20 SRESSWORK STR /data/ipp003.0/rodney/sresswork 21 SIMTEST STR /data/po05.0/rodney/sim/ 22 SIMWORK STR /data/po05.0/rodney/simwork/ 23 MOPS STR /data/ipp002.0/MOPS/ 24 TALCS STR /data/ipp003.0/TALCS/ 25 END 8 # load the site-specific information from here 9 SITE STR site.config 26 10 27 NEB_SERVER STR http://alala:80/nebulous # Nebulous server 11 # load the system configuration information from here 12 SYSTEM STR system.config 28 13 29 ### Database configuration 30 DBSERVER STR ipp000 # Database host name (for psDBInit) 31 DBNAME STR ipp # Database name (for psDBInit) 32 DBUSER STR XXX # Database user name (for psDBInit) 33 DBPASSWORD STR XXX # Database password (for psDBInit) 34 35 ### Setups for each camera system 36 CAMERAS METADATA 37 MEGACAM STR megacam/camera.config 38 CFH12K STR cfh12k/camera.config 39 ISP-Apogee STR isp/camera.config 40 CTIO_MOSAIC2 STR ctio_mosaic2/camera.config # CTIO MOSAIC2 camera, for ESSENCE 41 SDSS STR sdss/camera.config # Sloan Digital Sky Survey 42 GPC1 STR gpc1/camera.config 43 ESOWFI STR esowfi/camera.config # ESO Wide-Field Imager 44 # UCAM STR ucam/camera.config 45 # LRIS_BLUE STR lris_blue/camera.config 46 # TC3 STR tc3/camera.config # Pan-STARRS Test Camera III 47 # LRIS_RED STR lris_red/camera.config 48 SIMMOSAIC STR simmosaic/camera.config # Simulated mosaic, for testing 49 SIMTEST STR simtest/camera.config 50 SIMPLE STR simple/camera.config 51 END 52 53 ### camera names as expected by DVO 54 DVO.CAMERAS METADATA 55 MEGACAM STR megacam 56 CFH12K STR cfh12k 57 ISP-Apogee STR isp 58 CTIO_MOSAIC2 STR ctio_mosaic2 59 SDSS STR sdss 60 GPC1 STR gpc1 61 ESOWFI STR esowfi 62 # UCAM STR ucam 63 # TC3 STR tc3 64 # LRIS_BLUE STR lris_blue 65 # LRIS_RED STR lris_red 66 SIMMOSAIC STR simmosaic 67 SIMTEST STR simtest 68 SIMPLE STR simple 69 END 70 71 ### psLib setup 72 #TIME STR /home/mithrandir/price/pan-starrs/jhroot/i686-pc-linux-gnu/etc/pslib/psTime.config # Time configuration file 14 # logging verbosity levels 73 15 LOGLEVEL S32 9 # Logging level; 3=INFO 74 16 LOGFORMAT STR THLNM # Log format 75 17 LOGDEST STR STDERR # Log destination 76 18 TRACEDEST STR STDERR # Trace destination 19 20 # place default trace lines here 77 21 TRACE METADATA # Trace levels 78 err S32 10 79 # place default trace lines here 80 # example: 81 # psLib.db S32 10 22 err S32 10 23 # psLib.db S32 10 82 24 END 83 84 RECIPES METADATA # Site-level recipes85 MASKS STR recipes/masks.config # Mask values86 REJECTIONS STR recipes/rejections.config # Rejection for detrend creation87 PPIMAGE STR recipes/ppImage.config # Image reduction88 PPMERGE STR recipes/ppMerge.config # Image combination89 PPSTATS STR recipes/ppStats.config # Image statistics90 PSPHOT STR recipes/psphot.config # Photometry91 PSASTRO STR recipes/psastro.config # Astrometry92 PPSTACK STR recipes/ppStack.config # Combination93 PSWARP STR recipes/pswarp.config # Warping94 PPSIM STR recipes/ppSim.config # Simulations95 PPSUB STR recipes/ppSub.config # Subtraction96 END97 98 # Header keywords for skycell concepts; required because DVO doesn't read HIERARCH99 SKYCELLS METADATA100 FPA.TIME STR MJD-OBS101 CELL.TIME STR MJD-OBS102 FPA.EXPOSURE STR EXPTIME103 CELL.EXPOSURE STR EXPTIME104 FPA.AIRMASS STR AIRMASS105 END106 107 # List of tessellations, and their DVO CATDIR108 TESSELLATIONS METADATA109 MOPS STR path://MOPS/skycells/110 END -
branches/eam_branch_20080219/ppConfigDump/src/ppConfigDump.c
r14189 r16542 112 112 } 113 113 114 const char *userName = psMetadataLookupStr(NULL, arguments, "-dump-user"); // User filename 115 dump(userName, "user configuration", config->xxUser); 116 114 117 const char *siteName = psMetadataLookupStr(NULL, arguments, "-dump-site"); // Site filename 115 dump(siteName, "site configuration", config->site); 118 dump(siteName, "site configuration", config->xxSite); 119 120 const char *systemName = psMetadataLookupStr(NULL, arguments, "-dump-system"); // System filename 121 dump(systemName, "system configuration", config->xxSystem); 116 122 117 123 const char *camName = psMetadataLookupStr(NULL, arguments, "-dump-camera"); // Camera filename -
branches/eam_branch_20080219/psModules/src/camera/pmFPAfileDefine.c
r16481 r16542 155 155 } else { 156 156 bool mdok; // Status of MD lookup 157 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config-> site, "CAMERAS"); // Known cameras157 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->xxSystem, "CAMERAS"); // Known cameras 158 158 if (!mdok || !cameras) { 159 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the s iteconfiguration.\n");159 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the system configuration.\n"); 160 160 return NULL; 161 161 } … … 163 163 if (!mdok || !camera) { 164 164 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find automatically generated " 165 "camera configuration %s in s iteconfiguration.\n", cameraName);165 "camera configuration %s in system configuration.\n", cameraName); 166 166 return NULL; 167 167 } -
branches/eam_branch_20080219/psModules/src/config/pmConfig.c
r16415 r16542 34 34 #endif // ifdef HAVE_NEBCLIENT 35 35 36 #define PS_SITE "PS_SITE" // Name of the environment variable containing the siteconfig file37 #define PS_DEFAULT_SITE ".ipprc" // Default siteconfig file36 #define IPPRC_ENV "IPPRC" // Name of the environment variable containing the top-level config file 37 #define IPPRC_FILE ".ipprc" // Default top-level config file 38 38 39 39 #define DEFAULT_LOG STDERR_FILENO // Default file descriptor for log messages … … 52 52 static void configFree(pmConfig *config) 53 53 { 54 psFree(config->site); 54 psFree(config->xxUser); 55 psFree(config->xxSite); 56 psFree(config->xxSystem); 55 57 psFree(config->files); 56 58 psFree(config->camera); … … 80 82 81 83 // Initialise 82 config->site = NULL; 84 config->xxUser = NULL; 85 config->xxSite = NULL; 86 config->xxSystem = NULL; 83 87 config->camera = NULL; 84 88 config->cameraName = NULL; … … 145 149 PS_ASSERT_STRING_NON_EMPTY(path,); 146 150 147 pmConfigDone(); 151 assert (configPath == NULL); 152 // XXX why was this being called? pmConfigSet should only be called once... 153 // pmConfigDone(); 148 154 149 155 psList *list = psStringSplit(path, ":", false); … … 159 165 void pmConfigDone(void) 160 166 { 161 psFree(configPath); 167 if (configPath) { 168 psFree(configPath); 169 } 162 170 configPath = NULL; 163 171 … … 380 388 config->defaultRecipe = defaultRecipe; 381 389 382 // 383 // The following section of code attempts to determine which file is 384 // the configuration file. At the end of this code block, the siteName 390 // The following section of code attempts to determine which file to use as the 391 // top-level the configuration file. At the end of this code block, the configFile 385 392 // variable will contain the name of the configuration file. 386 // 387 char * siteName = NULL;393 394 char *configFile = NULL; 388 395 // 389 396 // First, try command line 390 397 // 391 psS32 argNum = psArgumentGet(*argc, argv, "- site");398 psS32 argNum = psArgumentGet(*argc, argv, "-ipprc"); 392 399 if (argNum != 0) { 393 // 394 // We remove the "-site" argument from argv. Then 395 // we look for the next argument, which should be the filename, and 396 // remove it as well. 397 // 400 // remove the "-ipprc" argument from argv, check and remove filename 398 401 psArgumentRemove(argNum, argc, argv); 399 402 if (argNum >= *argc) { 400 psWarning("- sitecommand-line switch provided without the required filename --- ignored.\n");403 psWarning("-ipprc command-line switch provided without the required filename --- ignored.\n"); 401 404 } else { 402 siteName = psStringCopy(argv[argNum]);405 configFile = psStringCopy(argv[argNum]); 403 406 psArgumentRemove(argNum, argc, argv); 404 407 } … … 407 410 // Next, try environment variable 408 411 // 409 if (! siteName) {410 siteName = getenv(PS_SITE);411 if ( siteName) {412 siteName = psStringCopy (siteName);412 if (!configFile) { 413 configFile = getenv(IPPRC_ENV); 414 if (configFile) { 415 configFile = psStringCopy (configFile); 413 416 } 414 417 } … … 417 420 // Last chance is ~/.ipprc 418 421 // 419 if (! siteName) {422 if (!configFile) { 420 423 char *home = getenv("HOME"); 421 siteName = psStringCopy(home);422 psStringAppend(& siteName, "/%s", PS_DEFAULT_SITE);424 configFile = psStringCopy(home); 425 psStringAppend(&configFile, "/%s", IPPRC_FILE); 423 426 } 424 427 425 428 426 429 // We have the configuration filename; now we read and parse the config 427 // file and store in psMetadata struct site.428 // 429 430 if (!pmConfigFileRead(&config-> site, siteName, "site")) {430 // file and store in psMetadata struct xxUser. 431 // XXX move this section to pmConfigReadUser.c ? 432 433 if (!pmConfigFileRead(&config->xxUser, configFile, "user")) { 431 434 psFree(config); 432 435 return NULL; 433 436 } 434 437 435 // Set options based on the siteconfiguration.438 // Set options based on the user configuration. 436 439 { 437 440 bool mdok = true; // Status of MD lookup result 438 441 439 // Initialise the psLib time handling440 psString timeName = psMetadataLookupStr(&mdok, config->site, "TIME");441 if (mdok && timeName)442 {443 psTrace("psModules.config", 7, "Initialising psTime with file %s\n", timeName);444 psTimeInit(timeName);445 }446 447 448 442 // Set logging level 449 int logLevel = psMetadataLookupS32(&mdok, config-> site, "LOGLEVEL");443 int logLevel = psMetadataLookupS32(&mdok, config->xxUser, "LOGLEVEL"); 450 444 if (mdok && logLevel >= 0) 451 445 { … … 456 450 457 451 // Set logging format 458 psString logFormat = psMetadataLookupStr(&mdok, config-> site, "LOGFORMAT");452 psString logFormat = psMetadataLookupStr(&mdok, config->xxUser, "LOGFORMAT"); 459 453 if (mdok && logFormat) 460 454 { … … 463 457 } 464 458 465 // Set logging destination first from command line, second from siteconfiguration459 // Set logging destination first from command line, second from user configuration 466 460 psString logDest = NULL; // Logging destination 467 461 argNum = psArgumentGet(*argc, argv, "-log"); … … 477 471 } 478 472 if (!logDest) { 479 logDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config-> site, "LOGDEST"));473 logDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config->xxUser, "LOGDEST")); 480 474 } 481 475 if (logDest) { … … 497 491 498 492 // Set trace levels 499 psMetadata *trace = psMetadataLookupMetadata(&mdok, config-> site, "TRACE");493 psMetadata *trace = psMetadataLookupMetadata(&mdok, config->xxUser, "TRACE"); 500 494 if (mdok && trace) { 501 495 psMetadataIterator *traceIter = psMetadataIteratorAlloc(trace, PS_LIST_HEAD, NULL); // Iterator … … 515 509 516 510 // Set trace formats 517 psString traceFormat = psMetadataLookupStr(&mdok, config-> site, "TRACEFORMAT");511 psString traceFormat = psMetadataLookupStr(&mdok, config->xxUser, "TRACEFORMAT"); 518 512 if (mdok && traceFormat) { 519 513 psTrace("psModules.config", 7, "Setting trace format to %s\n", traceFormat); … … 535 529 } 536 530 if (!traceDest) { 537 traceDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config-> site, "TRACEDEST"));531 traceDest = psMemIncrRefCounter(psMetadataLookupStr(&mdok, config->xxUser, "TRACEDEST")); 538 532 } 539 533 if (traceDest) { … … 563 557 } 564 558 565 // define the config-file search path (configPath). Ensure that 566 // it contains the directory where we found the config file in 567 // the first place 568 if (configPath) { 569 pmConfigDone(); 570 } 571 572 psString siteNameDir = psStringCopy(dirname(siteName)); 573 psFree(siteName); 574 575 psString path = psMetadataLookupStr(NULL, config->site, "PATH"); 576 psString newPath = NULL; // New path 577 // The following gymnastics with 'newPath' are required to avoid changing the pointer out from under the 578 // psMetadataItem on which 'path' sits (leading to memory corruption because it no longer points to valid 579 // memory). 580 if (path) { 581 psStringAppend(&newPath, "%s:%s", path, siteNameDir); 582 } else { 583 newPath = psMemIncrRefCounter(siteNameDir); 584 } 585 psFree(siteNameDir); 586 pmConfigSet(newPath); 587 psFree(newPath); 559 // XXX why was this being called here? Is someone calling pmConfigRead multiple times? 560 // pmConfigDone(); 561 assert (configPath == NULL); 562 563 // define the config-file search path (configPath). 564 psString path = psMetadataLookupStr(NULL, config->xxUser, "PATH"); 565 pmConfigSet (path); 566 567 // load the SITE file 568 psString siteFile = psMetadataLookupStr(NULL, config->xxUser, "SITE"); 569 if (!pmConfigFileRead(&config->xxSite, siteFile, "site")) { 570 psFree(config); 571 return NULL; 572 } 573 574 // load the SYSTEM file 575 psString systemFile = psMetadataLookupStr(NULL, config->xxUser, "SYSTEM"); 576 if (!pmConfigFileRead(&config->xxSystem, systemFile, "system")) { 577 psFree(config); 578 return NULL; 579 } 580 581 // XXX read TIME from SITE (or system?) 582 { 583 bool mdok = true; 584 585 // Initialise the psLib time handling 586 // XXX is this still needed / desired? 587 psString timeName = psMetadataLookupStr(&mdok, config->xxSite, "TIME"); 588 if (mdok && timeName) 589 { 590 psTrace("psModules.config", 7, "Initialising psTime with file %s\n", timeName); 591 psTimeInit(timeName); 592 } 593 } 588 594 589 595 // Next, we do a similar thing for the camera configuration file. The 590 596 // file is read and parsed into psMetadata struct "camera". 591 //592 597 argNum = psArgumentGet(*argc, argv, "-camera"); 593 598 if (argNum > 0) { … … 600 605 char *cameraName = argv[argNum]; // symbolic name of the camera 601 606 602 // look for the CAMERAS list in config-> site603 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config-> site, "CAMERAS");607 // look for the CAMERAS list in config->xxSystem 608 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->xxSystem, "CAMERAS"); 604 609 if (!cameras) { 605 610 psError(PS_ERR_IO, false, "Unable to find CAMERAS in site configuration.\n"); … … 647 652 "Camera specified on command line", config->camera); 648 653 649 if (!pmConfigCameraSkycellVersion(config-> site, cameraName)) {654 if (!pmConfigCameraSkycellVersion(config->xxSystem, cameraName)) { 650 655 psError(PS_ERR_UNKNOWN, false, 651 656 "Unable to generate skycell versions of specified camera %s.\n", … … 655 660 } 656 661 657 if (!pmConfigCameraMosaickedVersions(config-> site, cameraName)) {662 if (!pmConfigCameraMosaickedVersions(config->xxSystem, cameraName)) { 658 663 psError(PS_ERR_UNKNOWN, false, 659 664 "Unable to generate mosaicked versions of specified camera %s.\n", … … 668 673 if (!config->camera && readCameraConfig) { 669 674 bool mdok; // Status of MD lookup 670 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config-> site, "CAMERAS"); // List of cameras675 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->xxSystem, "CAMERAS"); // List of cameras 671 676 if (!mdok || !cameras) { 672 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the s iteconfiguration.\n");677 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the system configuration.\n"); 673 678 return false; 674 679 } 675 680 676 681 if (!metadataReadFiles(cameras, "camera configuration")) { 677 psError(PS_ERR_UNKNOWN, false, "Unable to read cameras within s iteconfiguration.\n");682 psError(PS_ERR_UNKNOWN, false, "Unable to read cameras within system configuration.\n"); 678 683 psFree(config); 679 684 return NULL; … … 702 707 psFree(iter); 703 708 704 if (!pmConfigCameraSkycellVersionsAll(config-> site)) {709 if (!pmConfigCameraSkycellVersionsAll(config->xxSystem)) { 705 710 psError(PS_ERR_UNKNOWN, false, "Unable to generate skycell versions of cameras.\n"); 706 711 psFree(config); 707 712 return NULL; 708 713 } 709 if (!pmConfigCameraMosaickedVersionsAll(config-> site)) {714 if (!pmConfigCameraMosaickedVersionsAll(config->xxSystem)) { 710 715 psError(PS_ERR_UNKNOWN, false, "Unable to generate mosaicked versions of cameras.\n"); 711 716 psFree(config); … … 715 720 716 721 // Load the recipes from the camera file, if appropriate 717 if(!pmConfigReadRecipes(config, PM_RECIPE_SOURCE_S ITE| PM_RECIPE_SOURCE_CAMERA)) {722 if(!pmConfigReadRecipes(config, PM_RECIPE_SOURCE_SYSTEM | PM_RECIPE_SOURCE_CAMERA)) { 718 723 psError(PS_ERR_IO, false, "Failed to read recipes from camera file"); 719 724 psFree(config); … … 746 751 psArgumentRemove(argNum, argc, argv); 747 752 748 psMetadata *cameras = psMetadataLookupMetadata(NULL, config-> site, "CAMERAS"); // List of cameras753 psMetadata *cameras = psMetadataLookupMetadata(NULL, config->xxSystem, "CAMERAS"); // List of cameras 749 754 if (!cameras) { 750 755 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find CAMERAS in the site configuration.\n"); … … 794 799 } else { 795 800 char *dbserver = argv[argNum]; // The camera configuration file to read 796 if (!psMetadataAddStr(config-> site, PS_LIST_TAIL, "DBSERVER", PS_META_REPLACE, NULL, dbserver)) {801 if (!psMetadataAddStr(config->xxSite, PS_LIST_TAIL, "DBSERVER", PS_META_REPLACE, NULL, dbserver)) { 797 802 psWarning("Failed to overwrite .ipprc DBSERVER value"); 798 803 } … … 809 814 } else { 810 815 char *dbname = argv[argNum]; // The camera configuration file to read 811 if (!psMetadataAddStr(config-> site, PS_LIST_TAIL, "DBNAME", PS_META_REPLACE, NULL, dbname)) {816 if (!psMetadataAddStr(config->xxSite, PS_LIST_TAIL, "DBNAME", PS_META_REPLACE, NULL, dbname)) { 812 817 psWarning("Failed to overwrite .ipprc DBNAME value"); 813 818 } … … 824 829 } else { 825 830 char *dbuser = argv[argNum]; // The camera configuration file to read 826 if (!psMetadataAddStr(config-> site, PS_LIST_TAIL, "DBUSER", PS_META_REPLACE, NULL, dbuser)) {831 if (!psMetadataAddStr(config->xxSite, PS_LIST_TAIL, "DBUSER", PS_META_REPLACE, NULL, dbuser)) { 827 832 psWarning("Failed to overwrite .ipprc DBUSER value"); 828 833 } … … 839 844 } else { 840 845 char *dbpassword = argv[argNum]; // The camera configuration file to read 841 if (!psMetadataAddStr(config-> site, PS_LIST_TAIL, "DBPASSWORD", PS_META_REPLACE,846 if (!psMetadataAddStr(config->xxSite, PS_LIST_TAIL, "DBPASSWORD", PS_META_REPLACE, 842 847 NULL, dbpassword)) { 843 848 psWarning("Failed to overwrite .ipprc DBPASSWORD value"); … … 855 860 } else { 856 861 char *dbport = argv[argNum]; // The camera configuration file to read 857 if (!psMetadataAddS32(config-> site, PS_LIST_TAIL, "DBPORT", PS_META_REPLACE, NULL,862 if (!psMetadataAddS32(config->xxSite, PS_LIST_TAIL, "DBPORT", PS_META_REPLACE, NULL, 858 863 (psS32)atoi(dbport))) { 859 864 psWarning("Failed to overwrite .ipprc DBPORT value"); … … 1027 1032 if (! config->camera) { 1028 1033 bool mdok; // Metadata lookup status 1029 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config-> site, "CAMERAS");1034 psMetadata *cameras = psMetadataLookupMetadata(&mdok, config->xxSystem, "CAMERAS"); 1030 1035 if (! mdok || !cameras) { 1031 1036 psError(PS_ERR_IO, true, "Unable to find CAMERAS in the configuration."); … … 1114 1119 PS_ASSERT_STRING_NON_EMPTY(cameraName, NULL); 1115 1120 1116 psMetadata *cameras = psMetadataLookupMetadata(NULL, config-> site, "CAMERAS");1121 psMetadata *cameras = psMetadataLookupMetadata(NULL, config->xxSystem, "CAMERAS"); 1117 1122 if (!cameras) { 1118 1123 psError(PS_ERR_IO, true, "Unable to find CAMERAS in the configuration."); … … 1140 1145 { 1141 1146 PS_ASSERT_PTR_NON_NULL(config, NULL); 1142 PS_ASSERT_PTR_NON_NULL(config-> site, NULL);1147 PS_ASSERT_PTR_NON_NULL(config->xxSite, NULL); 1143 1148 1144 1149 #ifndef HAVE_PSDB … … 1157 1162 1158 1163 // XXX leaky strings 1159 psString dbServer = psMetadataLookupStr(&mdStatus01, config-> site, "DBSERVER");1160 psString dbUsername = psMetadataLookupStr(&mdStatus02, config-> site, "DBUSER");1161 psString dbPassword = psMetadataLookupStr(&mdStatus03, config-> site, "DBPASSWORD");1162 psString dbName = psMetadataLookupStr(&mdStatus04, config-> site, "DBNAME");1163 psS32 dbPort = psMetadataLookupS32(&mdStatus05, config-> site, "DBPORT");1164 psString dbServer = psMetadataLookupStr(&mdStatus01, config->xxSite, "DBSERVER"); 1165 psString dbUsername = psMetadataLookupStr(&mdStatus02, config->xxSite, "DBUSER"); 1166 psString dbPassword = psMetadataLookupStr(&mdStatus03, config->xxSite, "DBPASSWORD"); 1167 psString dbName = psMetadataLookupStr(&mdStatus04, config->xxSite, "DBNAME"); 1168 psS32 dbPort = psMetadataLookupS32(&mdStatus05, config->xxSite, "DBPORT"); 1164 1169 if (!mdStatus05) { 1165 1170 dbPort = 0; … … 1352 1357 // replace path://PATH with matched datapath 1353 1358 if (!strncasecmp(filename, "path://", strlen("path://"))) { 1354 PS_ASSERT_METADATA_NON_NULL(config-> site, NULL);1359 PS_ASSERT_METADATA_NON_NULL(config->xxSite, NULL); 1355 1360 1356 1361 psString newName = psStringCopy(filename); 1357 1362 1358 1363 // filename should be of the form: path://PATH/rest/of/file 1359 // replace PATH with matching name from config-> site:DATAPATH1360 psMetadata *datapath = psMetadataLookupPtr (NULL, config-> site, "DATAPATH");1364 // replace PATH with matching name from config->xxSite:DATAPATH 1365 psMetadata *datapath = psMetadataLookupPtr (NULL, config->xxSite, "DATAPATH"); 1361 1366 if (datapath == NULL) { 1362 1367 psError(PS_ERR_UNKNOWN, true, "DATAPATH is not defined in config.site"); … … 1410 1415 // if env isn't set, check the config system 1411 1416 if (!neb_server) { 1412 neb_server = psMetadataLookupStr(&status, config-> site, "NEB_SERVER");1417 neb_server = psMetadataLookupStr(&status, config->xxSite, "NEB_SERVER"); 1413 1418 if (!status) { 1414 1419 psError(PM_ERR_CONFIG, true, "failed to lookup config value for NEB_SERVER."); -
branches/eam_branch_20080219/psModules/src/config/pmConfig.h
r15385 r16542 5 5 * @author Eugene Magnier, IfA 6 6 * 7 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $8 * @date $Date: 200 7-10-26 02:41:15$7 * @version $Revision: 1.32.6.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2008-02-19 20:09:09 $ 9 9 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 10 10 */ … … 25 25 typedef enum { 26 26 PM_RECIPE_SOURCE_NONE = 0x00, ///< None yet 27 PM_RECIPE_SOURCE_S ITE = 0x01, ///< Siteconfiguration27 PM_RECIPE_SOURCE_SYSTEM = 0x01, ///< System configuration 28 28 PM_RECIPE_SOURCE_CAMERA = 0x02, ///< Camera configuration 29 29 PM_RECIPE_SOURCE_CL = 0x04, ///< Command-line … … 34 34 /// Configuration information 35 35 /// 36 /// This structure stores the configuration information: the site, camera and recipe configuration, the36 /// This structure stores the configuration information: user, site, system, camera and recipe configuration, the 37 37 /// command-line arguments, the pmFPAfiles used, and the database handle. 38 38 typedef struct { 39 psMetadata *site; ///< Site configuration 39 psMetadata *xxUser; ///< User configuration 40 psMetadata *xxSite; ///< Site configuration 41 psMetadata *xxSystem; ///< System configuration 40 42 psMetadata *camera; ///< Camera specification 41 43 psString cameraName; ///< Camera name … … 68 70 /// Read configuration information from the command line. 69 71 /// 70 /// pmConfigRead loads the site configuration (the file name is specified by "-site SITE_FILE" on the71 /// command-line, the PS_SITEenvironment variable, or it is $HOME/.ipprc). The configuration search path is72 /// pmConfigRead loads the user configuration (the file name is specified by "-ipprc FILE" on the 73 /// command-line, the IPPRC environment variable, or it is $HOME/.ipprc). The configuration search path is 72 74 /// set. The camera configuration is loaded if it is specified on the command line ("-camera 73 75 /// CAMERA_FILE"). Recipes specified on the command line ("-recipe RECIPE_NAME RECIPE_SOURCE") are also 74 76 /// loaded. These command-line arguments are removed from from the command-line, to simplify parsing. The 75 /// psLib log, trace and time setups are also performed if specified in the siteconfiguration.77 /// psLib log, trace and time setups are also performed if specified in the user configuration. 76 78 pmConfig *pmConfigRead(int *argc, ///< Number of command-line arguments 77 79 char **argv, ///< Array of command-line arguments … … 166 168 /// Get the file rule of interest 167 169 /// 168 /// Look up the name of the set of file rules to use, get that set from the s iteconfiguration, and return the170 /// Look up the name of the set of file rules to use, get that set from the system configuration, and return the 169 171 /// appropriate rule from the set. 170 172 psMetadata *pmConfigFileRule(const pmConfig *config, ///< Configuration -
branches/eam_branch_20080219/psModules/src/config/pmConfigCamera.c
r15788 r16542 24 24 25 25 // Generate the skycell version of a named camera configuration 26 bool pmConfigCameraSkycellVersion(psMetadata *s ite, // The siteconfiguration26 bool pmConfigCameraSkycellVersion(psMetadata *system, // The system configuration 27 27 const char *name // Name of the un-mosaicked camera 28 28 ) 29 29 { 30 PS_ASSERT_METADATA_NON_NULL(s ite, false);30 PS_ASSERT_METADATA_NON_NULL(system, false); 31 31 PS_ASSERT_STRING_NON_EMPTY(name, false); 32 32 33 33 bool mdok; // Status of MD lookup 34 psMetadata *cameras = psMetadataLookupMetadata(&mdok, s ite, "CAMERAS"); // List of cameras34 psMetadata *cameras = psMetadataLookupMetadata(&mdok, system, "CAMERAS"); // List of cameras 35 35 if (!mdok || !cameras) { 36 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the s iteconfiguration.\n");37 return false; 38 } 39 if (!pmConfigGenerateSkycellVersion(cameras, cameras, name, s ite)) {36 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the system configuration.\n"); 37 return false; 38 } 39 if (!pmConfigGenerateSkycellVersion(cameras, cameras, name, system)) { 40 40 psError(PS_ERR_UNKNOWN, true, "Failed to build skycell camera description for %s\n", name); 41 41 return false; … … 45 45 46 46 47 bool pmConfigCameraSkycellVersionsAll(psMetadata *s ite)48 { 49 PS_ASSERT_METADATA_NON_NULL(s ite, false);47 bool pmConfigCameraSkycellVersionsAll(psMetadata *system) 48 { 49 PS_ASSERT_METADATA_NON_NULL(system, false); 50 50 51 51 bool mdok; // Status of MD lookup 52 psMetadata *cameras = psMetadataLookupMetadata(&mdok, s ite, "CAMERAS"); // List of cameras52 psMetadata *cameras = psMetadataLookupMetadata(&mdok, system, "CAMERAS"); // List of cameras 53 53 if (!mdok || !cameras) { 54 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the s iteconfiguration.\n");54 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the system configuration.\n"); 55 55 return false; 56 56 } … … 61 61 while ((camerasItem = psMetadataGetAndIncrement(camerasIter))) { 62 62 assert(camerasItem->type == PS_DATA_METADATA); // Only metadata are allowed here! 63 if (!pmConfigGenerateSkycellVersion(cameras, new, camerasItem->name, s ite)) {63 if (!pmConfigGenerateSkycellVersion(cameras, new, camerasItem->name, system)) { 64 64 psError(PS_ERR_UNKNOWN, true, "Failed to build skycell camera description for %s\n", 65 65 camerasItem->name); … … 92 92 static const char *skycellConceptName(const char *name, // Name of concept 93 93 const char **concepts, // List of concepts NOT to update 94 const psMetadata *s ite // Siteconfiguration94 const psMetadata *system // System configuration 95 95 ) 96 96 { … … 101 101 } 102 102 103 if (!s ite) {103 if (!system) { 104 104 return name; 105 105 } 106 106 bool mdok; // Status of MD lookup 107 psMetadata *skycells = psMetadataLookupMetadata(&mdok, s ite, "SKYCELLS"); // Skycell concept headers107 psMetadata *skycells = psMetadataLookupMetadata(&mdok, system, "SKYCELLS"); // Skycell concept headers 108 108 if (!skycells) { 109 109 return name; … … 121 121 psMetadata *newCameras, // New list of camera configurations 122 122 const char *name, // Name of original camera configuration 123 const psMetadata *s ite // Siteconfiguration123 const psMetadata *system // System configuration 124 124 ) 125 125 { … … 213 213 iter = psListIteratorAlloc(concepts, PS_LIST_HEAD, false); 214 214 while ((name = psListGetAndIncrement(iter))) { 215 const char *new = skycellConceptName(name, skycellConceptsFPA, s ite); // Name for skycell215 const char *new = skycellConceptName(name, skycellConceptsFPA, system); // Name for skycell 216 216 if (new) { 217 217 psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, new); … … 224 224 iter = psListIteratorAlloc(concepts, PS_LIST_HEAD, false); 225 225 while ((name = psListGetAndIncrement(iter))) { 226 const char *new = skycellConceptName(name, skycellConceptsChip, s ite); // Name for skycell226 const char *new = skycellConceptName(name, skycellConceptsChip, system); // Name for skycell 227 227 if (new) { 228 228 psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, new); … … 235 235 iter = psListIteratorAlloc(concepts, PS_LIST_HEAD, false); 236 236 while ((name = psListGetAndIncrement(iter))) { 237 const char *new = skycellConceptName(name, skycellConceptsCell, s ite); // Name for skycell237 const char *new = skycellConceptName(name, skycellConceptsCell, system); // Name for skycell 238 238 if (new) { 239 239 psMetadataAddStr(translation, PS_LIST_TAIL, name, 0, NULL, new); … … 299 299 300 300 // Generate the Chip and FPA mosaicked version of a named camera configuration 301 bool pmConfigCameraMosaickedVersions(psMetadata *s ite, // The siteconfiguration301 bool pmConfigCameraMosaickedVersions(psMetadata *system, // The system configuration 302 302 const char *name // Name of the un-mosaicked camera 303 303 ) 304 304 { 305 PS_ASSERT_METADATA_NON_NULL(s ite, false);305 PS_ASSERT_METADATA_NON_NULL(system, false); 306 306 PS_ASSERT_STRING_NON_EMPTY(name, false); 307 307 308 308 bool mdok; // Status of MD lookup 309 psMetadata *cameras = psMetadataLookupMetadata(&mdok, s ite, "CAMERAS"); // List of cameras309 psMetadata *cameras = psMetadataLookupMetadata(&mdok, system, "CAMERAS"); // List of cameras 310 310 if (!mdok || !cameras) { 311 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the s iteconfiguration.\n");311 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the system configuration.\n"); 312 312 return false; 313 313 } … … 325 325 // the operation putting the new entries first is now implemented in pmConfigGenerateMosaickedVersion 326 326 // Generate the Chip and FPA mosaicked version of a named camera configuration 327 bool pmConfigCameraMosaickedVersionsAll(psMetadata *s ite)328 { 329 PS_ASSERT_METADATA_NON_NULL(s ite, false);327 bool pmConfigCameraMosaickedVersionsAll(psMetadata *system) 328 { 329 PS_ASSERT_METADATA_NON_NULL(system, false); 330 330 331 331 bool mdok; // Status of MD lookup 332 psMetadata *cameras = psMetadataLookupMetadata(&mdok, s ite, "CAMERAS"); // List of cameras332 psMetadata *cameras = psMetadataLookupMetadata(&mdok, system, "CAMERAS"); // List of cameras 333 333 if (!mdok || !cameras) { 334 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the s iteconfiguration.\n");334 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the system configuration.\n"); 335 335 return false; 336 336 } -
branches/eam_branch_20080219/psModules/src/config/pmConfigCommand.c
r12696 r16542 12 12 { 13 13 PS_ASSERT_PTR_NON_NULL(command, false); 14 PS_ASSERT_PTR_NON_NULL(config, false); 15 PS_ASSERT_PTR_NON_NULL(config->xxSite, false); 14 16 15 17 bool mdok; // Status of MD lookup 16 const char *dbserver = psMetadataLookupStr(&mdok, config-> site, "DBSERVER"); // Database server18 const char *dbserver = psMetadataLookupStr(&mdok, config->xxSite, "DBSERVER"); // Database server 17 19 if (!mdok || strlen(dbserver) == 0) { 18 20 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBSERVER in site configuration.\n"); 19 return NULL;21 return false; 20 22 } 21 const char *dbname = psMetadataLookupStr(&mdok, config-> site, "DBNAME"); // Database name23 const char *dbname = psMetadataLookupStr(&mdok, config->xxSite, "DBNAME"); // Database name 22 24 if (!mdok || strlen(dbname) == 0) { 23 25 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBNAME in site configuration.\n"); 24 return NULL;26 return false; 25 27 } 26 const char *dbuser = psMetadataLookupStr(&mdok, config-> site, "DBUSER"); // Database user28 const char *dbuser = psMetadataLookupStr(&mdok, config->xxSite, "DBUSER"); // Database user 27 29 if (!mdok || strlen(dbuser) == 0) { 28 30 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBUSER in site configuration.\n"); 29 return NULL;31 return false; 30 32 } 31 const char *dbpassword = psMetadataLookupStr(&mdok, config-> site, "DBPASSWORD"); // Database password33 const char *dbpassword = psMetadataLookupStr(&mdok, config->xxSite, "DBPASSWORD"); // Database password 32 34 if (!mdok || strlen(dbpassword) == 0) { 33 35 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBPASSWORD in site configuration.\n"); 34 return NULL;36 return false; 35 37 } 36 38 -
branches/eam_branch_20080219/psModules/src/config/pmConfigRecipes.c
r15727 r16542 11 11 #include "pmConfigRecipes.h" 12 12 13 static bool loadRecipeS ite(bool *status, pmConfig *config, psMetadata *source);13 static bool loadRecipeSystem(bool *status, pmConfig *config, psMetadata *source); 14 14 static bool loadRecipeCamera(bool *status, pmConfig *config, psMetadata *source); 15 15 static bool loadRecipeFromArguments(bool *status, pmConfig *config); … … 46 46 47 47 // this function may be called several times. it attempts to load the recipe data from one of 48 // three locations: config-> site, config->camera, and argv. We cannot read the recipes48 // three locations: config->xxSystem, config->camera, and argv. We cannot read the recipes 49 49 // from config->camera until a camera has been read BUT, the argv recipes must override the 50 // camera and s iterecipes.50 // camera and system recipes. 51 51 bool pmConfigReadRecipes(pmConfig *config, pmRecipeSource source) 52 52 { … … 58 58 } 59 59 60 // Read the recipe file names from the s iteconfiguration and camera configuration61 // It is an error for config-> site:recipes not to exist. all programs install their62 // master recipe files in the s ite:recipe location when they are built.63 if (config-> site && (source & PM_RECIPE_SOURCE_SITE)) {64 if (!loadRecipeS ite(&status, config, config->site)) {65 psError(PS_ERR_IO, false, "Failed to read recipes from s iteconfig");66 return false; 67 } 68 psTrace ("psModules.config", 3, "read recipes from s iteconfig");60 // Read the recipe file names from the system configuration and camera configuration 61 // It is an error for config->xxSystem:recipes not to exist. all programs install their 62 // master recipe files in the system:recipe location when they are built. 63 if (config->xxSystem && (source & PM_RECIPE_SOURCE_SYSTEM)) { 64 if (!loadRecipeSystem(&status, config, config->xxSystem)) { 65 psError(PS_ERR_IO, false, "Failed to read recipes from system config"); 66 return false; 67 } 68 psTrace ("psModules.config", 3, "read recipes from system config"); 69 69 } 70 70 … … 283 283 } 284 284 285 // Load the recipe files for S ITE: REQUIRED286 static bool loadRecipeS ite(bool *status,285 // Load the recipe files for SYSTEM : REQUIRED 286 static bool loadRecipeSystem(bool *status, 287 287 pmConfig *config, // The configuration into which to read the recipes 288 288 psMetadata *source // The source configuration, from which to read the filenames … … 294 294 295 295 if (!source) { 296 psError(PS_ERR_IO, true, "The s iteconfiguration has not been read --- cannot read recipes from this location.\n");297 config->recipesRead &= ~PM_RECIPE_SOURCE_S ITE;296 psError(PS_ERR_IO, true, "The system configuration has not been read --- cannot read recipes from this location.\n"); 297 config->recipesRead &= ~PM_RECIPE_SOURCE_SYSTEM; 298 298 return false; 299 299 } … … 301 301 psMetadata *recipes = psMetadataLookupMetadata(NULL, source, "RECIPES"); // The list of recipes 302 302 if (!recipes) { 303 psError(PS_ERR_IO, false, "RECIPES not found in the s iteconfiguration\n");303 psError(PS_ERR_IO, false, "RECIPES not found in the system configuration\n"); 304 304 return false; 305 305 } … … 313 313 // type mismatch is a serious error 314 314 if (fileItem->type != PS_DATA_STRING) { 315 psError(PS_ERR_IO, true, "%s in s iteconfiguration RECIPES is not of type STR", fileItem->name);315 psError(PS_ERR_IO, true, "%s in system configuration RECIPES is not of type STR", fileItem->name); 316 316 return false; 317 317 } … … 320 320 psMetadata *recipe = NULL; 321 321 if (!pmConfigFileRead(&recipe, fileItem->data.str, "recipe")) { 322 psError(PS_ERR_IO, false, "Failed to read recipe file %s listed in s iteconfiguration\n",322 psError(PS_ERR_IO, false, "Failed to read recipe file %s listed in system configuration\n", 323 323 fileItem->data.str); 324 324 return false; … … 331 331 } 332 332 psFree(recipesIter); 333 config->recipesRead |= PM_RECIPE_SOURCE_S ITE;333 config->recipesRead |= PM_RECIPE_SOURCE_SYSTEM; 334 334 335 335 *status = true; … … 337 337 } 338 338 339 // Load the recipe files (valid for S ITE| CAMERA)339 // Load the recipe files (valid for SYSTEM | CAMERA) 340 340 // each time we load a specific recipe, it overrides the existing metadata for that recipe 341 // for sourceType == S ITE| CAMERA, RECIPES contains a list of files to be read (pmConfigFileRead)341 // for sourceType == SYSTEM | CAMERA, RECIPES contains a list of files to be read (pmConfigFileRead) 342 342 static bool loadRecipeCamera(bool *status, // status variable 343 343 pmConfig *config, // The configuration into which to read the recipes -
branches/eam_branch_20080219/psModules/src/detrend/pmDetrendDB.c
r15911 r16542 115 115 PS_ASSERT_PTR_NON_NULL(options, NULL); 116 116 PS_ASSERT_PTR_NON_NULL(config, NULL); 117 PS_ASSERT_PTR_NON_NULL(config->site, NULL);118 117 119 118 int status, exit_status; … … 150 149 psStringAppend(&line, " -airmass %f", options->twilight); 151 150 } 152 153 pmConfigDatabaseCommand(&line, config); 154 pmConfigTraceCommand(&line); 151 152 if (!pmConfigDatabaseCommand(&line, config)) { 153 psError (PS_ERR_IO, false, "error building detrend command %s", line); 154 goto failure; 155 } 156 157 if (!pmConfigTraceCommand(&line)) { 158 psError (PS_ERR_IO, false, "error building detrend command %s", line); 159 goto failure; 160 } 161 155 162 psTrace("psModules.detrend", 5, "running %s", line); 156 163 -
branches/eam_branch_20080219/psphot/src/psphotOutput.c
r16250 r16542 21 21 bool psphotDumpConfig (pmConfig *config) { 22 22 23 psMetadataConfigWrite (config->site, "site.md"); 23 psMetadataConfigWrite (config->xxUser, "user.md"); 24 psMetadataConfigWrite (config->xxSite, "site.md"); 25 psMetadataConfigWrite (config->xxSystem, "system.md"); 24 26 psMetadataConfigWrite (config->camera, "camera.md"); 25 27 psMetadataConfigWrite (config->recipes, "recipes.md"); -
branches/eam_branch_20080219/pswarp/src/pswarpDefineSkycell.c
r12717 r16542 63 63 // determine camera if not specified already 64 64 skyConfig = pmConfigAlloc(0, NULL); 65 skyConfig->site = psMemIncrRefCounter (config->site); 65 skyConfig->xxSite = psMemIncrRefCounter (config->xxSite); 66 skyConfig->xxSystem = psMemIncrRefCounter (config->xxSystem); 67 // XXX EAM : not sure both site and system are used here 68 66 69 psFree (skyConfig->files); 67 70 skyConfig->files = psMemIncrRefCounter (config->files);
Note:
See TracChangeset
for help on using the changeset viewer.
