This commit was manufactured by cvs2svn to create branch 'branch_3_0'.
authorcvs2svn <admin@example.com>
Wed, 24 Aug 2011 09:02:56 +0000 (09:02 +0000)
committercvs2svn <admin@example.com>
Wed, 24 Aug 2011 09:02:56 +0000 (09:02 +0000)
Cherrypick from master 2011-08-24 09:02:55 UTC Zdeněk Šustr <sustr4@cesnet.cz> 'Adding configure to put nagios module in line with other L&B components.':
    org.glite.lb.nagios/Makefile
    org.glite.lb.nagios/configure
    org.glite.lb.nagios/project/ChangeLog
    org.glite.lb.nagios/project/package.description
    org.glite.lb.nagios/project/package.summary
    org.glite.lb.nagios/project/version.properties
    org.glite.lb.nagios/src/LB-probe

org.glite.lb.nagios/Makefile [new file with mode: 0644]
org.glite.lb.nagios/configure [new file with mode: 0755]
org.glite.lb.nagios/project/ChangeLog [new file with mode: 0644]
org.glite.lb.nagios/project/package.description [new file with mode: 0644]
org.glite.lb.nagios/project/package.summary [new file with mode: 0644]
org.glite.lb.nagios/project/version.properties [new file with mode: 0644]
org.glite.lb.nagios/src/LB-probe [new file with mode: 0755]

diff --git a/org.glite.lb.nagios/Makefile b/org.glite.lb.nagios/Makefile
new file mode 100644 (file)
index 0000000..ac373ac
--- /dev/null
@@ -0,0 +1,21 @@
+top_srcdir=..
+stagedir=.
+package=emi-nagios-lb
+version=0.0.0
+prefix=
+LOCATION=/lib64/nagios/plugins/contrib/
+INSTALL=install
+
+-include Makefile.inc
+-include ${top_srcdir}/project/version.properties
+
+install:
+       mkdir -p ${DESTDIR}${PREFIX}${prefix}/lib64/nagios/plugins/contrib
+       ${INSTALL} -m 0755 src/LB-probe ${DESTDIR}${PREFIX}${prefix}/lib64/nagios/plugins/contrib/check_lb_server
+
+stage:
+       $(MAKE) install PREFIX=${stagedir}
+
+clean:
+
+.PHONY: all install stage clean
diff --git a/org.glite.lb.nagios/configure b/org.glite.lb.nagios/configure
new file mode 100755 (executable)
index 0000000..0856391
--- /dev/null
@@ -0,0 +1,1563 @@
+#!/usr/bin/perl
+
+# WARNING: Don't edit this file unless it is the master copy in org.glite.lb
+#
+# For the purpose of standalone builds of lb/jobid/lbjp-common components
+# it is copied on tagging 
+
+# $Header$
+#
+# Copyright (c) Members of the EGEE Collaboration. 2004-2010.
+# See http://www.eu-egee.org/partners/ for details on the copyright holders.
+# 
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+use Getopt::Long;
+
+my $pwd = `pwd`; chomp $pwd;
+my $prefix = '/usr';
+my $stagedir = undef;
+my $root = $pwd.'/stage';
+my $sysroot = '';
+my $sysconfdir;
+my $localstatedir;
+my $staged;
+my $module;
+my $thrflavour = 'gcc64dbgpthr';
+my $nothrflavour = 'gcc64dbg';
+my $mode = 'build';
+my $help = 0;
+my $listmodules;
+my $version;
+my $branch;
+my $output;
+my $lb_tag = '';
+my $lbjp_tag = '';
+my $jp_tag = '';
+my $jobid_tag = '';
+my $libdir = getlibdir();
+my $project = 'glite';
+my (%projects, %project);
+my $debug = 0;
+my $pkg_config_env = (defined $ENV{PKG_CONFIG_PATH}) ? "$ENV{PKG_CONFIG_PATH}:" : '';
+
+my @nodes = qw/client server logger logger-msg nagios utils client-java doc ws-test db jpprimary jpindex jpclient harvester lb px proxyrenewal/;
+my @default_nodes = qw/lb px proxyrenewal/;
+my %enable_nodes;
+my %disable_nodes;
+my %default_nodes; @default_nodes{@default_nodes} = (1) x ($#default_nodes + 1);
+
+# key:      internal package name (arguments, ...)
+# 'pkg':    pkg-config name
+# 'prefix': used when pkg-config fails
+my %externs = (
+       cares => {
+               prefix => '/opt/c-ares',
+               pkg => 'libcares'
+       },
+       classads => {
+               prefix=> '/usr',
+               pkg => 'classads'
+       },
+       cppunit => {
+               prefix=> '/usr',
+               pkg => 'cppunit'
+       },
+       expat => {
+               prefix=> '/usr',
+               pkg => 'expat'
+       },
+       globus => {
+               prefix=> '/opt/globus',
+               pkg => 'globus-gssapi-gsi'
+       },
+       'myproxy-devel' => {
+               prefix=> '/opt/globus',
+               pkg => 'myproxy'
+       },
+       'myproxy-server' => {
+               prefix=> '',
+       },
+       'myproxy-libs' => {
+               prefix=> '',
+       },
+       'myproxy-admin' => {
+               prefix=> '',
+       },
+       gsoap => {
+               prefix=> '/usr',
+               pkg => 'gsoap'
+       },
+       gsoapxx => {
+               prefix=> '/usr',
+               pkg => 'gsoap++'
+       },
+       mysql => {
+               prefix=> '/usr'
+       },
+       'mysql-devel' => {
+               prefix=> ''
+       },
+       'mysql-server' => {
+               prefix => ''
+       },
+       voms => {
+               prefix => '/opt/glite',
+               pkg => 'voms-2.0'
+       },
+       gridsite => {
+               prefix => '/opt/glite'
+       },
+       lcas => {
+               prefix => '/opt/glite',
+               pkg => 'lcas'
+       },
+       trustmanager => {
+               prefix => '/opt/glite'
+       },
+       trustmanager_axis => {
+               prefix => '/opt/glite'
+       },
+       utiljava => {
+               prefix=> '/opt/glite'
+       },
+       ant => {
+               prefix=> '/usr'
+       },
+       jdk => {
+               prefix=> '/usr/java/latest'
+       },
+       libtar => {
+               prefix=> '/usr'
+       },
+       axis => {
+               prefix=> '/usr'
+       },
+       log4c => {
+               prefix=> '/usr'
+       },
+       postgresql => {
+               prefix=> '/usr'
+       },
+       activemq => {
+               prefix=>'/opt/activemq-cpp-library',
+               pkg => 'activemq-cpp'
+       },
+);
+
+my %jar = (
+       'jakarta-commons-codec' => '/usr/share/java/commons-codec.jar',
+       'jakarta-commons-lang' => '/usr/share/java/commons-lang.jar',
+);
+
+
+my %glite_prefix;
+my %need_externs;
+my %need_externs_type;
+my %need_jars;
+my %extrafull;
+my %extranodmod;
+my %deps;
+my %deps_type;
+my %buildroot;
+my (%etics_externs, %etics_projects);
+
+#
+# modules of the subsystems
+#
+# additional modules from $project{modules} are automatically added
+#
+my %lbmodules = (
+       'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test harvester yaim logger-msg nagios/], 
+       'lbjp-common' => [qw/db log maildir server-bones trio jp-interface gss gsoap-plugin/],
+       'jobid' => [qw/api-c api-cpp api-java/],
+       'jp' => [ qw/client doc index primary server-common ws-interface/ ],
+       'gridsite' => [ qw/apache shared commands core devel slashgrid services service-clients gsexec/ ],
+       'px' => [ qw/proxyrenewal myproxy-yaim/ ],
+       );
+
+
+my @opts = (
+       'prefix:s' => \$prefix,
+       'staged=s' => \$staged,
+       'module=s' => \$module,
+       'thrflavour:s' => \$thrflavour,
+       'nothrflavour:s' => \$nothrflavour,
+       'mode=s' => \$mode,
+       'listmodules=s' => \$listmodules,
+       'version=s' => \$version,
+       'branch=s' => \$branch,
+       'output=s' => \$output,
+       'stage=s' => \$stagedir,
+       'root:s' => \$root,
+       'sysroot:s' => \$sysroot,
+       'sysconfdir=s' => \$sysconfdir,
+       'localstatedir=s' => \$localstatedir,
+       'lb-tag=s' => \$lb_tag,
+       'lbjp-common-tag=s' => \$lbjp_tag,
+       'jp-tag=s' => \$jp_tag,
+       'jobid-tag=s' => \$jobid_tag,
+       'help' => \$help,
+       'libdir=s' => \$libdir,
+       'project=s' => \$project,
+       'debug' => \$debug,
+);
+
+for (@nodes) {
+       $enable_nodes{$_} = 0;
+       $disable_nodes{$_} = 0;
+       
+       push @opts,"disable-$_",\$disable_nodes{$_};
+       push @opts,"enable-$_",\$enable_nodes{$_};
+}
+
+push @opts,"with-$_=s",\$externs{$_}{withprefix} for keys %externs;
+push @opts,"with-$_=s",\$jar{$_} for keys %jar;
+
+my @keeparg = @ARGV;
+
+GetOptions @opts or die "Errors parsing command line\n";
+$prefix=~s/\/$//;
+$root=~s/\/$//;
+$sysroot=~s/\/$//;
+if (not $sysconfdir) { $sysconfdir = $prefix eq '/usr' ? '/etc' : "$prefix/etc"; }
+if (not $localstatedir) { $localstatedir = $prefix eq '/usr' ? '/var' : "$prefix/var"; }
+$sysconfdir=~s/\/$//;
+$localstatedir=~s/\/$//;
+
+$externs{'mysql-server'}{prefix}=$externs{mysql}{prefix} if $externs{'mysql-server'}{prefix} eq '';
+$externs{'mysql-devel'}{prefix}=$externs{mysql}{prefix} if $externs{'mysql-devel'}{prefix} eq '';
+$externs{'gsoapxx'}{prefix}=$externs{gsoap}{prefix} if $externs{'gsoapxx'}{prefix} eq '';
+
+$externs{'mysql-server'}{withprefix}=$externs{mysql}{withprefix} if $externs{'mysql-server'}{withprefix} eq '';
+$externs{'mysql-devel'}{wihtprefix}=$externs{mysql}{withprefix} if $externs{'mysql-devel'}{withprefix} eq '';
+$externs{'gsoapxx'}{withprefix}=$externs{gsoap}{withprefix} if $externs{'gsoapxx'}{withprefix} eq '';
+
+%project = %{$projects{$project}};
+for my $platform (keys %{$project{etics_externs}}) {
+       for $_ (keys %{$project{etics_externs}{$platform}}) {
+               $etics_externs{$platform}{$_} = $project{etics_externs}{$platform}{$_};
+       }
+}
+reshuffle_platforms(\%etics_externs, $project{supported_platforms});
+reshuffle_platforms(\%{$project{etics_externs_devel}}, $project{supported_platforms});
+for $_ (keys %{$project{etics_projects}}) {
+       $etics_projects{$_} = $project{etics_projects}{$_};
+}
+for $_ (keys %{$project{need_externs_aux}}) {
+       $need_externs_aux{$_} = $project{need_externs_aux}{$_};
+}
+for my $ext (keys %need_externs_aux) {
+       for (@{$need_externs_aux{$ext}}) {
+               my ($pkg, $type) =/([^:]*)(?::(.*))?/;
+               $type = 'BR' unless ($type);
+
+               push @{$need_externs{$ext}},$pkg;
+               $need_externs_type{$ext}->{$pkg} = $type;
+       }
+}
+for $_ (keys %{$project{modules}}) {
+       push @{$lbmodules{$_}},@{$project{modules}{$_}};
+}
+
+
+if ($help) { usage(); exit 0; }
+
+if ($listmodules) {
+       my $name_prefix = ($listmodules eq 'gridsite' and $project eq 'glite') ? 'org' : $project{etics_name};
+       my @m = map "$name_prefix.$listmodules.$_",@{$lbmodules{$listmodules}};
+       print "@m\n";
+       exit 0;
+}
+
+warn "$0: --version, --branch and --output make sense only in --mode=etics\n"
+       if ($version || $output || $branch) && $mode ne 'etics';
+
+my $en;
+for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; }
+
+my $dis;
+for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; }
+
+die "--enable-* and --disable-* are mutually exclusive\n"
+       if $en && $dis;
+
+die "--module cannot be used with --enable-* or --disable-*\n"
+       if $module && ($en || $dis);
+
+die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},{$lbmodules{jp}};
+
+if ($dis) {
+       for (@nodes) {
+               $enable_nodes{$_} = 1 unless ($disable_nodes{$_} or not $default_nodes{$_});
+       }
+}
+
+if (!$en && !$dis) { for (@nodes) { $enable_nodes{$_} = 1 if ($default_nodes{$_}) } };
+
+for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; }
+
+$stagedir = $root unless $stagedir;
+$stagedir=~s/\/$// if ($stagedir);
+
+if ($mode eq 'build') { for my $ext (keys %externs) {
+       if (defined $externs{$ext} and defined $externs{$ext}{withprefix}) { $externs{$ext}{prefix} = $externs{$ext}{withprefix}; }
+       elsif (defined $externs{$ext}{pkg}) {
+               my ($flag, $env, $cmd, $ret);
+               my $pkg = $externs{$ext}{pkg};
+               my $flagname = uc $externs{$ext}{pkg};
+               $flagname =~ s/-[0-9\.]*$//;
+               $flagname =~ y/-\+/_X/;
+
+               print "Checking $pkg ... ";
+               $env = "PKG_CONFIG_PATH=$pkg_config_env$stagedir$prefix/$libdir/pkgconfig";
+               $cmd = "$env pkg-config $pkg --exists >/dev/null";
+               `$cmd`; $ret = $?;
+               print "('$cmd' => $ret)\n" if ($debug);
+               if ($ret == 0) {
+                       $externs{$ext}{prefix}=`$env pkg-config $pkg --variable=prefix`;
+                       chomp $externs{$ext}{prefix};
+                       print "$externs{$ext}{prefix}\n";
+
+                       $flag=`$env pkg-config $pkg --cflags`;
+                       $externs{$ext}{flags} .= "${flagname}_CFLAGS=$flag" if ($flag);
+                       $flag=`$env pkg-config $pkg --libs`;
+                       $externs{$ext}{flags} .= "${flagname}_LIBS=$flag" if ($flag);
+               } else {
+                       print "(using default $externs{$ext}{prefix})\n";
+               }
+               print "\n" if ($debug);
+       }
+       elsif ($ext eq 'jdk') {
+               my $jdk_prefix;
+
+               print "Looking for some caffein ... ";
+               if (defined $ENV{'JDK_HOME'}) {
+                       $jdk_prefix = $ENV{'JDK_HOME'};
+                       print "JDK_HOME=$jdk_prefix\n";
+               } elsif (defined $ENV{'JAVA_HOME'}) {
+                       $jdk_prefix = $ENV{'JAVA_HOME'};
+                       print "JAVA_HOME=$jdk_prefix\n";
+               } else {
+                       print "(using default $externs{$ext}{prefix}))\n"
+               }
+               $externs{$ext}{prefix} = $jdk_prefix if ($jdk_prefix);
+       }
+} }
+
+if ($mode eq 'build') {
+       print "Writing config.status\n";
+       open CONF,">config.status" or die "config.status: $!\n";
+       for ('JDK_HOME', 'JAVA_HOME', 'PKG_CONFIG_PATH') {
+               print CONF "$_=$ENV{$_} " if (defined $ENV{$_});
+       }
+       print CONF "$0 @keeparg\n";
+       close CONF;
+}
+
+
+my @modules;
+my %aux;
+
+if ($module) {
+#      push @modules,split(/[,.]+/,$module);
+       push @modules,$module;
+}
+else {
+       @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes));
+       
+       my $n;
+
+       do {
+               local $"="\n";
+               $n = $#modules;
+               push @modules,(map @{$deps{$_}},@modules);
+
+               undef %aux; @aux{@modules} = (1) x ($#modules+1);
+               @modules = keys %aux;
+       } while ($#modules > $n);
+}
+
+@aux{@modules} = (1) x ($#modules+1);
+delete $aux{$_} for (split /,/,$staged);
+@modules = keys %aux;
+
+mode_build() if $mode eq 'build';
+mode_checkout() if $mode eq 'checkout';
+mode_etics($module) if $mode eq 'etics';
+
+sub mode_build {
+       print "\nBuilding modules: @modules\n";
+       print "Mode: "; print $module ? "single module" : "multiple modules"; print "\n";
+       
+       my @ext = map @{$need_externs{$_}},@modules;
+       my @myjars = map @{$need_jars{$_}},@modules;
+       undef %aux; @aux{@ext} = 1;
+       @ext = keys %aux;
+       undef %aux; @aux{@myjars} = (1) x ($#myjars+1);
+       @myjars = keys %aux;
+       
+       print "\nRequired externals:\n";
+       print "\t$_: ".($externs{$_}{prefix}?$externs{$_}{prefix}:'-')."\n" for @ext;
+       print "\t$_: $jar{$_}\n" for @myjars;
+       for (@ext) { if (defined($externs{$_}{flags})) { print "$externs{$_}{flags}"; } };
+       print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n";
+       
+       mkinc($_) for @modules;
+
+       if ($module) {
+               print "Not creating summary Makefile\n" if $debug;
+       } else {
+               print "Creating Makefile\n";
+
+               open MAK,">Makefile" or die "Makefile: $!\n";
+
+               print MAK "all: @modules\n\n";
+               print MAK "stage: ".(join '-stage ', @modules)."-stage\n\n";
+               print MAK "clean check install:\n";
+
+               for (@modules) {
+                       my $full = full($_);
+                       print MAK "\tcd $full/$buildroot{$_} && \${MAKE} \$@\n"
+               }
+
+               print MAK "\ndistclean:\n";
+
+               for (@modules) {
+                       my $full = full($_);
+                       print MAK $buildroot{$_} eq '' ?
+                               "\tcd $full && \${MAKE} distclean\n" :
+                               "\trm -rf $full/$buildroot{$_}\n"
+               }
+
+               print MAK "\n";
+
+               for (@modules) {
+                       my %ldeps; undef %ldeps;
+                       @ldeps{@{$deps{$_}}} = 1;
+                       for my $x (split /,/,$staged) { delete $ldeps{$x}; }
+                       my @dnames = $module ? () : keys %ldeps;
+                       my $snames = $#dnames == -1 ? '' : join('-stage ', @dnames).'-stage';
+
+                       my $full = full($_);
+                       my $build = $buildroot{$_};
+
+                       print MAK "$_: @dnames\n\tcd $full/$build && \${MAKE} && \${MAKE} install\n\n";
+                       print MAK "$_-stage: $snames\n\tcd $full/$build && \${MAKE} && \${MAKE} stage\n\n";
+               }
+
+               close MAK;
+       }
+}
+       
+sub mode_checkout() {
+       for (@modules) {
+               my $module = $_;
+               my $tag = "";
+               if ($lb_tag){
+                       for (@{$lbmodules{lb}}){
+                               if ("lb.".$_ eq $module){
+                                       $tag = '-r '.$lb_tag;
+                               }
+                       }       
+               }
+               if ($lbjp_tag){
+                       for (@{$lbmodules{'lbjp-common'}}){
+                               if ("lbjp-common.".$_ eq $module){
+                                        $tag = '-r '.$lbjp_tag;
+                                }
+                       }
+               }
+               if ($jp_tag){
+                       for (@{$lbmodules{'jp'}}){
+                               if ("jp.".$_ eq $module){
+                                        $tag = '-r '.$jp_tag;
+                               }
+                        }
+               }
+               if ($jobid_tag){
+                       for (@{$lbmodules{jobid}}){
+                               if ("jobid.".$_ eq $module){
+                                        $tag = '-r '.$jobid_tag;
+                                }
+                       }
+               }
+               #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){
+               #       print "found";
+               #}
+               $_ = full($_);
+               print "\n*** Checking out $_\n";
+               system("cvs checkout  $tag $_") == 0 or die "cvs checkout $tag $_: $?\n";
+       }
+}
+
+BEGIN{
+%etics_externs = (
+       default => {
+               'myproxy-devel'=>'myproxy-devel',
+               'myproxy-libs'=>'myproxy-libs',
+               'myproxy-server'=>'myproxy-server',
+               'myproxy-admin'=>'myproxy-admin',
+               cares=>'c-ares',
+               voms=>'org.glite.security.voms-api-cpp',
+               utiljava=>'org.glite.security.util-java',
+               gpt=>'gpt',
+               fetchcrl=>'fetch-crl',
+               activemq=>'activemq-cpp-library',
+       },
+);
+
+%etics_projects = (
+);
+
+%need_externs_aux = (
+       'lb.client' => [ qw/cppunit:B classads libtool:B/ ],
+       'lb.common' => [ qw/expat cares:B cppunit:B classads libtool:B/ ],
+       'lb.doc' => [ qw/tetex-latex:B/ ],
+       'lb.logger' => [ qw/cppunit:B libtool:B/ ],
+       'lb.logger-msg' => [ qw/cppunit:B activemq libtool:B/ ],
+       'lb.nagios' => [ qw/globus_essentials:R/ ],
+       'lb.server' => [ qw/globus_essentials:R globus:B expat cares mysql:R mysql-server:R mysql-devel:B cppunit:B gsoap:B classads voms lcas gridsite bison:B libtool:B libxml2 flex:B/ ],
+       'lb.state-machine' => [ qw/classads libtool:B libxslt:B expat:B/ ],
+       'lb.utils' => [ qw/cppunit:B libtool:B/ ],
+       'lb.ws-interface' => [ qw/libxslt:B/ ],
+       'lb.ws-test' => [ qw/gsoap:B libtool:B/ ],
+       'lb.types' => [ qw// ],
+       'lb.harvester' => [ qw/docbook-utils:B libtool:B/ ],
+       'lbjp-common.db' => [ qw/mysql:B mysql-devel:B postgresql:B cppunit:B log4c:B libtool:B/ ],
+       'lbjp-common.log' => [ qw/log4c libtool:B/ ],
+       'lbjp-common.maildir' => [ qw/libtool:B/ ],
+       'lbjp-common.server-bones' => [ qw/libtool:B/ ],
+       'lbjp-common.trio' => [ qw/cppunit:B libtool:B/ ],
+       'lbjp-common.jp-interface' => [ qw/cppunit:B log4c:B libtool:B/ ],
+       'lbjp-common.gss' =>  [ qw/globus_essentials:R globus:B cares cppunit:B libtool:B/ ],
+       'lbjp-common.gsoap-plugin' =>  [ qw/cppunit:B globus_essentials:R globus:B cares:B gsoap gsoapxx libtool:B/ ],
+       'jobid.api-c' =>  [ qw/cppunit:B libtool:B openssl:B/ ],
+       'jobid.api-cpp' =>  [ qw/cppunit:B libtool:B/ ],
+       'jobid.api-java' =>  [ qw/ant:B jdk:B/ ],
+       'jp.client' => [ qw/gsoap libtar globus_essentials:R globus:B/ ],
+        'jp.doc' => [],
+        'jp.index' => [ qw/gsoap globus_essentials:R globus:B/ ],
+        'jp.primary' => [ qw/classads gsoap libtar globus_essentials:R globus:B/ ],
+        'jp.server-common' => [],
+        'jp.ws-interface' => [],
+       'gridsite.core' => [ qw/httpd-devel:B gsoap:B globus:B curl:B doxygen:B fuse-devel:B libxml2 openssl:B build_common_cpp:B doxygen:B/ ],
+       'gridsite.commands' => [ qw/curl:R openssl:R/ ],
+       'gridsite.apache' => [ qw/libxml2:R openssl:R curl:R/ ],
+       'gridsite.shared' => [ qw/libxml2:R openssl:R/ ],
+       'gridsite.devel' => [ qw// ],
+       'gridsite.slashgrid' => [ qw/curl:R fuse-libs:R fuse:R/],
+       'gridsite.services' => [ qw/curl:R gsoap:R/ ],
+       'gridsite.service-clients' => [ qw/curl:R gsoap:R gsoapxx:R/ ],
+       'gridsite.gsexec' => [ qw// ],
+       'px.proxyrenewal' => [ qw/globus:B globus_essentials:R myproxy-devel:B myproxy-libs:R voms libtool:B/ ],
+       'px.myproxy-config' => [ qw/myproxy-admin:R/ ], # in myproxy-config.spec
+);
+
+%need_jars = (
+       'jobid.api-java' => [ qw/jakarta-commons-codec/ ],
+       'lb.client-java' => [ qw/jakarta-commons-lang/ ],
+);
+
+for my $jar (keys %need_jars) {
+       for (@{$need_jars{$jar}}) {
+               $need_externs_type{$jar}->{$_} = 'BR';  # XXX
+       }
+}
+
+%deps_aux = (
+       'lb.client' => [ qw/
+               lb.types:B lb.common
+               lbjp-common.trio
+               jobid.api-cpp:B jobid.api-c
+               lbjp-common.gss
+       / ],
+       'lb.client-java' => [ qw/
+               lb.types:B
+               lb.ws-interface:B
+               jobid.api-java
+       / ],
+       'lb.common' => [ qw/
+               jobid.api-cpp:B jobid.api-c
+               lb.types:B lbjp-common.trio lbjp-common.gss
+       / ],
+       'lb.doc' => [ qw/lb.types:B/ ],
+       'lb.logger' => [ qw/
+               lbjp-common.trio
+               lbjp-common.log
+               jobid.api-c
+               lb.common
+               lbjp-common.gss
+       / ],
+       'lb.logger-msg' => [ qw/
+               lb.logger
+       / ],
+       'lb.nagios' => [ qw/
+               lb.client
+               lb.ws-test
+       / ],
+       'lb.server' => [ qw/
+               lb.ws-interface lb.types:B lb.common lb.state-machine
+               lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir lbjp-common.log
+               jobid.api-c
+               lbjp-common.gsoap-plugin lbjp-common.gss
+       / ],
+       'lb.state-machine' => [ qw/lb.types:B lb.common lbjp-common.jp-interface lbjp-common.gss/ ],
+       'lb.utils' => [ qw/
+               lbjp-common.jp-interface
+               jobid.api-c
+               lbjp-common.trio lbjp-common.maildir
+               lb.client lb.state-machine lb.types:B
+       / ],
+       'lb.ws-test' => [ qw/lbjp-common.gsoap-plugin lb.ws-interface/ ],
+       'lb.ws-interface' => [ qw/lb.types:B/ ],
+       'lb.types' => [ qw// ],
+       'lb.harvester' => [ qw/
+               jobid.api-c lbjp-common.trio lbjp-common.db lb.common lb.client
+               lbjp-common.gss lbjp-common.log
+       / ],
+       'lb.yaim' => [ qw// ],
+       'lb.glite-LB' => [ qw/
+               lb.logger:R lb.server:R lb.utils:R lb.doc:R
+               lb.ws-test:R lb.harvester:R lb.yaim:R lb.client-java:R
+               lb.logger-msg:R
+       / ],
+       'lb.emi-lb' => [ qw/
+               lb.logger:R lb.server:R lb.utils:R lb.doc:R
+               lb.ws-test:R lb.harvester:R lb.yaim:R lb.client-java:R
+               lb.logger-msg:R
+       / ],
+       'lbjp-common.db' => [ qw/lbjp-common.trio lbjp-common.log/ ],
+       'lbjp-common.maildir' => [ qw// ],
+       'lbjp-common.log' => [ qw// ],
+       'lbjp-common.server-bones' => [ qw/lbjp-common.log/ ],
+       'lbjp-common.trio' => [ qw// ],
+       'lbjp-common.gss' =>  [ qw// ],
+       'lbjp-common.gsoap-plugin' =>  [ qw/lbjp-common.gss/ ],
+       'jobid.api-c' =>  [ qw// ],
+       'jobid.api-cpp' =>  [ qw/jobid.api-c/ ],
+       'jobid.api-java' =>  [ qw// ],
+
+       'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ],
+
+       'jp.client' => [ qw/
+                jp.ws-interface
+                lbjp-common.jp-interface lbjp-common.maildir
+                jobid.api-c
+                lbjp-common.gsoap-plugin
+        / ],
+       'jp.doc' => [ qw// ],
+       'jp.index' => [ qw/
+                jp.server-common jp.ws-interface
+                lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones
+                lbjp-common.gsoap-plugin
+        / ],
+       'jp.primary' => [ qw/
+                jobid.api-c
+                jp.server-common jp.ws-interface
+                lb.state-machine
+                lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones
+                lbjp-common.gsoap-plugin
+        / ],
+       'jp.server-common' => [ qw/ 
+                lbjp-common.jp-interface lbjp-common.db
+        / ],
+       'jp.ws-interface' => [ qw// ],
+
+       'gridsite.core' => [ qw// ],
+       'gridsite.commands' => [ qw/gridsite.core:B gridsite.shared:R/ ],
+       'gridsite.apache' => [ qw/gridsite.core:B gridsite.shared:R/ ],
+       'gridsite.shared' => [ qw/gridsite.core:B / ],
+       'gridsite.devel' => [ qw/gridsite.core:B gridsite.shared:R/ ],
+       'gridsite.slashgrid' => [ qw/gridsite.core:B gridsite.shared:R/],
+       'gridsite.services' => [ qw/gridsite.core:B gridsite.shared:R/ ],
+       'gridsite.service-clients' => [ qw/gridsite.core:B gridsite.shared:R/ ],
+       'gridsite.gsexec' => [ qw/gridsite.core:B/ ],
+
+       'px.proxyrenewal' => [ qw// ],
+       'px.glite-PX' => [qw/px.myproxy-yaim:R/],
+       'px.emi-px' => [qw/px.myproxy-yaim:R/],
+       'px.myproxy-yaim' => [ qw// ],
+       'px.myproxy-config' => [],
+);
+
+for my $ext (keys %deps_aux) {
+       for (@{$deps_aux{$ext}}) {
+               /([^:]*)(?::(.*))?/;
+               push @{$deps{$ext}},$1;
+               my $type = $2 ? $2 : 'BR';
+               $deps_type{$ext}->{$1} = $type;
+       }
+}
+
+
+%extrafull = ( gridsite=>'org.gridsite.core');
+
+#( java => 'client-java' );
+%extranodmod = (
+       db => 'lbjp-common.db',
+       jpprimary => 'jp.primary',
+       jpindex => 'jp.index',
+       jpclient => 'jp.client',
+       lb => 'lb.glite-LB',
+       px => 'px.glite-PX',
+       proxyrenewal => 'px.proxyrenewal'
+);
+
+%obsoletes = (
+       'lb.yaim' => [ qq/glite-yaim-lb/ ],
+       'px.proxyrenewal' => [ qq/glite-security-proxyrenewal/ ],
+       'px.myproxy-yaim' => [ qq/glite-yaim-myproxy/ ],
+       'px.myproxy-config' => [ qq/myproxy-config/ ], # in myproxy-config.spec
+       'lbjp-common.gss' => [ qq/glite-security-gss/ ],
+       'lbjp-common.gsoap-plugin' => [ qq/glite-security-gsoap-plugin/ ],
+);
+
+%conflicts = (
+);
+
+%provides = (
+       'lbjp-common.gss' => [ qq/glite-security-gss/ ],
+       'lbjp-common.gsoap-plugin' => [ qq/glite-security-gsoap-plugin/ ],
+);
+
+%cvs_prefix = (
+       'lb' => 'org.glite',
+       'jp' => 'org.glite',
+       'jobid' => 'org.glite',
+       'lbjp-common' => 'org.glite',
+       'gridsite' => 'org',
+       'px' => 'org.glite',
+);
+
+%cvs_tag_prefix = (
+       'lb' => 'glite-',
+       'jp' => 'glite-',
+       'jobid' => 'glite-',
+       'lbjp-common' => 'glite-',
+       'gridsite' => '',
+       'px' => 'glite-',
+);
+
+# ==== projects specification ====
+# etics_name ........... ETICS project name
+# conf_prefix .......... ETICS configurations name prefix
+# tag_prefix ........... VCS tag prefix
+# local_prefix ......... prefix (relative to stage)
+# etics_externs ........ ETICS modules names of externals
+#                        (${NAME.location}, ETICS conf. dependencies)
+# etics_projects ....... ETICS project names of externals
+# etics_externs_devel .. ETICS modules names of devel versions of externals
+# etics_locations ...... ETICS locations in ${NAME.location} properties
+# need_externs_aux ..... project-specific external dependencies
+# supported_platforms .. platforms supported by the project
+# modules .............. additional modules in subsystems
+%projects = (
+       glite => {
+               etics_name => 'org.glite',
+               conf_prefix => { %cvs_tag_prefix },
+               tag_prefix => { %cvs_tag_prefix },
+               flavours => '--thrflavour=${globus.thr.flavor} --nothrflavour=${globus.nothr.flavor}',
+               local_prefix => '',
+               etics_externs => {
+                       default => {
+                               globus_essentials=>'vdt_globus_essentials',
+                               globus=>'globus',
+                               gridsite=>'org.gridsite.shared',
+                               yaim_core=>'org.glite.yaim.core',
+                               gip_release=>'glite-info-provider-release',
+                               gip_service=>'glite-info-provider-service',
+                               bdii=>'bdii',
+                               glite_version=>'glite-version',
+                               glite_info_templates=>'glite-info-templates',
+                               glue_schema=>'glue-schema',
+                               trustmanager=>'org.glite.security.trustmanager',
+                               axis=>'axis',
+                               lcas=>'org.glite.security.lcas',
+                               gsoapxx=>'-',
+                               build_common_cpp=>'org.glite.build.common-cpp',
+                               jdk=>'jdk',
+                       },
+               },
+               etics_externs_devel => {
+                       default => {
+                               gridsite=>'org.gridsite.devel',
+                       },
+               },
+               etics_projects => {
+                       vdt=>[qw/globus globus_essentials gpt/],
+                       'org.glite'=>[qw/voms gridsite lcas gip_release gip_service bdii glite_version glite_info_templates glue_schema yaim_core/],
+               },
+               etics_locations => {
+                       '*' => '',
+               },
+               need_externs_aux => {
+                       'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager utiljava libtool:B/ ],
+                       'lb.glite-LB' => [ qw/fetchcrl:R gpt:R gip_release:R gip_service:R bdii:R glite_version:R glite_info_templates:R glue_schema:R/ ],
+                       'lb.yaim' => [ qw/yaim_core:R perl-LDAP:R/ ],
+                       'px.glite-PX' => [qw/myproxy-server:R myproxy-admin:R fetchcrl:R gip_service:R bdii:R glite_version:R gpt:R glue_schema:R/],
+                       'px.myproxy-yaim' => [ qw/yaim_core:R/ ],
+               },
+               supported_platforms => {
+                       sl5_x86_64_gcc412 => 1,
+                       sl5_ia32_gcc412 => 1,
+                       deb5_x86_64_gcc432 => 1,
+                       deb5_ia32_gcc432 => 1,
+                       slc4_x86_64_gcc346 => 1,
+                       slc4_ia32_gcc346 => 1,
+               },
+               modules => {
+                       'lb' => [ qw/glite-LB/ ],
+                       'px' => [ qw/glite-PX/ ],
+               },
+       },
+
+       emi => {
+               etics_name => 'emi',
+               conf_prefix => {
+                       'lb' => 'emi-',
+                       'jp' => 'emi-',
+                       'jobid' => 'emi-',
+                       'lbjp-common' => 'emi-',
+                       'gridsite' => 'emi-',
+                       'px' => 'emi-',
+               },
+               tag_prefix => { %cvs_tag_prefix },
+               flavours => '--thrflavour= --nothrflavour=',
+               local_prefix => '/usr',
+               etics_externs => {
+                       default => {
+                               globus_essentials=>'globus-gssapi-gsi',
+                               globus=>'globus-gssapi-gsi-devel',
+                               gridsite=>'emi.gridsite.shared',
+                               yaim_core=>'emi.yaim.yaim-core',
+                               yaim_bdii=>'emi.bdii.yaim-bdii',
+                               gip_service=>'emi.bdii.glite-info-provider-service',
+                               bdii=>'emi.bdii.core',
+                               glite_version=>'emi.misc.glite-version',
+                               glue_schema=>'emi.bdii.glue-schema',
+                               trustmanager=>'emi.java-security.trustmanager',
+                               trustmanager_axis=>'emi.java-security.trustmanager-axis',
+                               axis=>'axis1.4',
+                               lcas=>'emi.sac.lcas',
+                               gsoapxx=>'-',
+                               build_common_cpp=>'emi.misc.glite.build-common-cpp',
+                               jdk=>'java',
+                       },
+                       sl5_x86_64_gcc412EPEL => {
+                               'myproxy-devel' => 'myproxy-devel.x86_64',
+                       },
+                       sl6_x86_64_gcc444EPEL => {
+                               'myproxy-devel' => 'myproxy-devel.x86_64',
+                       },
+                       deb6_x86_64_gcc445 => {
+                               globus_essentials => 'globus-gssapi-gsi4',
+                               globus => 'libglobus-gssapi-gsi-dev',
+                               axis => 'libaxis-java',
+                               cares => 'libc-ares2',
+                               cppunit => 'libcppunit',
+                               expat => 'libexpat1',
+                               log4c => 'liblog4c3',
+                               curl => 'libcurl3',
+                               'mysql' => 'libmysqlclient6',
+                               'mysql-devel' => 'libmysqlclient-dev',
+                               libxslt => 'xsltproc',
+                               'jakarta-commons-codec' => 'libcommons-codec-java',
+                               'jakarta-commons-lang' => 'libcommons-lang-java',
+                               'tetex-latex' => 'texlive-latex-extra',
+                       },
+               },
+               etics_externs_devel => {
+                       default => {
+                               cares => 'c-ares-devel',
+                               classads => 'classads-devel',
+                               cppunit => 'cppunit-devel',
+                               expat => 'expat-devel',
+                               gsoap => 'gsoap-devel',
+                               voms => 'org.glite.security.voms-api',
+                               libtar => 'libtar-devel',
+                               log4c => 'log4c-devel',
+                               postgresql => 'postgresql-devel',
+                               curl => 'curl-devel',
+                               libxml2 => 'libxml2-devel',
+                               openssl => 'openssl-devel',
+                               gridsite=>'emi.gridsite.devel',
+                               jdk=>'java-devel',
+                       },
+                       deb6_x86_64_gcc445 => {
+                               cares => 'libc-ares-dev',
+                               cppunit => 'libcppunit-dev',
+                               expat => 'libexpat1-dev',
+                               libtar => 'libtar-dev',
+                               log4c => 'liblog4c-dev',
+                               postgresql => 'libpq-dev',
+                               curl => 'libcurl4-openssl-dev',
+                               libxml2 => 'libxml2-dev',
+                               openssl => 'libssl-dev',
+                               'tetex-latex' => 'texlive-latex-extra',
+                               libxslt=>'xsltproc',
+                       },
+               },
+               etics_projects => {
+                       'emi'=>[qw/voms voms-devel gridsite lcas gip_service bdii glite_version glue_schema yaim_core yaim_bdii trustmanager trustmanager_axis/],
+               },
+               etics_locations => {
+                       axis => 'axis',
+               },
+               need_externs_aux => {
+                       'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager trustmanager_axis libtool:B/ ],
+                       'lb.glite-LB' => [ qw/fetchcrl:R gip_service:R bdii:R glite_version:R glue_schema:R/ ],
+                       'lb.yaim' => [ qw/yaim_core:R yaim_bdii:R perl-LDAP:R/ ],
+                       'px.glite-PX' => [qw/myproxy-server:R myproxy-admin:R fetchcrl:R gip_service:R bdii:R glite_version:R glue_schema:R/],
+                       'px.myproxy-yaim' => [ qw/yaim_core:R yaim_bdii:R/ ],
+               },
+               supported_platforms => {
+                       sl5_x86_64_gcc412EPEL => 1,
+                       sl5_ia32_gcc412EPEL => 1,
+                       sl6_x86_64_gcc444EPEL => 1,
+#                      deb6_x86_64_gcc445 => 1,
+               },
+               modules => {
+                       'lb' => [ qw/emi-lb/ ],
+                       'px' => [ qw/emi-px/ ],
+               },
+       },
+);
+
+%platform_properties = (
+       'gridsite.core' => {
+               sl5_x86_64_gcc412 => { aprSuffix => '1' },
+               sl5_ia32_gcc412 => { aprSuffix => '1' },
+               sl5_x86_64_gcc412EPEL => { aprSuffix => '1' },
+               sl5_ia32_gcc412EPEL => { aprSuffix => '1' },
+               deb5_x86_64_gcc432 => { aprSuffix => '1.0' },
+               deb5_ia32_gcc432 => { aprSuffix => '1.0' },
+               slc4_x86_64_gcc346 => { aprSuffix => '0' },
+               slc4_ia32_gcc346 => { aprSuffix => '0' },
+               sl6_x86_64_gcc444 => { aprSuffix => '1' },
+               deb6_x86_64_gcc445 => { aprSuffix => '1.0' },
+               default => { 
+               }
+       },
+       'jobid.api-java' => {
+               default => { 'package.buildarch' => 'noarch' },
+       },
+       'lb.types' => {
+               default => { 'package.buildarch' => 'noarch' },
+       },
+       'lb.doc' => {
+               default => { 'package.buildarch' => 'noarch' },
+       },
+       'lb.ws-interface' => {
+               default => { 'package.buildarch' => 'noarch' },
+       },
+       'lb.yaim' => {
+               default => { 'package.buildarch' => 'noarch' },
+       },
+       'px.yaim' => {
+               default => { 'package.buildarch' => 'noarch' },
+       },
+       'px.myproxy-config' => {
+               default => { 'package.buildarch' => 'noarch' },
+       },
+);
+
+my @k = keys %deps_aux;
+@buildroot{@k} = ('') x ($#k+1);
+
+$buildroot{'gridsite.core'} = 'src';
+}
+
+sub full
+{
+       my $short = shift;
+       return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short;
+}
+
+sub mkinc
+{
+       my %aux;
+       undef %aux;
+       my @m=qw/
+lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.logger-msg lb.nagios lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java lb.harvester lb.yaim lb.glite-LB
+lbjp-common.gss lbjp-common.gsoap-plugin
+jobid.api-c jobid.api-cpp jobid.api-java
+lbjp-common.db lbjp-common.log lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface lbjp-common.gss lbjp-common.gsoap-plugin
+jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface
+px.proxyrenewal px.myproxy-yaim px.glite-PX px.myproxy-config
+/;
+       @aux{@m} = (1) x ($#m+1);
+
+       my $short = shift;
+       my $full = full $short;
+
+       unless ($aux{$short}) {
+               print "Makefile.inc not needed in $full\n";
+               return;
+       }
+
+       my $top_srcdir = '.';
+       my $build = '';
+
+       if ($module) {
+               $top_srcdir = $0;
+               $top_srcdir =~ s,/?[^/]*$,,;
+               $top_srcdir =~ s,^$,\.,;
+       } else {
+               $build = "$full/";
+               unless ($buildroot{$_} eq '') {
+                       $top_srcdir = '..';
+                       $build .= "$buildroot{$_}/";
+                       unless (-d "$build") {
+                               mkdir "$build" or die "mkdir $build: $!\n";
+                       }
+               }
+       }
+       unless ($top_srcdir eq '.') {
+               unlink $build."Makefile";
+               symlink "$top_srcdir/Makefile",$build."Makefile" or die "symlink $top_srcdir/Makefile ".$build."Makefile: $!\n";
+               for my $file ('.pre', '.post', '.preun', '.postun changelog') {
+                       my $pfile = "project/$file";
+                       if (-f "$full/$pfile") {
+                               mkdir "$build/project" unless (-d "$build/project");
+                               unlink $build.$pfile;
+                               symlink "../$top_srcdir/$pfile", $build.$pfile or die "symlink ../$top_srcdir/$pfile ".$build."$pfile: $!\n";
+                       }
+               }
+       }
+
+       open MKINC,">".$build."Makefile.inc"
+               or die $build."Makefile.inc: $!\n";
+
+       print "Creating ".$build."Makefile.inc\n";
+
+       print MKINC qq{project = $project
+PREFIX = $root
+prefix = $prefix
+stagedir = $stagedir
+sysroot = $sysroot
+sysconfdir = $sysconfdir
+localstatedir = $localstatedir
+thrflavour = $thrflavour
+nothrflavour = $nothrflavour
+libdir = $libdir
+top_srcdir = $top_srcdir
+};
+
+       for (@{$need_externs{$short}}) {
+               next unless defined $externs{$_} and defined $externs{$_}{prefix};
+               print MKINC "${_}_prefix = $externs{$_}{prefix}\n";
+               print MKINC "$externs{$_}{flags}" if defined $externs{$_}{flags};
+       }
+
+       for (@{$need_jars{$short}}) {
+               print MKINC "${_}_jar = $jar{$_}\n"
+       }
+
+       my $need_gsoap = 0;
+       for (@{$need_externs{$short}})  { $need_gsoap = 1 if $_ eq 'gsoap'; }
+
+       print MKINC "gsoap_default_version=".gsoap_version()."\n"  if $need_gsoap;
+
+       close MKINC;
+}
+
+BEGIN{
+};
+
+sub mode_etics {
+       $fmod = shift;
+
+       die "$0: --module required with --etics\n" unless $fmod;
+       
+       my ($subsys,$module) = split /\./,$fmod;
+
+       my ($major,$minor,$rev,$age);
+
+       if ($version) {
+               $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/;
+               ($major,$minor,$rev,$age) = ($1,$2,$3,$4);
+       }
+       else { 
+               my $path = "$cvs_prefix{$subsys}.$subsys.$module/project";
+               if ($subsys eq 'gridsite') {
+                       $path = "$cvs_prefix{$subsys}.$subsys.core/project";
+               }
+               open V,"$path/version.properties"
+                       or die "$cvs_prefix{$subsys}.$subsys.$module/project/version.properties: $!\n";
+       
+               while ($_ = <V>) {
+                       chomp;
+                       ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/;
+                       $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/;
+               }
+               close V;
+       }
+
+       # XXX: --with ignored for platform-dependend packages
+       my @copts = ();
+       my %ge;
+       @ge{@{$etics_projects{$project{etics_name}}}} = (1) x ($#{$etics_projects{$project{etics_name}}}+1);
+
+       for (@{$need_externs{"$subsys.$module"}}) {
+           if ($need_externs_type{"$subsys.$module"}->{$_}=~/B/ and (defined $externs{$_} or defined $jar{$_})) {
+               my $eext = $etics_externs{default}{$_} ? $etics_externs{default}{$_} : $_;
+               next if ($eext eq '-');
+               if (defined $project{etics_locations}{'*'} or defined $project{etics_locations}{$_}) {
+                       $eext = $project{etics_locations}{$_} if ($project{etics_locations}{$_});
+                       push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}";
+               } else {
+                       if ($ge{$_} and not defined $externs{$_}{pkg}) {
+                               push @copts, "--with-$_=\${stageDir}";
+                       }
+               }
+           }
+       }
+
+       for (@{$need_jars{"$subsys.$module"}}) {
+               my $eext = $etics_externs{default}{$_} ? $etics_externs{default}{$_} : $_;
+
+               push @copts,"--with-$_ \${$eext.location}$jar{$_}" if (defined $project{etics_locations}{'*'} or defined $project{etics_locations}{$_});
+       }
+
+       my $conf;
+       my $conftag;
+       my ($confprefix, $nameprefix);
+
+       $dwpath = "path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz\n";
+
+       $confprefix = $project{conf_prefix}{$subsys};
+       $nameprefix = $confprefix;
+       $nameprefix =~ s/-$//;
+       $nameprefix =~ s/-/\./g;
+
+       if ($branch) {
+               $conf = "$confprefix${subsys}-${module}_$branch"; 
+               $conftag = $branch;
+               # forced low age number
+               $age = $branch eq 'HEAD' ? '0head' : '0dev'; }
+       else {
+               $conf = "$confprefix$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; 
+
+# XXX: gridsite hack
+               $conftag = $subsys eq 'gridsite' ? "$project{tag_prefix}{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}" : 
+                       "$project{tag_prefix}{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; }
+
+       my $file = $output ? $output : "$conf.ini";
+       open C,">$file" or die "$file: $!\n";
+
+       my $buildroot = $buildroot{"$subsys.$module"} eq '' ? '#no build.root' : "build.root = " . $buildroot{"$subsys.$module"};
+
+       my $confdir = $buildroot{"$subsys.$module"} eq '' ? '.' : '..';
+
+       my $package_description = "";
+       my $package_summary = "";
+
+       if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.description") {
+               open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.description";
+               $package_description = join ("", <V>);
+               close V;
+               chomp $package_description;
+               $package_description =~ s/\n/\\n/g; 
+               $package_description = "package.description = $package_description\n";
+       } 
+       else { 
+               print STDERR "package.description not found for $subsys.$module!\n"; }
+
+       if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary") {
+               open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary";
+               $package_summary = join ("", <V>);
+               close V;
+               chomp $package_summary;
+               $package_summary =~ s/\n/\\n/g; 
+               $package_summary = "package.summary = $package_summary\n";
+       } 
+       else { 
+               print STDERR "package.summary not found for $subsys.$module!\n"; }
+
+       my %cmd;
+       @cmd{qw/configure compile test install packaging clean/} = ('None') x 6;
+       $cmd{clean} = 'make clean';
+       $cmd{checkout} = "cvs -d \${vcsroot} co -d \${moduleName} ".($conftag eq 'HEAD' ? '-A' : '-r ${tag}')." $cvs_prefix{$subsys}.$subsys.$module 2>/dev/null";
+       #$cmd{checkout} = "(test -d jra1mw/.git && (cd jra1mw; git pull) || git clone http://scientific.zcu.cz/git/jra1mw.git)";
+       #$cmd{checkout} .= " && (cd jra1mw; git checkout \${tag})" unless ($conftag =~ /HEAD/);
+       #$cmd{checkout} .= " && ln -s jra1mw/$cvs_prefix{$subsys}.$subsys.$module \${moduleName}";
+       $cmd{tag} = "cvs -d \${vcsroot} tag -R \${tag} ${moduleName}";
+
+       if ($subsys eq 'gridsite') {
+               $cmd{tag} = 'None';
+
+               if ($module eq 'core') {
+                       my ($flags, $prefix, $make_patches);
+
+                       if ($project ne 'glite') {
+                               $flags = 'RELEASE_VERSION=${age}.${platformFamily} libdir=${libdir} GSOAPDIR=`pkg-config gsoap --variable=prefix` OPENSSL_GLOBUS_FLAGS=`pkg-config globus-openssl --cflags` OPENSSL_GLOBUS_LIBS=`pkg-config globus-openssl --libs` FLAVOR_GLOBUS_EXT= HTTPD_FLAGS="-I/usr/include/httpd -I/usr/include/apache2 -I/usr/include/apr-${aprSuffix} -I/usr/include/pcre"';
+                               $prefix = 'prefix=${prefix}/usr';
+                       } else {
+                               $flags = 'RELEASE_VERSION=${age}.${platformFamily} libdir=${libdir} GSOAPDIR=${gsoap.location} OPENSSL_GLOBUS_FLAGS=-I${globus.location}/include/${globus.dbg.nothr.flavor} OPENSSL_GLOBUS_LIBS=-L${globus.location}/${libdir}/ FLAVOR_GLOBUS_EXT=_${globus.dbg.nothr.flavor} HTTPD_FLAGS="-I${httpd-devel.location}/include/httpd -I${httpd-devel.location}/include/apache2 -I${httpd-devel.location}/include/apr-${aprSuffix} -I${httpd-devel.location}/include/pcre"';
+                               $prefix = 'prefix=${prefix}';
+                       }
+                       if ($project eq 'emi') {
+                               # proper dependency name in spec-file
+                               $cmd{checkout} .= " && \\
+       (cd \${moduleName}; test -f src/make-gridsite-spec.orig || sed -i.orig 's/\\(Buildrequires: libxml2-devel.*\\)/\\1,globus-gssapi-gsi-devel/' src/make-gridsite-spec)";
+                               $make_patches = "
+       diff -up make-gridsite-spec.orig make-gridsite-spec > \${moduleDir}/RPMTMP/SOURCES/emi-deps.patch
+       diff -up make-gridsite-spec.orig make-gridsite-spec > \${moduleDir}/src/tgz/emi-deps.patch";
+                       }
+
+                       $cmd{compile} = "echo 'make $flags' > build.sh\n\tmake $prefix $flags build";
+                       $cmd{clean} = "rm -rvf build.sh \${moduleDir}/src/tgz; $cmd{clean}";
+                       $cmd{install} = "make $prefix $flags install";
+                       $cmd{packaging} = "mkdir -p \${moduleDir}/RPMTMP/SOURCES \${moduleDir}/src/tgz 2>/dev/null || true $make_patches
+       make $prefix $flags rpm && \
+       cp \${moduleDir}/RPMTMP/SOURCES/gridsite-\${version}.src.tar.gz \${moduleDir}/src/tgz";
+               }
+               else {
+                       $cmd{clean} = 'None';
+                       $cmd{packaging} = "echo building nothing, org.gridsite.core make rpm step will create this";
+                       $cmd{checkout} = "mkdir -v \${moduleName} 2>/dev/null || true";
+               }
+       }
+       elsif ($subsys eq 'px' and $module eq 'myproxy-config') {
+               $cmd{configure} = "/usr/bin/perl $confdir/configure --root=\${prefix} --prefix= --stage=\${stageDir} --libdir=\${libdir} --project=\${projectName} --module $subsys.$module @copts";
+               $cmd{packaging} = "make rpm package=".$confprefix."$subsys-myproxy-config";
+       }
+       else {
+               $cmd{configure} = "/usr/bin/perl $confdir/configure $project{flavours} --root=\${prefix} --prefix=$project{local_prefix} --stage=\${stageDir} --sysroot=\${package.prefix} --libdir=\${libdir} --project=\${projectName} --module $subsys.$module @copts";
+               $cmd{compile} = 'make';
+               $cmd{test} = 'make check';
+               $cmd{install} = 'make install';
+               if ($subsys eq 'lb' and $module eq 'client') {
+                       $cmd{compile} = "make rpath=$project{local_prefix}/\${libdir}";
+                       $cmd{install} = "make install post-install rpath=$project{local_prefix}/\${libdir}";
+               }
+       }
+
+       my $defprops = '';
+
+       for my $p (keys %{$platform_properties{"$subsys.$module"}->{default}}) {
+               $defprops .= $p . ' = ' . $platform_properties{"$subsys.$module"}->{default}->{$p} . "\n";
+       }
+
+       print STDERR "Writing $file\n";
+       print C qq{
+[Configuration-$conf]
+profile = None
+moduleName = $project{etics_name}.$subsys.$module
+displayName = $conf
+description = $cvs_prefix{$subsys}.$subsys.$module
+projectName = $project{etics_name}
+age = $age
+deploymentType = None
+vcsroot = :pserver:anonymous\@glite.cvs.cern.ch:/cvs/glite
+tag = $conftag
+version = $major.$minor.$rev
+$dwpath
+[Platform-default:VcsCommand]
+displayName = None
+description = None
+tag = $cmd{tag}
+branch = None
+commit = None
+checkout = $cmd{checkout}
+
+[Platform-default:BuildCommand]
+postpublish = None
+packaging = $cmd{packaging}
+displayName = None
+description = None
+doc = None
+prepublish = None
+publish = None
+compile = $cmd{compile}
+init = None
+install = $cmd{install}
+clean = $cmd{clean}
+test = $cmd{test}
+configure = $cmd{configure}
+checkstyle = None
+
+[Platform-default:Property]
+$buildroot
+aprSuffix = 0
+package.RPMSLocation = \${moduleDir}/RPMTMP/RPMS
+package.SRPMSLocation = \${moduleDir}/RPMTMP/SRPMS
+package.preserve.libtool = false
+$package_description$package_summary$defprops};
+
+       for (@{$obsoletes{"$subsys.$module"}}) {
+               print C "package.obsoletes = $_\n";
+               print C "package.replaces = $_\n";
+       }
+       for (@{$conflicts{"$subsys.$module"}}) {
+               print C "package.conflicts = $_\n";
+       }
+       for (@{$provides{"$subsys.$module"}}) {
+               print C "package.provides = $_\n";
+       }
+
+       for my $pp (keys %{$platform_properties{"$subsys.$module"}}) {
+               next if $pp eq 'default';
+               next if exists $project{supported_platforms} and not exists $project{supported_platforms}{$pp};
+
+               print C "[Platform-$pp:Property]\n$buildroot\n";
+
+               for my $p (keys %{$platform_properties{"$subsys.$module"}->{$pp}}) {
+                       print C $p . ' = ' . $platform_properties{"$subsys.$module"}->{$pp}->{$p} . "\n";
+               }
+               print C "package.RPMSLocation = \${moduleDir}/RPMTMP/RPMS
+package.SRPMSLocation = \${moduleDir}/RPMTMP/SRPMS\n";
+               print C "$package_description$package_summary\n";
+       }
+
+       for my $platform ('default', keys %{$project{supported_platforms}}) {
+               my $used = 0;
+               my $output = '';
+
+               for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) {
+                       my $eext = $etics_externs{$platform}{$_};
+                       my $edev = $project{etics_externs_devel}{$platform}{$_};
+
+                       # for the default platform using package of the same
+                       # name for runtime dependency
+                       if (not $eext) {
+                               if ($platform eq 'default') {
+#print "default runtime $_ on default\n";
+                                       $eext = $_; }
+                               else {
+#print "no runtime $_ on $platform\n";
+                                       $eext = '-'; }
+                       }
+                       if ($eext eq '-' and $edev eq '-') {
+#print "skipping $_ on $platform\n";
+                               next;
+                       }
+
+                       my $proj = 'externals';
+                       for my $p (keys %etics_projects) {
+                               for $m (@{$etics_projects{$p}}) {
+                                       $proj = $p if $m eq $_;
+                               }
+                       }
+
+                       my $type = $need_externs_type{"$subsys.$module"}->{$_};
+
+                       if ($edev) {
+                               if ($type eq 'B') {
+                                       # no runtime - change to devel pkg
+                                       $eext = $edev;
+                               } elsif ($type eq 'BR' or $type eq 'RB') {
+                                       # additional devel pkg
+                                       if ($edev ne '-') { $output .= "$proj|$edev = B\n"; }
+                               }
+                       }
+                       if ($eext ne '-') { $output .= "$proj|$eext = $type\n"; }
+               }
+
+               if ($platform eq 'default') {
+                       for (@{$deps{"$subsys.$module"}}) {
+                               my $type = $deps_type{"$subsys.$module"}->{$_};
+                               if (not $used) {
+                                       $used = 1;
+                               }
+                               $output .= "$project{etics_name}|$project{etics_name}.$_ = $type\n";
+                       }
+               }
+
+               if ($output) {
+                                       print C qq{
+[Platform-$platform:DynamicDependency]
+$output};
+               }
+       }
+
+       close C;
+}
+
+sub gsoap_version {
+       local $_;
+       my $gsoap_version;
+       open S,"$externs{gsoap}{prefix}/bin/soapcpp2 -v 2>&1 |" or die "$externs{gsoap}{prefix}/bin/soapcpp2: $!\n";
+
+       while ($_ = <S>) {
+               chomp;
+
+               $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/;
+               $gsoap_version = $1 if /The gSOAP code generator for C and C\+\+, soapcpp2 release ([.[:digit:][:alpha:]]+)$/;
+       }
+       close S;
+       return $gsoap_version;
+}
+
+sub getlibdir {
+       if ( -e "/etc/debian_version") { # We are on Debian
+               $lib64="lib";
+               $lib32="lib32"; }
+       else { # Another distribution
+               $lib64="lib64";
+               $lib32="lib";   }
+        $libdir=$lib32;
+
+        open INP, "uname -s | "; # Check kernel name
+        $kname= <INP>;
+        chomp($kname);
+        close INP;
+
+        if ( $kname eq "Linux") {
+                $arch = ("x86_64\npowerpc\nppc64\n");
+
+                open INP, "uname -p | "; # Check processor type
+                $procname= <INP>;
+                chomp($procname);
+                close INP;
+
+                if ($arch =~/^$procname\n/) {
+                        return ($lib64); }
+
+                open INP, "uname -m | "; # Check machine hardware
+                $machname= <INP>;
+                chomp($machname);
+                close INP;
+
+                if ($arch =~/^$machname\n/) {
+                        return ($lib64); }
+
+                # special cases (hyperlink lib64, Debian)
+                if (-l "/usr/lib64") {
+                        $libdir=$lib32; }
+
+                # if /usr/lib64 doesn't exist at all (AIX)
+                unless ( -e "/usr/lib64" ) {
+                        $libdir=$lib32; }
+        }
+
+        if ( $kname eq "SunOS") {
+                if (-e "/usr/lib/64") {
+                $libdir="lib/64"; }
+        }
+
+        return $libdir;
+}
+
+sub reshuffle_platforms($$) {
+       my ($data, $platforms) = @_;
+       my ($platform, %blacklist, $value);
+
+       return if not $platforms;
+
+       for $platform (keys %$data) {
+#print "plat: $platform: $data->{$platform}\n";
+               next if $platform eq 'default';
+               for $_ (keys %{$data->{$platform}}) {
+#print "  blacklist: $_ = $data->{$platform}{$_}\n";
+                       $blacklist{$_} = 1;
+               }
+       }
+
+       for $_ (keys %blacklist) {
+               $value = $data->{default}{$_} ? $data->{default}{$_} : $_;
+               for $platform (keys %$platforms) {
+                       next if $platform eq 'default';
+                       if (not defined $data->{$platform}{$_}) {
+                               $data->{$platform}{$_} = $value;
+#print "added $value to $platform\n"
+                       }
+               }
+               $data->{default}{$_} = '-';
+#print "deleted $_ from default\n";
+       }
+
+       # merge dependencies across the supported platforms
+       %blacklist = [];
+       for $platform (keys %$platforms) {
+               next if $platform eq 'default';
+               for $_ (keys %{$data->{$platform}}) {
+                       $blacklist{$_} = 1;
+               }
+       }
+       for $_ (keys %blacklist) {
+               $value = undef;
+               $same = 1;
+               for $platform (keys %$platforms) {
+                       if (not $value) { $value = $data->{$platform}{$_}; }
+                       if (not $data->{$platform}{$_} or $value ne $data->{$platform}{$_}) {
+                               $same = 0;
+                               last;
+                       }
+               }
+               if ($same and $value) {
+#print "merged dependency $_\n";
+                       $data->{default}{$_} = $value;
+                       for $platform (keys %$platforms) {
+                               delete $data->{$platform}{$_};
+                       }
+               }
+       }
+}
+
+sub usage {
+       my @ext = keys %externs;
+       my @myjars = keys %jar;
+
+       print STDERR qq{
+Usage: $0 options
+
+General options (defaults in []):
+  --prefix=PREFIX              destination directory [./stage]
+  --stage=DIR                  staging directory [./stage]
+  --root=DIR                   installation root (custom relocation root -> sysroot) [./stage]
+  --sysroot=DIR                        system root (custom relocation root -> sysroot) []
+  --sysconfdir=DIR              system configuration directory [PREFIX/etc]
+  --staged=module,module,...   what is already in PREFIX (specify without org.glite.)
+  --thrflavour=flavour
+  --nothrflavour=flavour       threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg]
+  --listmodules=subsys          list modules of a subsystem
+  --version=maj.min.rev-age    specify version here instead of reading version.properties
+  --branch=branch              CVS branch/etics name suffix (HEAD, branch_2_1, ...)
+  --libdir=libdir              typically [lib,lib64] postfix
+  --project=PROJECT            build or generate etics for a project (glite/emi) [emi]
+  --debug                      print more details
+  
+Mode of operation:
+  --mode=\{checkout|build|etics\}      what to do [build]
+  
+What to build:
+  --module=module              build this module only
+  --enable-NODE                        build this "node" (set of modules) only
+  --disable-NODE               don't build this node
+  --lb-tag=tag                 checkout LB modules with specific tag
+  --jp-tag=tag                 checkout JP modules with specific tag
+  --lbjp-common-tag=tag         checkout lbjp-common modules with specific tag
+  --jobid-tag=tag              checkout jobid modules with specific tag
+
+Dependencies (summary of what will be used is always printed):
+  --with-EXTERNAL=PATH         where to look for an external [autodetect]
+  --with-JAR=JAR               where to look for jars
+
+Available nodes:
+    @nodes
+
+Default nodes:
+    @default_nodes
+
+Externals (not all for all modules) are:
+    @ext
+
+External jars are:
+    @myjars
+
+};
+
+}
diff --git a/org.glite.lb.nagios/project/ChangeLog b/org.glite.lb.nagios/project/ChangeLog
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/org.glite.lb.nagios/project/package.description b/org.glite.lb.nagios/project/package.description
new file mode 100644 (file)
index 0000000..c97e3c2
--- /dev/null
@@ -0,0 +1 @@
+This is a package to distribute a nagios probe that checks the EMI L&B server. It is a shell-based script titled check_lb_server.
diff --git a/org.glite.lb.nagios/project/package.summary b/org.glite.lb.nagios/project/package.summary
new file mode 100644 (file)
index 0000000..49a7171
--- /dev/null
@@ -0,0 +1 @@
+This is a package to distribute a nagios probe that checks the EMI L&B server.
diff --git a/org.glite.lb.nagios/project/version.properties b/org.glite.lb.nagios/project/version.properties
new file mode 100644 (file)
index 0000000..3d509b5
--- /dev/null
@@ -0,0 +1,3 @@
+# $Header
+module.version=1.0.0
+module.age=0
diff --git a/org.glite.lb.nagios/src/LB-probe b/org.glite.lb.nagios/src/LB-probe
new file mode 100755 (executable)
index 0000000..51e5ded
--- /dev/null
@@ -0,0 +1,372 @@
+#!/bin/bash
+#
+# Copyright (c) Members of the EGEE Collaboration. 2004-2010.
+# See http://www.eu-egee.org/partners for details on the copyright holders.
+# 
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# show help and usage
+progname=`basename $0`
+showHelp()
+{
+cat << EndHelpHeader
+Nagios probe for testing the status of L&B
+
+Tests called:
+    job registration
+    notification registration
+    logging events
+    receiving notifications
+
+Return values:
+    0: Passed
+    1: Warning
+    2: Critical
+    3: Unknown
+
+Console output:
+    OK|<time to transit from Registered to Cleared>
+    WARNING: <reason>
+    DOWN: <reason>
+    UNKNOWN: <reason>
+
+EndHelpHeader
+
+       echo "Usage: $progname [-h] [-v[v[v]]] [server[:port]]"
+       echo "Options:"
+       echo "    -h | --help       Show this help message."
+       echo "    -v[vv]            Verbosity level."
+       echo "    server:           Environmental variables are used if unspecified"
+       echo "    port:             Environmental variables or defaults are used if unspecified)"
+       echo ""
+}
+
+function vprintf()
+{
+#      echo $1 le $VERBLEVEL
+       if [ $1 -le $VERBLEVEL ]; then
+               printf "$2"
+       fi
+}
+
+function check_exec()
+{
+        if [ -z $1 ]; then
+                set_error "No binary to check"
+                return 1
+        fi
+        # XXX: maybe use bash's command type?
+        local ret=`which $1 2> /dev/null`
+        if [ -n "$ret" -a -x "$ret" ]; then
+                return 0
+        else
+                return 1
+        fi
+}
+
+function check_binaries()
+{
+        local ret=0
+        for file in $@
+        do
+                check_exec $file
+                if [ $? -gt 0 ]; then
+                        vprintf 3 "\nfile $file not found\n"
+                        ret=1
+                fi
+        done
+        return $ret
+}
+
+function try_purge()
+{
+                        joblist=$1
+
+                        vprintf 2 "\n[LB Probe] Trying to purge test job"
+
+                        glite-lb-purge -j ${joblist} > /dev/null 2> /dev/null
+                        rm ${joblist}
+}
+
+function log_cleared()
+{
+                EDG_WL_SEQUENCE="UI=000003:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000"
+
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s NetworkServer -e Accepted --from="UserInterface" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s NetworkServer -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s WorkloadManager -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperCall --helper_name="name of the called component" --helper_params="parameters of the call" --src_role=CALLING`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s WorkloadManager -e Match --dest_id="${DESTINATION:-destination CE/queue}"`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperReturn --helper_name="name of the called component" --retval="returned data" --src_role=CALLING`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s WorkloadManager -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s JobController -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s JobController -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s LogMonitor -e Accepted --from="JobController" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s LogMonitor -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s LogMonitor -e Running --node="${CE_NODE:-worker node}"`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s LogMonitor -e Done --status_code=OK --reason="reason for the change" --exit_code=0`
+                EDG_WL_SEQUENCE=`glite-lb-logevent -j $1 -c $EDG_WL_SEQUENCE -s LogMonitor -e Clear --reason=USER`
+}
+
+VERBLEVEL=0
+
+while test -n "$1"
+do
+       case "$1" in
+               "-h" | "--help") showHelp && exit 2 ;;
+               "-v" )  VERBLEVEL=$(( $VERBLEVEL + 1 )) ;;
+               "-vv" )  VERBLEVEL=$(( $VERBLEVEL + 2 )) ;;
+               "-vvv" )  VERBLEVEL=$(( $VERBLEVEL + 3 )) ;;
+               *) SRVPORT="$1" ;;
+#              "-t" | "--text")  setOutputASCII ;;
+       esac
+       shift
+done
+
+export VERBLEVEL
+
+#Set path to L&B example commands used by the probe
+for exdir in /usr/lib64/glite-lb/examples /usr/lib/glite-lb/examples /opt/glite/examples
+do
+       if [ -d "$exdir" ]; then
+               export PATH=$PATH:$exdir
+               vprintf 3 "[LB Probe] adding $exdir to PATH\n"
+       fi
+done
+
+#Extract srv:port from evnironmental variables, or vice versa
+if [ -z $SRVPORT ]; then
+       servername=`echo ${GLITE_WMS_QUERY_SERVER} | sed "s/:.*//"`
+       portnumber=`echo ${GLITE_WMS_QUERY_SERVER} | grep -o -E ":.*$" | sed 's/[^0-9]//g'`
+
+else
+       servername=`echo ${SRVPORT} | sed "s/:.*//"`
+       portnumber=`echo ${SRVPORT} | grep -o -E ":.*$" | sed 's/[^0-9]//g'`
+fi
+
+#exit if server not specified
+if [ -z $servername ]; then
+       vprintf 0 "UNKNOWN: No server specified\n"
+       exit 3
+fi
+
+#use default if server port is not specified
+if [ -z $portnumber ]; then
+       if [ -z $GLITE_LB_SERVER_PORT ]; then
+               portnumber=9000
+       else
+               portnumber=$GLITE_LB_SERVER_PORT
+       fi
+fi
+
+#use default if logger port is not specified
+if [ -z $GLITE_LB_LOGGER_PORT ]; then
+       GLITE_LB_LOGGER_PORT=`expr $portnumber + 2`
+fi
+
+wsportnumber=`expr $portnumber + 3`
+
+#override environmental variables if server/port was specified
+#if [ "$SRVPORT" != "" ]; then
+if [ ! -z $SRVPORT ]; then
+       export GLITE_WMS_QUERY_SERVER=$servername:$portnumber
+       export GLITE_WMS_NOTIF_SERVER=$servername:$portnumber
+       export GLITE_WMS_LOG_DESTINATION=$servername:`expr $portnumber + 2`
+       export GLITE_LB_LOGGER_PORT=`expr $portnumber + 2`
+       export GLITE_LB_SERVER_PORT=$portnumber
+fi
+
+if [ $VERBLEVEL -ge 2 ]; then
+       env | grep -E "GLITE_|PATH"
+       printf "*** $servername:$portnumber\n"
+fi
+
+##
+#  Starting the test
+#####################
+
+{
+vprintf 2 "[LB Probe] Starting test"
+
+EXITCODE=0
+EXITMESSAGE=""
+
+# check_binaries
+vprintf 3 "\n[LB Probe] Testing if all binaries are available"
+check_binaries grid-proxy-info grep sed echo wc cat awk glite-lb-notify glite-lb-job_reg glite-lb-job_status glite-lb-purge glite-lb-ws_getversion glite-lb-logevent
+if [ $? -gt 0 ]; then
+       vprintf 2 "\n[LB Probe] Some Commands are unavailable\n\n"
+       vprintf 0 "UNKNOWN: Some commands are not available\n"
+       exit 3
+fi
+
+vprintf 2 "\n[LB Probe] Testing credentials"
+
+timeleft=`grid-proxy-info | grep -E "^timeleft" | sed "s/timeleft\s*:\s//"`
+
+if [ "$timeleft" = "" ]; then
+        vprintf 2 "\n[LB Probe] Test failed -- No credentials\n\n"
+       vprintf 0 "UNKNOWN: NO CREDENTIALS\n"
+       exit 3
+else
+        if [ "$timeleft" = "0:00:00" ]; then
+                vprintf 2 "\n[LB Probe] Test failed -- Credentials expired\n\n"
+               vprintf 0 "UNKNOWN: CREDENTIALS EXPIRED\n"
+               exit 3
+        else
+               
+               vprintf 2 "\n[LB Probe] Getting server version"
+               serverversion=`glite-lb-ws_getversion -m $servername:$wsportnumber`
+               if [ -z "$serverversion" ]; then
+                       vprintf 2 "\n[LB Probe] Test failed -- server did not respond\n\n"
+                       vprintf 0 "DOWN: UNABLE TO GET SERVER VERSION\n"
+                       exit 2
+               else
+                       echo $serverversion | grep -E "version.*[0-9]+\.[0-9]+\.[0-9]+" > /dev/null
+                       if [ $? = 0 ]; then
+                               vprintf 3 ": $serverversion"
+                       else
+                               vprintf 2 " - unexpected output ($serverversion). A WARNING will be returned."
+                               EXITMESSAGE="$EXITMESSAGE[Unexpected version output ($serverversion)]"
+                               EXITCODE=1
+                       fi
+               fi
+
+               # Register job:
+               vprintf 2 "\n[LB Probe] Registering testing job "
+               jobid=`glite-lb-job_reg -m ${GLITE_WMS_QUERY_SERVER} -s application 2>&1 | grep "new jobid" | awk '{ print $3 }'`
+
+               if [ -z $jobid ]; then
+                       vprintf 2 " Failed to register job\n[LB Probe] Test failed \n\n"
+                       vprintf 0 "DOWN: JOB REGISTRATION FAILED LOCALLY\n"
+                       exit 2
+               else
+                       vprintf 3 "${jobid}"
+
+                       jobstate=`glite-lb-job_status ${jobid} | grep "state :" | awk '{print $3}'`
+                       if [ "${jobstate}" = "Submitted" ]; then
+                               vprintf 3 ", server side OK"
+                        else
+                               vprintf 2 "\n[LB Probe] Test failed -- Job has not been submitted to server\n\n"
+                               vprintf 0 "DOWN: L&B SERVER NOT RUNNING\n"
+                               exit 2
+                        fi
+               fi
+       
+
+               # Register notification:
+               vprintf 2 "\n[LB Probe] Registering notification "
+
+               notifid=`glite-lb-notify new -j ${jobid} | grep "notification ID" | awk '{ print $3 }'`
+
+               if [ -z $notifid ]; then
+                       vprintf 2 "\n[LB Probe] Test failed -- Failed to register notification\n\n"
+                       vprintf 0 "DOWN: L&B SERVER NOT RUNNING\n"
+                       exit 2
+               else
+                       vprintf 3 "${notifid}"
+
+                       vprintf 2 "\n[LB Probe] Logging events resulting in state Cleared"
+                       log_cleared ${jobid}
+
+                       NOTIFFILE="/tmp/$$_notifications.txt"           
+                       STATEFILE="/tmp/$$_jobstat.txt"         
+                       echo '' > $NOTIFFILE
+       
+                       TOREPS=4; #Repetitions before timeout
+                       CLRNOTIFIED=0;
+                       vprintf 2 "\n[LB Probe] Waiting for delivery/processing"
+                       while [ $CLRNOTIFIED -eq 0 -a $TOREPS -gt 0 ]
+                       do
+                               glite-lb-notify receive -i 5 ${notifid} >> $NOTIFFILE 2> /dev/null 
+
+                               CLRNOTIFIED=`cat $NOTIFFILE | grep -E "$jobid.*Cleared" | wc -l` > /dev/null
+                               TOREPS=$(( $TOREPS - 1 ))
+                       done
+
+                       glite-lb-job_status ${jobid} > $STATEFILE
+                       jobstate=`cat $STATEFILE | grep "state :" | awk '{print $3}'`
+
+                       vprintf 2 "\n[LB Probe] Checking job state"
+                       if [ "${jobstate}" = "Submitted" ]; then
+                               vprintf 2 "\n[LB Probe] Test failed -- Job state has not changed (${jobstate})\n\n"
+                               vprintf 0 "DOWN: EVENT DELIVERY CHAIN (LOGGER/INTERLOGGER) NOT RUNNING\n"
+                               rm $NOTIFFILE $STATEFILE
+                               exit 2
+                        else
+                               vprintf 3 " -- ${jobstate}"
+                               if [ "${jobstate}" != "Cleared" ]; then
+                                       vprintf 3 ", not Cleared. A WARNING will be returned."
+                                       EXITMESSAGE="$EXITMESSAGE[Unexpected state of test job (${jobstate})]"
+                                       EXITCODE=1
+                               fi
+                        fi
+
+                       vprintf 2 "\n[LB Probe] Checking if notifications were delivered"
+                       NOTIFS=`cat $NOTIFFILE | wc -l`
+
+                       grep ${jobid} $NOTIFFILE > /dev/null
+
+                       if [ $? = 0 ]; then
+                               vprintf 3 ", OK ($NOTIFS messages)"
+                       else
+                               vprintf 2 "\n[LB Probe] Test failed -- Notifications were not delivered\n\n"
+                               vprintf 0 "DOWN: NOTIFICATION INTERLOGGER NOT RUNNING\n"
+                               rm $NOTIFFILE $STATEFILE
+                               exit 2
+                       fi
+
+                       if [ $VERBLEVEL -ge 3 ]; then
+                               cat $NOTIFFILE
+                       fi
+
+                       regtime=`cat $STATEFILE | grep -E "^[\t ]+Submitted[\t ]+" | sed 's/[\t ]*Submitted[\t ]*//'`
+                       clrtime=`cat $STATEFILE | grep -E "^[\t ]+Cleared[\t ]+" | sed 's/[\t ]*Cleared[\t ]*//'`
+                       REGTIME=`date -d "$regtime" +%s`
+                       CLRTIME=`date -d "$clrtime" +%s`
+
+                       rm $NOTIFFILE $STATEFILE
+
+                       #Drop notification
+                       vprintf 2 "\n[LB Probe] Dropping the test notification (${notifid})"
+                       dropresult=`glite-lb-notify drop ${notifid} 2>&1`
+                       if [ -z $dropresult ]; then
+                               vprintf 3 ""
+                       else
+                               vprintf 2 "\n[LB Probe] Test failed"
+                               vprintf 2 " Failed to drop notification ${dropresult}, A WARNING will be returned."
+                               EXITMESSAGE="$EXITMESSAGE[Could not drop notification]"
+                               EXITCODE=1
+                       fi
+
+                       #Purge test job
+                       joblist="/tmp/$$_jobs_to_purge.txt"
+                       echo $jobid > ${joblist}
+                       try_purge ${joblist}
+
+               fi
+       fi
+fi
+
+vprintf 2 "\n[LB Probe] Test finished\n\n"
+}
+
+if [ $EXITCODE -eq 0 ]; then
+       EXITMESSAGE="OK|`expr $CLRTIME - $REGTIME`s"
+else
+       EXITMESSAGE="WARNING: $EXITMESSAGE" 
+fi
+printf "$EXITMESSAGE\n"
+exit $EXITCODE
+