Initial version, suggestions are welcome.
authorZdeněk Šustr <sustr4@cesnet.cz>
Tue, 27 Jan 2009 19:43:00 +0000 (19:43 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Tue, 27 Jan 2009 19:43:00 +0000 (19:43 +0000)
org.glite.lb/etics-tag-consistency.pl [new file with mode: 0755]

diff --git a/org.glite.lb/etics-tag-consistency.pl b/org.glite.lb/etics-tag-consistency.pl
new file mode 100755 (executable)
index 0000000..34da9ec
--- /dev/null
@@ -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 ($_ = <VP>) {
+                                       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"); 
+                       }
+               }
+       }