IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 22, 2008, 10:21:52 AM (18 years ago)
Author:
eugene
Message:

using new user/site/system construction for config files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/config/pmConfigRecipes.c

    r15727 r16611  
    1111#include "pmConfigRecipes.h"
    1212
    13 static bool loadRecipeSite(bool *status, pmConfig *config, psMetadata *source);
     13static bool loadRecipeSystem(bool *status, pmConfig *config, psMetadata *source);
    1414static bool loadRecipeCamera(bool *status, pmConfig *config, psMetadata *source);
    1515static bool loadRecipeFromArguments(bool *status, pmConfig *config);
     
    4646
    4747// 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 recipes
     48// three locations: config->complete, config->camera, and argv.  We cannot read the recipes
    4949// from config->camera until a camera has been read BUT, the argv recipes must override the
    50 // camera and site recipes.
     50// camera and system recipes.
    5151bool pmConfigReadRecipes(pmConfig *config, pmRecipeSource source)
    5252{
     
    5858    }
    5959
    60     // Read the recipe file names from the site configuration and camera configuration
    61     // It is an error for config->site:recipes not to exist.  all programs install their
    62     // master recipe files in the site:recipe location when they are built.
    63     if (config->site && (source & PM_RECIPE_SOURCE_SITE)) {
    64         if (!loadRecipeSite(&status, config, config->site)) {
    65             psError(PS_ERR_IO, false, "Failed to read recipes from site config");
    66             return false;
    67         }
    68         psTrace ("psModules.config", 3, "read recipes from site config");
     60    // Read the recipe file names from the system configuration and camera configuration
     61    // It is an error for config->complete:recipes not to exist.  all programs install their
     62    // master recipe files in the system:recipe location when they are built.
     63    if (config->complete && (source & PM_RECIPE_SOURCE_SYSTEM)) {
     64        if (!loadRecipeSystem(&status, config, config->complete)) {
     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");
    6969    }
    7070
     
    283283}
    284284
    285 // Load the recipe files for SITE : REQUIRED
    286 static bool loadRecipeSite(bool *status,
     285// Load the recipe files for SYSTEM : REQUIRED
     286static bool loadRecipeSystem(bool *status,
    287287                           pmConfig *config, // The configuration into which to read the recipes
    288288                           psMetadata *source // The source configuration, from which to read the filenames
     
    294294
    295295    if (!source) {
    296         psError(PS_ERR_IO, true, "The site configuration has not been read --- cannot read recipes from this location.\n");
    297         config->recipesRead &= ~PM_RECIPE_SOURCE_SITE;
     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;
    298298        return false;
    299299    }
     
    301301    psMetadata *recipes = psMetadataLookupMetadata(NULL, source, "RECIPES"); // The list of recipes
    302302    if (!recipes) {
    303         psError(PS_ERR_IO, false, "RECIPES not found in the site configuration\n");
     303        psError(PS_ERR_IO, false, "RECIPES not found in the system configuration\n");
    304304        return false;
    305305    }
     
    313313        // type mismatch is a serious error
    314314        if (fileItem->type != PS_DATA_STRING) {
    315             psError(PS_ERR_IO, true, "%s in site configuration 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);
    316316            return false;
    317317        }
     
    320320        psMetadata *recipe = NULL;
    321321        if (!pmConfigFileRead(&recipe, fileItem->data.str, "recipe")) {
    322             psError(PS_ERR_IO, false, "Failed to read recipe file %s listed in site configuration\n",
     322            psError(PS_ERR_IO, false, "Failed to read recipe file %s listed in system configuration\n",
    323323                    fileItem->data.str);
    324324            return false;
     
    331331    }
    332332    psFree(recipesIter);
    333     config->recipesRead |= PM_RECIPE_SOURCE_SITE;
     333    config->recipesRead |= PM_RECIPE_SOURCE_SYSTEM;
    334334
    335335    *status = true;
     
    337337}
    338338
    339 // Load the recipe files (valid for SITE | CAMERA)
     339// Load the recipe files (valid for SYSTEM | CAMERA)
    340340// each time we load a specific recipe, it overrides the existing metadata for that recipe
    341 // for sourceType == SITE | 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)
    342342static bool loadRecipeCamera(bool *status, // status variable
    343343                             pmConfig *config, // The configuration into which to read the recipes
Note: See TracChangeset for help on using the changeset viewer.