Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
215 views
in Technique[技术] by (71.8m points)

How can I interact with ClearCase from Perl?

My project needs couple of things to be extracted from ClearCase data using the Perl script in a excel sheet,those are -
By giving two particular time line or two baseline.

  1. all the activity associated within that baseline (column header "activity")
  2. Owner's id (column header-Owner)
  3. all the element associated within a particular activity. (column header-"element details")
  4. For each element the versions associated (column header-"Versions")
  5. for each element the total number of lines of code,total number of lines of code added,total number of lines of code deleted,total number of lines of code changed..(column header"No. of lines of code","lines of code added","lines of code deleted" & " lines of code changed")

Please kindly help me on this...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Basically, ClearCase Perl scripting is based on parsed outputs of system and cleartool commands.

The scripts are based on a cleartool run cmd like package CCCmd, and used like:

use strict;
use Config;
require "path/to/CCCmd.pm";

sub Main
{
  my $hostname = CCCmd::RunCmd('hostname');
  chomp $hostname;
  my $lsview = CCCmd::ClearToolNoError("lsview -l -pro -host $hostname");
  return 1;
}

Main() || exit(1);
exit(0);

for instance.

So once you have the basic Perl structure, all you need is the right cleartool commands to analyze, based on fmt_ccase directives.

1/ all the activity associated within that baseline (column header "activity")

 ct descr -fmt "%[activities]CXp" baseline:aBaseline.xyz@ideapvob

That will give you the list of activities (separated by ',').

For each activity:

2/ Owner's id (column header-Owner)

 ct descr -fmt "%u" activity:anActivityName@ideapvob

3/ all the element associated within a particular activity. (column header-"element details")

Not sure: activities can list their versions (see /4), not easily their elements

4/ For each element the versions associated (column header-"Versions")

For a given activity:

 ct descr -fmt "%[versions]CQp
"  activity:anActivityName@ideapvob

5/ for each element the total number of lines of code,total number of lines of code added,total number of lines of code deleted,total number of lines of code changed..(column header"No. of lines of code","lines of code added","lines of code deleted" & " lines of code changed")

That can be fairly long, but for each version, you can compute the extended path of the previous version and make a diff.

I would advise using for all that a dynamic view, since you can access any version of a file from there (as opposed to a snapshot view).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...