tags:

views:

383

answers:

3

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...

+3  A: 

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\n"  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).

VonC
A: 

Also if you need to use perl with Clearcase have a look at the CPAN module ClearCase::CtCmd. I would recommend to use this perl module for invoking clearcase commands.

sateesh
A: 

I see that VonC gave you an excellent a. However you may want to know about a ClearCase plug-in that offers to you issues 1,3,4 as a turnkey solution: http://gomidjets.com/compbl

Tamir Gefen