Subversion Repositories DevTools

Rev

Rev 5709 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
392 dpurdie 1
########################################################################
6177 dpurdie 2
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
392 dpurdie 3
#
4
# Module name   : cc_find_roots.pl
5
# Module type   : Makefile system
6
# Compiler(s)   : Perl
7
# Environment(s): jats
8
#
9
# Description   :
10
#
11
# Usage:
12
#
13
# Version   Who      Date        Description
14
#
15
#......................................................................#
16
 
17
require 5.008_002;
18
use strict;
19
use warnings;
20
 
21
use Pod::Usage;
22
use Getopt::Long;
23
 
24
use JatsError;
25
use JatsSystem;
26
 
27
#
28
#   Globals
29
#
30
my @ROOT_VOBS;
31
my @error_list;                             # ClearCmd detected errors
32
 
33
my %ROOTS;
34
 
35
#
36
#   Extend the list of ROOT_VOBS with all the known vobs
37
#   The initial ROOT_VOBS are treated as a "hint" to assist searching
38
#
39
my $cmd = ClearToolCmd ('lsvob', '-short');
40
open(CMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
41
while (<CMD>)
42
{
43
    #
44
    #   Filter output from the user
45
    #
46
    chomp;
47
    Verbose2("lsvob: $_");
48
    tr~\\/~/~s;
49
    push @ROOT_VOBS, $_;
50
}
51
close(CMD);
52
 
53
#
54
#   Process each VOB
55
#
56
foreach my $vob ( @ROOT_VOBS )
57
{
58
    print "processing $vob\n";
59
    $ROOTS{$vob}{'main'} = 1;
60
 
61
    my $cmd = ClearToolCmd ('lsvtree', '-short' , "o:/dpurdie_view4/$vob/@@/main/0" );
62
    open(CMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
63
    while (<CMD>)
64
    {
65
        #
66
        #   Filter output from the user
67
        #
68
        chomp;
69
        Verbose2("lsvtree: $_");
70
        tr~\\/~/~s;
71
        next if ( m~/\d+$~ );
72
#        print "----- $_\n";
73
        if ( m~/main/([^/]+)$~ )
74
        {
75
            print "---------------- $1\n";
76
            $ROOTS{$vob}{$1} = 1;
77
        }
78
    }
79
    close(CMD);
80
}
81
 
82
DebugDumpData("ROOTS", \%ROOTS );
83
 
84
 
85
 
86
 
87
#-------------------------------------------------------------------------------
88
# Function        : ClearCmd
89
#
90
# Description     : Execute a cleartool command
91
#                   Capture error messages only
92
#
93
# Inputs          : Command to execute
94
#                   Takes an array of command argumeents and will quote them
95
#
96
# Returns         : Exit code
97
#                   Also the global @error_list
98
#
99
sub ClearCmd
100
{
101
    @error_list = ();
102
 
103
    my $cmd = ClearToolCmd(@_);
104
    open(CMD, "$cmd  2>&1 |")    || Error "can't run command: $!";
105
    while (<CMD>)
106
    {
107
        chomp;
108
        Verbose ($_);
109
        push @error_list, $_ if ( m~Error:~ );
110
    }
111
    close(CMD);
112
 
113
    Verbose2 "Exit Status: $?";
114
    return $? / 256;
115
}
116
 
117
#-------------------------------------------------------------------------------
118
# Function        : ClearToolCmd
119
#
120
# Description     : Create a nice escaped cleartool command
121
#
122
# Inputs          : An array of cleartool command line arguments
123
#
124
# Returns         : A string that has been quoted
125
#
126
sub ClearToolCmd
127
{
128
    my $cmd = 'cleartool ' . QuoteCommand( @_);
129
    Verbose2 $cmd;
130
    return $cmd;
131
}
132