From b8683de9ccf1a64115df3d72c3b32a96a5c2cd2a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Tue, 27 Jan 2009 19:43:00 +0000 Subject: [PATCH] Initial version, suggestions are welcome. --- org.glite.lb/etics-tag-consistency.pl | 120 ++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100755 org.glite.lb/etics-tag-consistency.pl diff --git a/org.glite.lb/etics-tag-consistency.pl b/org.glite.lb/etics-tag-consistency.pl new file mode 100755 index 0000000..34da9ec --- /dev/null +++ b/org.glite.lb/etics-tag-consistency.pl @@ -0,0 +1,120 @@ +#!/usr/bin/perl + +use Getopt::Std; +use Switch; + +$TMPDIR=$ENV{'TMPDIR'}; +$GLITE_LB_LOCATION="./org.glite.lb"; + +if ($TMPDIR eq "") {$TMPDIR="/tmp";} + +getopts('ch'); + +$usage = qq{ +usage: $0 [-h] subsystem.name [subsystem.name] [...] + + This script checks the consistency of tags in CVS and version.properties + + -c also verify etics configurations + -h Display this help + +}; + + # ********************************** + # Interpret cmdline options + # ********************************** + + if (defined $opt_h) {die $usage}; + die $usage unless @ARGV[0]; + + if (defined $opt_c) { + printf ("\n\nYou have selected the -c option. Note that etics may require authetication.\n If you cannot see any progress in the script, it is probably waiting for your password. ;-)\n\n"); + } + + # ********************************** + # Iterate through subsystems + # ********************************** + + foreach $subsystem (@ARGV) { + + #Clean possible trailing '/' (even multiple occurrences :-) from subsystem name + $subsystem=~s/\/+$//; + + printf(" $subsystem\n"); + + $subsystem=~/\.([^\.]+?)$/; + + @modules=split(/\s+/, `PATH=\$PATH:./:./org.glite.lb configure --listmodules $1`); + + unshift (@modules, $subsystem); + + foreach $module (@modules) { + + printf(" %-30s", $module); + + + if (open VP, "$module/project/version.properties") { + + while ($_ = ) { + chomp; + + if(/module\.version\s*=\s*(\d*)\.(\d*)\.(\d*)/) { + $current_major=$1; + $current_minor=$2; + $current_revision=$3; + } + if(/module\.age\s*=\s*(\S+)/) { + $current_age=$1; + } + } + close (VP); + + $current_prefix=$module; + $current_prefix=~s/^org\.//; + $current_prefix=~s/\./-/g; + $current_prefix="$current_prefix" . "_R_"; + $current_tag="$current_prefix" . "$current_major" . "_$current_minor" . "_$current_revision" . "_$current_age"; + + if ($module eq $subsystem) { $subsystem_tag = $current_tag; } + + printf("\t $current_major.$current_minor.$current_revision-$current_age"); + + unless (system("cvs log -h $module/project/version.properties | grep -E \"\\W$current_tag\\W\" > /dev/null")) + { printf ("\t module tag OK"); } + else { + printf(STDERR "\nERROR: Tag $current_tag does not exist in module $module!\n"); + } + + if ($module ne $subsystem ) { + unless (system("cvs log -h $module/project/version.properties | grep -E \"\\W$subsystem_tag\\W\" > /dev/null")) + { printf ("\t subsystem tag OK"); } + else { + printf(STDERR "\nERROR: Tag $subsystem_tag does not exist in module $module!\n"); + } + + unless (-e "$module/project/ChangeLog") { + printf(STDERR "\nERROR: The ChangeLog file for module $module does not exist!\n"); + } + } + + unless (-e "$module/configure") { + printf(STDERR "\nERROR: The configure script for module $module does not exist!\n"); + } + + if (defined $opt_c) { + unless (system("etics-list-configuration $module | grep \"$current_tag\" &> /dev/null")) + { printf ("\t etics configuration OK"); } + else { + printf(STDERR "\nERROR: Configuration $current_tag for module $module does not exist!\n"); + } + } + + printf("\n"); + + } + else { + printf(STDERR "\nERROR: The version.properties file for module $module does not exist!\n"); + } + } + } + -- 1.8.2.3