Search code examples
clearcaseclearcase-ucmbaseline

ClearCase UCM: Access and change config spec from script


In our continuous integration we use ClearCase UCM. We occasionally need to access the sources from the recommended baseline (which not necessarily equals the newest baseline). Note: All baselines are full. I figured out how to access the sources belonging to the recommend baseline manually, by entering cleartool edcs in the command line within the dynamic view and adding the line element * MyRecommendedBaseline below # Select checked out versions, saving and closing the text-file. Unfortunately I don't know how to do this from a script. One way I could think about is read the contents of the config_spec into a stream, add the line, save it to a new text file and use "cleartool setcs newcs.txt". But apart from being cumbersome I'm not exactly sure if this is possible. Anyone knows a simple way to do this?


Solution

  • You can script listing the recommended baselines of a given stream: see "How can I list the recommended base line in ClearCase"

    On Windows:

    cleartool descr -fmt "%[rec_bls]CXp" stream:streamName@\aPVob
    

    On Unix:

    cleartool descr -fmt "%[rec_bls]CXp" stream:streamName@/vobs/aPVob
    

    From there, you can generate a new file with simple rules:

    element * MyRecommendedBaseline1
    element * MyRecommendedBaseline2
    ...
    

    And you can setcs that file to a dedicate base-CC dynamic view (not an existing UCM view).

    As Brian Cowan points out in the comments, this only works because those baselines, as the OP mentions, are full baselines (not incremental or not-labeled, like deliverbl are).
    See also "What is the difference between Full baseline and Incremental baseline in Clearcase UCM?".