问题
How to find root folder in which a component is associated?
I am able to find it manually through project explorer -> Components-> properties
How to do it using cleartool command. I need it as i need to create config spec which can be applied in base clearcase view and view the UCM view contents.
回答1:
Have a look to the options of "Format strings for command output" (fmt_ccase):
cleartool descr -fmt "%[root_dir]p" component:aComponent@\aPVob
You can get that way to root directory (usually \aVob
for "vob component" or "\aVob\aRootDir
" for components within a Vob).
From there, for managing access to specific baselines of UCM components in non-UCM views, you can follow an approach similar to "Merging from a Project to a Non-UCM Branch" in a perl script (done to merge, but you can adapt it, in order to build a config spec for said non-UCM view):
This script below is for projects which uses recommended baselines, and is given as an example of using the "%[root_dir]p
".
If you don't use recommended baselines, you would simply list all components for a given stream:cleartool descr -fmt "%[components]CXp" stream:aStream@\aPVob
print("######## Getting recommended baselines for project
'$project'\n");
my @recbls = split(' ', ‘cleartool lsproject -fmt "%[rec_bls]p"
$project‘);
foreach $bl (@recbls) {
my $comp = ‘cleartool lsbl -fmt "%[component]p" $bl‘;
my $vob = ‘cleartool lscomp -fmt "%[root_dir]p" $comp‘;
#... build your config spec there
}
# call cleartool setsc there
You would then generate (and apply to a config spec) a file similar to your other question "Clearcase config spec behaves odd when using setcs command".
The OP reports getting this approach working, using Powershell:
(he had initally issues with my example copied form the IBM site, where hyphens-minus '-
' are replaced by non-ASCII minus '–
': , '- vs. –: -–
': see "What's the toughest bug you ever found and fixed?"):
$project="MyComponents@\My_PVOB"
$pvob="@\My_PVOB"
$Baselines=(cleartool lsproject -fmt "%[rec_bls]p" $project).split()
foreach ($bl in $Baselines) {
$comp=cleartool lsbl -fmt "%[component]p" $bl"$pvob"
$vob = cleartool lscomp -fmt "%[root_dir]p" $comp"$pvob"
}
来源:https://stackoverflow.com/questions/8769815/how-to-find-rootfolder-for-each-component-using-cleartool