Rev 5709 | Blame | Compare with Previous | Last modification | View Log | RSS feed
######################################################################### COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.## Module name : find_vob_root.pl# Module type : JATS Utility# Compiler(s) : Perl# Environment(s): JATS## Description :## Usage:###......................................................................#require 5.008_002;use strict;use warnings;use Pod::Usage;use Getopt::Long;use JatsError;use JatsSystem;use Cwd;my @error_list;my $last_result;my @last_results;ClearCmd('describe', '-fmt', '%Ln', 'vob:.');Error ("Program Terminated") if ( @error_list );Error ("Cannot determine current VOB base" ) unless ( $last_result );my $vob_base = quotemeta($last_result);Message ("VOB Base: $vob_base");my $here = getcwd();Message ("Current dir: $here");my $base_dir = $here;$here =~ m~^(.*$vob_base)~;$base_dir = $1;Message ("Path of base: $base_dir");chdir ( $base_dir ) || Error ("Cannot chdir to vob base", $base_dir);Message ("All is good", getcwd());#-------------------------------------------------------------------------------# Function : ClearCmd## Description : Execute a ClearCase command and capture the results# Errors are held in one array# Result are held in another## Inputs :## Returns :#sub ClearCmd{my $cmd = QuoteCommand (@_);Verbose2( "cleartool $cmd" );@error_list = ();@last_results = ();$last_result = undef;open(CMD, "cleartool $cmd 2>&1 |") || Error( "can't run command: $!" );while (<CMD>){chomp;$last_result = $_;$last_result =~ tr~\\/~/~s;push @last_results, $last_result;Verbose2 ( "cleartool resp:" . $_);push @error_list, $_ if ( m~Error:~ );}close(CMD);Verbose2( "Exit Status: $?" );return $? / 256;}