1

How can I select an element with a specific baseline in a UCM ClearCase snapshot view config spec from a script?

I'm writing a script which will create a snapshot view of a given stream and should select a specific baseline version of the stream contents. I would prefer to set the element baseline in the same manner I'm setting the load rules but can't find a way to do that.

Here's what I'm doing so far:

...
cleartool mkview -snapshot -tag ${cc_view} -ptime -stream ${cc_stream}@\\myVob -vws ${cc_dir}/${cc_view}.vws ${cc_dir}/${cc_view} || die "Failed to create view. Exiting."
cd ${cc_dir}/${cc_view}
# Set the element baselines
cleartool edcs -overwrite
cleartool update -overwrite -add_loadrules ${components} || die "Failed to update view. Exiting."
...

Another issue might be that I can't set the element version in the config spec in the custom block - I have to do it in the component selection rules instead! Overwriting UCM's "Component selection rules" section feels a bit dangerous. I do this in the edcs phase:

ucm
identity UCM.Stream <...id...>
# ONLY EDIT THIS CONFIG SPEC IN THE INDICATED "CUSTOM" AREAS
# This config spec was automatically generated by the UCM stream
# "myStream" at 2017-06-01T07:43:33+02:00.
# Select checked out versions
element * CHECKEDOUT
# Component selection rules...
element "[ee5a<...id...>=\MYCOMPONENT]/..." my-component-1.0 -nocheckout
end ucm
#UCMCustomElemBegin - DO NOT REMOVE - ADD CUSTOM ELEMENT RULES AFTER THIS LINE
#UCMCustomElemEnd - DO NOT REMOVE - END CUSTOM ELEMENT RULES
# Non-included component backstop rule: no checkouts
element * /main/0 -ucm -nocheckout
#UCMCustomLoadBegin - DO NOT REMOVE - ADD CUSTOM LOAD RULES AFTER THIS LINE
load \MYCOMPONENT


Related questions:


As VonC suggested I moved to base CC:
...
cleartool mkview -snapshot -tag ${cc_view} -ptime -vws ${cc_dir}/${cc_view}.vws ${cc_dir}/${cc_view} || die "Failed to create view. Exiting."
cd ${cc_dir}/${cc_view}
cat << EOF > config_spec
element * CHECKEDOUT
element * ${baseline} -nocheckout
element * /main/LATEST
EOF
cleartool setcs -force -overwrite config_spec || die "Failed to set config spec. Exiting."
cleartool update -overwrite -add_loadrules ${components} || die "Failed to update view. Exiting."
...
Community
  • 1
  • 1
apa64
  • 1,578
  • 1
  • 17
  • 26
  • What are you trying to accomplish by doing this? Why do you need to select one element from one baseline and everything else from another? What is the relationship between the 2 baselines? – Brian Cowan Jun 01 '16 at 12:42
  • I need a view with all elements from one baseline - no 2 baselines. I hope my question wasn't misleading. The end goal is to have a snapshot view representing a specific baseline from the integration stream. – apa64 Jun 01 '16 at 13:05

1 Answers1

1

First, that will only work if the baseline is full.
If it is an incremental one, you have the risk of selecting an element with a label (associated to the baseline) which is not set on the parent folder, making that element inaccessible.

Second, that kind of custom selection is best done with a non-UCM base ClearCase snapshot view into which you have:

  • the same load rules as your UCM snapshot view
  • but a simpler set of selection rules:

    element * yourBaselineId
    element * /main/LATEST
    
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you, doing this in base CC was easier: I removed the `-stream` parameter from `mkview` and create the config spec from the script! For the more complex multi component projects I'll create the config specs manually - effort to script those would be too great compared to my need. – apa64 Jun 02 '16 at 12:52
  • And yes, I have only full baselines. This was missing from the original question. – apa64 Jun 02 '16 at 12:58