e5b2353a8c
2005/04/21 15:11:51 rt 1.1.2.3: #i47869# sligth clean up 2005/04/21 10:48:49 vg 1.1.2.2: #i47869# initial check in 2005/04/21 09:43:52 vg 1.1.2.1: initial revision for cwsview tool
172 lines
5.1 KiB
Perl
172 lines
5.1 KiB
Perl
:
|
|
eval 'exec perl -S $0 ${1+"$@"}'
|
|
if 0;
|
|
#*************************************************************************
|
|
#
|
|
# $RCSfile: cwsview.pl,v $
|
|
#
|
|
# $Revision: 1.2 $
|
|
#
|
|
# last change: $Author: obo $ $Date: 2005-04-22 13:34:23 $
|
|
#
|
|
# The Contents of this file are made available subject to the terms of
|
|
# either of the following licenses
|
|
#
|
|
# - GNU Lesser General Public License Version 2.1
|
|
# - Sun Industry Standards Source License Version 1.1
|
|
#
|
|
# Sun Microsystems Inc., October, 2000
|
|
#
|
|
# GNU Lesser General Public License Version 2.1
|
|
# =============================================
|
|
# Copyright 2000 by Sun Microsystems, Inc.
|
|
# 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
#
|
|
# This library is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
# License version 2.1, as published by the Free Software Foundation.
|
|
#
|
|
# This library is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# Lesser General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
# License along with this library; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
# MA 02111-1307 USA
|
|
#
|
|
#
|
|
# Sun Industry Standards Source License Version 1.1
|
|
# =================================================
|
|
# The contents of this file are subject to the Sun Industry Standards
|
|
# Source License Version 1.1 (the "License"); You may not use this file
|
|
# except in compliance with the License. You may obtain a copy of the
|
|
# License at http://www.openoffice.org/license.html.
|
|
#
|
|
# Software provided under this License is provided on an "AS IS" basis,
|
|
# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
|
|
# WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
# See the License for the specific provisions governing your rights and
|
|
# obligations concerning the Software.
|
|
#
|
|
# The Initial Developer of the Original Code is: Sun Microsystems, Inc..
|
|
#
|
|
# Copyright: 2000 by Sun Microsystems, Inc.
|
|
#
|
|
# All Rights Reserved.
|
|
#
|
|
# Contributor(s): _______________________________________
|
|
#
|
|
#
|
|
#
|
|
#*************************************************************************
|
|
#
|
|
# cwsview - view cvs status for cws
|
|
#
|
|
|
|
use lib ("$ENV{SOLARENV}/bin/modules");
|
|
|
|
use Cwd;
|
|
use Cws;
|
|
use CvsModule;
|
|
|
|
#### script id #####
|
|
( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/;
|
|
|
|
$id_str = ' $Revision: 1.2 $ ';
|
|
$id_str =~ /Revision:\s+(\S+)\s+\$/
|
|
? ($script_rev = $1) : ($script_rev = "-");
|
|
|
|
print "$script_name -- version: $script_rev\n";
|
|
|
|
### main ###
|
|
|
|
if ((!defined $ENV{CWS_WORK_STAMP}) || (!defined $ENV{WORK_STAMP})) {
|
|
die "You're not in CWS environment. Please, set one";
|
|
}
|
|
my $masterws = $ENV{WORK_STAMP};
|
|
my $cws_name = $ENV{CWS_WORK_STAMP};
|
|
|
|
my $cws = Cws->new();
|
|
$cws->child($cws_name);
|
|
$cws->master($masterws);
|
|
|
|
# check if we got a valid child workspace
|
|
my $id = $cws->eis_id();
|
|
if ( !$id ) {
|
|
die "CWS $cws_name for master workspace $masterws not found in EIS database.";
|
|
}
|
|
my @modules = get_options();
|
|
@modules = get_checked_modules(\@modules);
|
|
|
|
do_cvs_view(\@modules);
|
|
|
|
exit(0);
|
|
### end of main ###
|
|
|
|
#########################
|
|
# #
|
|
# Procedures #
|
|
# #
|
|
#########################
|
|
|
|
sub do_cvs_view {
|
|
my $modules_ref = shift;
|
|
my $cvs_module = CvsModule->new();
|
|
foreach my $module (@$modules_ref) {
|
|
print "\n######## $module ########\n";
|
|
$cvs_module->module($module);
|
|
my $path = $ENV{SRC_ROOT} . '/' . $module;
|
|
$cvs_module->view($path);
|
|
};
|
|
};
|
|
|
|
sub usage {
|
|
print STDERR "\ncwsview\n";
|
|
print STDERR "Syntax: cwsview [module_name|all] [--help|-h]\n";
|
|
print STDERR " module_name - print cvs status info for module_name in cws\n";
|
|
print STDERR " --help - print help info\n";
|
|
exit(0);
|
|
};
|
|
|
|
sub get_options {
|
|
return () if (!scalar @ARGV);
|
|
my @modules = ();
|
|
foreach (@ARGV) {
|
|
return () if /^all$/;
|
|
usage() if /^-h$/;
|
|
usage() if /^--help$/;
|
|
push(@modules, $_);
|
|
};
|
|
return @modules;
|
|
}
|
|
|
|
sub get_checked_modules {
|
|
my $modules_ref = shift;
|
|
my @cws_modules = $cws->modules();
|
|
if (!scalar @$modules_ref) {
|
|
return @cws_modules;
|
|
};
|
|
my %cws_modules_hash = ();
|
|
$cws_modules_hash{$_}++ foreach (@cws_modules);
|
|
my @errors = ();
|
|
my @checked_modules = ();
|
|
foreach (@$modules_ref) {
|
|
if (defined $cws_modules_hash{$_}) {
|
|
push(@checked_modules, $_);
|
|
next;
|
|
};
|
|
push(@errors, $_);
|
|
};
|
|
if (scalar @errors) {
|
|
print STDERR "No module $_ is registered with cws $cws_name\n" foreach (@errors);
|
|
exit(1);
|
|
};
|
|
if (!scalar @checked_modules) {
|
|
print STDERR "No modules found to check";
|
|
exit(1);
|
|
};
|
|
return @checked_modules;
|
|
};
|