how to find root[folder] for each component using cleartool?

放肆的年华 提交于 2019-12-17 16:53:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!