IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7791


Ignore:
Timestamp:
Jul 3, 2006, 11:18:30 AM (20 years ago)
Author:
Paul Price
Message:

Fixed bug in symbolic links for recipes: the site recipes and the
command-line recipes might be read in an initial pass, with the
symbolic links on the command-line resolving to those in the site
recipes. If the function is called again, now with a camera
configuration from which to read recipes, the symbolic links on the
command-line might properly refer to the camera configuration (since
it has higher priority than the site configuration), but they had
already been derived from the site configuration. To get around this,
added a new type, P_PM_RECIPE_SOURCE_SYMBOLIC, and check for this type
every time we read a new set of recipes.

File:
1 edited

Legend:

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

    r7754 r7791  
    33 *  @author PAP, IfA
    44 *
    5  *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-06-29 20:39:56 $
     5 *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-07-03 21:18:30 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    666666    config->recipesRead |= sourceType;
    667667
     668    // Having read that, we now need to check to see if any symbolic links need to be resolved
     669    recipesIter = psMetadataIteratorAlloc(config->recipesSource, PS_LIST_HEAD, NULL);
     670    psMetadataItem *sourceItem = NULL;  // Item containing source, from iteration
     671    while ((sourceItem = psMetadataGetAndIncrement(recipesIter))) {
     672        assert(sourceItem->type == PS_TYPE_S32); // It should be this type: we put it in ourselves
     673        if (sourceItem->data.S32 == P_PM_RECIPE_SOURCE_SYMBOLIC) {
     674            const char *linkName = sourceItem->comment; // The name of the link
     675            psMetadata *linkSource = psMetadataLookupMD(&mdok, config->recipes, linkName); // The source
     676            if (!mdok || !linkSource) {
     677                psLogMsg(__func__, PS_LOG_WARN, "Unable to resolve symbolic link for recipe %s to %s "
     678                         "--- ignored.\n", sourceItem->name, linkName);
     679                continue;
     680            }
     681            psMetadataItem *target = psMetadataLookup(config->recipes, sourceItem->name); // The target item
     682            assert(target);             // It had better be here: it's in the "sourcesRead" metadata
     683            psFree(target->data.V); // Free old copy
     684            target->data.V = psMetadataCopy(NULL, linkSource);
     685        }
     686    }
     687    psFree(recipesIter);
    668688    return true;
    669689}
     
    709729
    710730            // Command-line has the highest priority, so we don't have to check to see if it's already there
    711             psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, recipeName, PS_META_REPLACE,
    712                              "Recipe added from command line", P_PM_RECIPE_SOURCE_CL);
    713731
    714732            // Is the source a symbolic reference?
     
    720738                              comment, extant);
    721739                psFree(comment);
     740                // Put the source in the comment, so we can retrieve it again if we need it
     741                psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, recipeName, PS_META_REPLACE,
     742                                 recipeSource, P_PM_RECIPE_SOURCE_SYMBOLIC);
     743
    722744            } else {
    723745                // Otherwise, treat the source as a filename
     
    730752                    psFree(comment);
    731753                    psFree(recipe);                 // Drop reference
     754                    psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, recipeName, PS_META_REPLACE,
     755                                     "Recipe added from command line", P_PM_RECIPE_SOURCE_CL);
    732756                }
    733757            }
Note: See TracChangeset for help on using the changeset viewer.