merged changes from HEAD
authorMichal Voců <michal@ruk.cuni.cz>
Thu, 3 May 2012 07:12:31 +0000 (07:12 +0000)
committerMichal Voců <michal@ruk.cuni.cz>
Thu, 3 May 2012 07:12:31 +0000 (07:12 +0000)
28 files changed:
org.glite.lb.client/Makefile
org.glite.lb.client/configure
org.glite.lb.client/doc/glite-lb-notify.1
org.glite.lb.client/examples/job_status.c
org.glite.lb.client/examples/job_status_threaded.c
org.glite.lb.client/examples/query_ext.c
org.glite.lb.client/examples/reallyrunning.l [new file with mode: 0644]
org.glite.lb.client/examples/user_jobs.c
org.glite.lb.client/interface/stat_fields.h
org.glite.lb.client/project/ChangeLog
org.glite.lb.client/project/debian.control [new file with mode: 0644]
org.glite.lb.client/project/debian.copyright [new file with mode: 0644]
org.glite.lb.client/project/debian.glite-lb-client-progs.dirs [new file with mode: 0644]
org.glite.lb.client/project/debian.glite-lb-client-progs.install [new file with mode: 0644]
org.glite.lb.client/project/debian.libglite-lb-client-dev.dirs [new file with mode: 0644]
org.glite.lb.client/project/debian.libglite-lb-client-dev.install [new file with mode: 0644]
org.glite.lb.client/project/debian.libglite-lb-client11.dirs [new file with mode: 0644]
org.glite.lb.client/project/debian.libglite-lb-client11.install [new file with mode: 0644]
org.glite.lb.client/project/debian.rules [new file with mode: 0644]
org.glite.lb.client/project/glite-lb-client.spec [new file with mode: 0644]
org.glite.lb.client/project/version.properties
org.glite.lb.client/src/StatusAttrNames.pl
org.glite.lb.client/src/connection.c
org.glite.lb.client/src/consumer.c
org.glite.lb.client/src/notification.c
org.glite.lb.client/src/notify.c
org.glite.lb.client/src/perftest_query.sh
org.glite.lb.client/src/prod_proto.c

index b4d4a3c..0d371e7 100644 (file)
@@ -5,7 +5,6 @@ globalprefix=glite
 lbprefix=lb
 package=glite-lb-client
 version=0.0.0
-
 CC:=gcc
 CXX:=g++
 
@@ -21,6 +20,12 @@ version=${module.version}
 
 VERSION_AHEAD=-3
 
+# hacks needed for ETICS:
+# - rpath out of installation directory ${PREFIX}
+#   (the proper value is ${prefix}/${libdir})
+# - installed *.la files should be removed
+rpath?=${PREFIX}${prefix}/${libdir}
+
 VPATH=${top_srcdir}/src:${top_srcdir}/interface:${top_srcdir}/test:${top_srcdir}/examples:${top_srcdir}/doc
 AT3=${stagedir}${prefix}/sbin/glite-lb-at3
 GENSAM=${top_srcdir}/examples/gen_sample_job
@@ -41,6 +46,7 @@ l_SRC = \
        running.l \
        running_dag.l \
        running_subjob.l \
+       reallyrunning.l \
        scheduled.l \
        scheduled_dag.l \
        scheduled_subjob.l \
@@ -92,13 +98,13 @@ COMMON_LIB_THR:=-lglite_lb_common_${thrflavour}
 COMMON_LIB:=-lglite_lb_common
 TRIO_LIB:=-lglite_lbu_trio
 
-CFLAGS:=${CFLAGS} ${DEBUG} \
+CFLAGS:=${DEBUG} \
        -I. \
        -I${top_srcdir}/src -I${top_srcdir}/interface \
        -I${stagedir}${prefix}/include \
        ${COVERAGE_FLAGS} \
        -DBUILDING_LB_CLIENT \
-       -D_GNU_SOURCE ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS}
+       -D_GNU_SOURCE ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS} ${CFLAGS}
 
 CXXFLAGS:=${CFLAGS}
 
@@ -107,7 +113,7 @@ EXT_LIB:=
 CPPUNIT_LIBS?=-L${cppunit_prefix}/${libdir} -lcppunit
 CPPUNIT_CFLAGS?=-I${cppunit_prefix}/include
 
-LDFLAGS:=${LDFLAGS} -L${stagedir}${prefix}/${libdir} ${COVERAGE_FLAGS}
+LDFLAGS:=${LDFLAGS} -L${stagedir}${prefix}/${libdir} -L${PREFIX}${prefix}/${libdir} ${COVERAGE_FLAGS}
 
 COMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
 CXXCOMPILE:=libtool --mode=compile ${CXX} ${CXXFLAGS}
@@ -206,28 +212,28 @@ default: all
 
 ifeq (${thrflavour},)
 ${LIB}: ${LIBTHROBJS}
-       ${LINK} ${version_info} -o $@ ${LIBTHRLOBJS} -rpath ${prefix}/${libdir} \
+       ${LINK} ${version_info} -o $@ ${LIBTHRLOBJS} -rpath ${rpath} \
                        ${COMMON_LIB} ${TRIO_LIB} \
                        -lglite_security_gss
 
 ${PLUSLIB}: ${PLUSTHROBJS} ${LIB}
-       ${LINKXX} ${version_info} -o $@ ${PLUSTHRLOBJS} -rpath ${prefix}/${libdir} ${LIB} ${PLUS_EXTRA_LIB}
+       ${LINKXX} ${version_info} -o $@ ${PLUSTHRLOBJS} -rpath ${rpath} ${LIB} ${PLUS_EXTRA_LIB}
 else
 ${NOTHRLIB}: ${LIBOBJS}
-       ${LINK} ${version_info} -o $@ ${LIBLOBJS} -rpath ${prefix}/${libdir} \
+       ${LINK} ${version_info} -o $@ ${LIBLOBJS} -rpath ${rpath} \
                        ${COMMON_LIB_NOTHR} ${TRIO_LIB} \
                        -lglite_security_gss_${nothrflavour}
 
 ${THRLIB}: ${LIBTHROBJS}
-       ${LINK} ${version_info} -o $@ ${LIBTHRLOBJS} -rpath ${prefix}/${libdir} \
+       ${LINK} ${version_info} -o $@ ${LIBTHRLOBJS} -rpath ${rpath} \
                        ${COMMON_LIB_THR} ${TRIO_LIB} \
                        -lglite_security_gss_${thrflavour}
 
 ${NOTHRPLUSLIB}: ${PLUSOBJS} ${NOTHRLIB}
-       ${LINKXX} ${version_info} -o $@ ${PLUSLOBJS} -rpath ${prefix}/${libdir} ${NOTHRLIB} ${PLUS_EXTRA_LIB}
+       ${LINKXX} ${version_info} -o $@ ${PLUSLOBJS} -rpath ${rpath} ${NOTHRLIB} ${PLUS_EXTRA_LIB}
 
 ${THRPLUSLIB}: ${PLUSTHROBJS} ${THRLIB}
-       ${LINKXX} ${version_info} -o $@ ${PLUSTHRLOBJS} -rpath ${prefix}/${libdir} ${THRLIB} ${PLUS_EXTRA_LIB}
+       ${LINKXX} ${version_info} -o $@ ${PLUSTHRLOBJS} -rpath ${rpath} ${THRLIB} ${PLUS_EXTRA_LIB}
 endif
 
 logevent: logevent.o args.o
@@ -239,14 +245,11 @@ notify: notify.o
 register_sandbox: %: %.o
        ${LINK} -o $@ $@.o ${default_clientlib} ${EXT_LIB}
 
-${TOOLS} ${EXAMPLES}: %: %.o
-       ${LINK} -o $@ $< ${default_clientlib} ${EXT_LIB} 
-
-${EXAMPLES_CL}: %: %.o
+${TOOLS} ${EXAMPLES} ${EXAMPLES_CL}: %: %.o
        ${LINK} -o $@ $< ${default_clientlib} ${default_commonlib} ${EXT_LIB} 
 
 ${EXAMPLES_CL_THR}: %: %.o
-       ${LINK} -o $@ $< ${default_clientlib_thr} ${default_commonlib_thr} ${EXT_LIB} 
+       ${LINK} -o $@ $< ${default_clientlib_thr} ${default_commonlib_thr} ${EXT_LIB} -lpthread
 
 ${TOOLS}: ${default_clientlib}
 
@@ -270,17 +273,17 @@ ${LIBTHROBJS}: %.thr.o: %.c
 ${MAN_GZ}: ${MAN}
        rm -f ${MAN_GZ} ${MAN}
        cp $? .
-       gzip -f $(notdir $?)
+       gzip -9 -f $(notdir $?)
 
 ${MAN8_GZ}: ${MAN8}
        cp $? .
-       gzip -f $(notdir $?)
+       gzip -9 -f $(notdir $?)
 
 perftest_logjobs.o: perftest_logjobs.c
        ${CC} ${CFLAGS} -DLB_PERF_DROP -c $<
 
 # catches $TOOLS and logevent compilation
-%.o: %.c 
+%.lo %.o: %.c
        ${CC} ${CFLAGS} -c $<
 
 %.h: %.h.T
@@ -288,7 +291,7 @@ perftest_logjobs.o: perftest_logjobs.c
        ${AT3} $< >$@ || ( rm -f $@; false )
        chmod -w $@ >/dev/null
 
-%.o: %.cpp
+%.lo %.o: %.cpp
        ${CXX} ${CFLAGS} ${GLOBUSINC} -c $<
 
 %.c: %.c.T
@@ -352,11 +355,11 @@ install:
        mkdir -p ${DESTDIR}${PREFIX}${prefix}/share/man/man8
        mkdir -p ${DESTDIR}${m4dir}
 ifdef LB_STANDALONE
-       ${INSTALL} -m 644 ${c_LIBRARIES} ${DESTDIR}${PREFIX}${prefix}/${libdir}
+       ${INSTALL} -m 755 ${c_LIBRARIES} ${DESTDIR}${PREFIX}${prefix}/${libdir}
 else
-       ${INSTALL} -m 644 ${lib_LTLIBRARIES} ${DESTDIR}${PREFIX}${prefix}/${libdir}
+       ${INSTALL} -m 755 ${lib_LTLIBRARIES} ${DESTDIR}${PREFIX}${prefix}/${libdir}
        if test -n "${staging}"; then \
-               install -m 644 ${plus_LIBRARIES} ${DESTDIR}${PREFIX}${prefix}/${libdir}; \
+               install -m 755 ${plus_LIBRARIES} ${DESTDIR}${PREFIX}${prefix}/${libdir}; \
        fi
 endif
        ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${DESTDIR}${PREFIX}${prefix}/share/doc/${package}-${version}
@@ -394,10 +397,32 @@ clean:
        rm -rvf ${lib_LTLIBRARIES} ${TOOLS} logevent  register_sandbox ${MAN_GZ} ${MAN8_GZ}
        rm -rvf ${EXAMPLES} ${EXAMPLES_CL} ${EXAMPLES_CL_THR} ${sh_PROGS}
        rm -f EventAttrNames.pl StatusAttrNames.pl uiwrap.T
-       rm -rvf log.xml rpmbuild/ RPMS/ tgz/ debian/
+
+distclean:
+       rm -rvf Makefile.inc *.spec debian/
 
 check_version:
        ${CHECK_VERSION} ${stagedir}${prefix}/include/glite/lb/common_version.h
 
+post-install:
+       rm -rfv ${PREFIX}${prefix}/${libdir}/*.la
+
+post-install-rpath:
+       for file in `find ${PREFIX}${prefix}/${libdir} -type f` \
+                   `find ${PREFIX}${prefix}/bin -type f` \
+                   `find ${PREFIX}${prefix}/sbin -type f` \
+       ; do \
+               if test -h $$file; then continue; fi; \
+               orpath=`chrpath -l $$file 2>/dev/null`; \
+               if test $$? = 0 ; then \
+                       orpath=`echo $$orpath | sed 's:.*RPATH=::'`; \
+                       rpath=`echo $$orpath | sed "s:${PREFIX}${prefix}:${sysroot}${prefix}:g" | tr ':' '\n' | grep -v '^$$' | tr '\n' ':' | sed 's/:$$//'`; \
+                       if test "$$orpath" = "$$rpath"; then continue; fi; \
+                       echo "$$file"; \
+                       echo " -> $$rpath"; \
+                       chrpath -r $$rpath $$file; \
+                       chrpath -d $$file; \
+               fi; \
+       done
 
-.PHONY: default all compile examples check stage install clean check_version link
+.PHONY: default all compile examples check stage install clean distclean check_version link post-install post-install-rpath
index aace459..bcb1531 100755 (executable)
@@ -24,6 +24,7 @@
 #
 
 use Getopt::Long;
+use POSIX qw(locale_h strftime);
 
 my $pwd = `pwd`; chomp $pwd;
 my $prefix = '/usr';
@@ -39,7 +40,7 @@ my $nothrflavour = 'gcc64dbg';
 my $mode = 'build';
 my $help = 0;
 my $listmodules;
-my $version;
+my ($version, $force_version);
 my $branch;
 my $output;
 my $lb_tag = '';
@@ -47,17 +48,26 @@ my $lbjp_tag = '';
 my $jp_tag = '';
 my $jobid_tag = '';
 my $libdir = getlibdir();
-my $project = 'glite';
+my $project = 'emi';
+my $project_version;
 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 utils client-java doc ws-test db jpprimary jpindex jpclient harvester lb px proxyrenewal/;
-my @default_nodes = qw/lb px proxyrenewal/;
+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 nagios/;
 my %enable_nodes;
 my %disable_nodes;
 my %default_nodes; @default_nodes{@default_nodes} = (1) x ($#default_nodes + 1);
 
+my %package = (
+       'maintainer' => 'CESNET Product Teams <emi-lb@metacentrum.cz>',
+       'uploaders' => 'František Dvořák <valtri@civ.zcu.cz>',
+       'url' => 'http://glite.cern.ch',
+       'debian_vcs' => 'Vcs-Cvs: :pserver:anonymous@jra1mw.cvs.cern.ch:/cvs/jra1mw
+Vcs-Browser: http://jra1mw.cvs.cern.ch/cgi-bin/jra1mw.cgi',
+);
+
 # key:      internal package name (arguments, ...)
 # 'pkg':    pkg-config name
 # 'prefix': used when pkg-config fails
@@ -89,9 +99,6 @@ my %externs = (
        'myproxy-server' => {
                prefix=> '',
        },
-       'myproxy-libs' => {
-               prefix=> '',
-       },
        'myproxy-admin' => {
                prefix=> '',
        },
@@ -136,7 +143,8 @@ my %externs = (
                prefix=> '/usr'
        },
        jdk => {
-               prefix=> '/usr/java/latest'
+               prefix=> '/usr/java/latest',
+               locations => [ '/usr/lib/jvm/java', '/usr/lib/jvm/default-java', '/usr/java/latest' ],
        },
        libtar => {
                prefix=> '/usr'
@@ -154,14 +162,6 @@ my %externs = (
                prefix=>'/opt/activemq-cpp-library',
                pkg => 'activemq-cpp'
        },
-       apr => {
-               prefix=>'/opt/apr',
-               pkg => 'apr-1'
-       },
-       aprutil => {
-               prefix=>'/opt/apr-util',
-               pkg => 'apr-util-1'
-       },
 );
 
 my %jar = (
@@ -187,14 +187,40 @@ my (%etics_externs, %etics_projects);
 # 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/], 
-       'lbjp-common' => [qw/db log maildir server-bones trio jp-interface gss gsoap-plugin/],
-       'jobid' => [qw/api-c api-cpp api-java/],
+       'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test harvester yaim logger-msg nagios client-devel client-progs common-devel logger-devel state-machine-devel/], 
+       'lbjp-common' => [qw/db log maildir server-bones trio jp-interface gss gsoap-plugin db-devel log-devel maildir-devel server-bones-devel trio-devel jp-interface-devel gss-devel gsoap-plugin-devel/],
+       'jobid' => [qw/api-c api-c-devel api-cpp api-cpp-devel 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/ ],
+       'gridsite' => [ qw/apache libs commands core devel slashgrid services service-clients gsexec/ ],
+       'px' => [ qw/proxyrenewal myproxy-yaim proxyrenewal-devel proxyrenewal-progs/ ],
+       'canl' => [ qw/c c-devel/ ],
        );
 
+#
+# sub-packages
+#
+# modify %lbmodules, %deps_aux, %extrafull, and %properties accodingly
+#
+my %subpackages = (
+       'jobid.api-c-devel' => 'jobid.api-c',
+       'jobid.api-cpp-devel' => 'jobid.api-cpp',
+       'lbjp-common.db-devel' => 'lbjp-common.db',
+       'lbjp-common.gsoap-plugin-devel' => 'lbjp-common.gsoap-plugin',
+       'lbjp-common.gss-devel' => 'lbjp-common.gss',
+       'lbjp-common.jp-interface-devel' => 'lbjp-common.jp-interface',
+       'lbjp-common.log-devel' => 'lbjp-common.log',
+       'lbjp-common.maildir-devel' => 'lbjp-common.maildir',
+       'lbjp-common.server-bones-devel' => 'lbjp-common.server-bones',
+       'lbjp-common.trio-devel' => 'lbjp-common.trio',
+       'lb.client-progs' => 'lb.client',
+       'lb.client-devel' => 'lb.client',
+       'lb.common-devel' => 'lb.common',
+       'lb.logger-devel' => 'lb.logger',
+       'lb.state-machine-devel' => 'lb.state-machine',
+       'px.proxyrenewal-devel' => 'px.proxyrenewal',
+       'px.proxyrenewal-progs' => 'px.proxyrenewal',
+       'canl.c-devel' => 'canl.c',
+);
 
 my @opts = (
        'prefix:s' => \$prefix,
@@ -204,7 +230,7 @@ my @opts = (
        'nothrflavour:s' => \$nothrflavour,
        'mode=s' => \$mode,
        'listmodules=s' => \$listmodules,
-       'version=s' => \$version,
+       'version=s' => \$force_version,
        'branch=s' => \$branch,
        'output=s' => \$output,
        'stage=s' => \$stagedir,
@@ -216,6 +242,7 @@ my @opts = (
        'lbjp-common-tag=s' => \$lbjp_tag,
        'jp-tag=s' => \$jp_tag,
        'jobid-tag=s' => \$jobid_tag,
+       'canl-tag=s' => \$canl_tag,
        'help' => \$help,
        'libdir=s' => \$libdir,
        'project=s' => \$project,
@@ -248,10 +275,23 @@ $externs{'mysql-server'}{prefix}=$externs{mysql}{prefix} if $externs{'mysql-serv
 $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 '';
+
+if ($project =~ /^([^0-9]*)(.*)$/) {
+       $project = $1;
+       $project_version = $2;
+}
 %project = %{$projects{$project}};
-for $_ (keys %{$project{etics_externs}}) {
-       $etics_externs{$_} = $project{etics_externs}{$_};
+$project_version = $project{current_version} unless $project_version;
+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}{$_};
 }
@@ -267,6 +307,10 @@ for my $ext (keys %need_externs_aux) {
                $need_externs_type{$ext}->{$pkg} = $type;
        }
 }
+if ($project eq 'emi') {
+       $extranodmod{lb} = 'lb.emi-lb';
+       $extranodmod{px} = 'px.emi-px';
+}
 for $_ (keys %{$project{modules}}) {
        push @{$lbmodules{$_}},@{$project{modules}{$_}};
 }
@@ -276,13 +320,26 @@ 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";
+       my @m;
+
+       if (exists $lbmodules{$listmodules}) {
+               @m = map exists $subpackages{$listmodules . '.' . $_} ? "" : "$name_prefix.$listmodules.$_",@{$lbmodules{$listmodules}};
+       } else {
+               if ($project eq 'emi' and $project_version == 1) {
+                       # no sub-packages in EMI-1
+               } else {
+                       for my $sub (keys %subpackages) {
+                               push @m, $sub if ($subpackages{$sub} eq $listmodules);
+                       }
+               }
+       }
+       print map $_ eq "" ? "" : "$_ ", @m;
+       print "\n";
        exit 0;
 }
 
-warn "$0: --version, --branch and --output make sense only in --mode=etics\n"
-       if ($version || $output || $branch) && $mode ne 'etics';
+warn "$0: --branch and --output make sense only in --mode=etics\n"
+       if ($output || $branch) && $mode ne 'etics';
 
 my $en;
 for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; }
@@ -350,7 +407,14 @@ if ($mode eq 'build') { for my $ext (keys %externs) {
                        $jdk_prefix = $ENV{'JAVA_HOME'};
                        print "JAVA_HOME=$jdk_prefix\n";
                } else {
-                       print "(using default $externs{$ext}{prefix}))\n"
+                       foreach my $i (0..$#{$externs{$ext}{locations}}) {
+                               if (-e $externs{$ext}{locations}[$i]) {
+                                       $jdk_prefix=$externs{$ext}{locations}[$i];
+                                       print "(found directory $jdk_prefix)\n";
+                                       last;
+                               }
+                       }
+                       print "(using default $externs{$ext}{prefix})\n" unless ($jdk_prefix);
                }
                $externs{$ext}{prefix} = $jdk_prefix if ($jdk_prefix);
        }
@@ -413,7 +477,7 @@ sub mode_build {
        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) {
@@ -472,7 +536,7 @@ sub mode_checkout() {
                                }
                        }       
                }
-               if ($lbjp_tag){
+               if ($lbjp_tag) {
                        for (@{$lbmodules{'lbjp-common'}}){
                                if ("lbjp-common.".$_ eq $module){
                                         $tag = '-r '.$lbjp_tag;
@@ -493,6 +557,13 @@ sub mode_checkout() {
                                 }
                        }
                }
+               if ($canl_tag) {
+                       for (@{$lbmodules{'canl'}}){
+                               if ("canl.".$_ eq $module){
+                                        $tag = '-r '.$canl_tag;
+                                }
+                       }
+               }
                #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){
                #       print "found";
                #}
@@ -504,37 +575,36 @@ sub mode_checkout() {
 
 BEGIN{
 %etics_externs = (
-       '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',
-       apr=>'apr-dev',
-       aprutil=>'aprutil-dev',
+       default => {
+               'myproxy-devel'=>'myproxy-devel',
+               'myproxy-server'=>'myproxy-server',
+               'myproxy-admin'=>'myproxy-admin',
+               cares=>'c-ares',
+               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.client' => [ qw/cppunit:B classads libtool:B globus:B/ ],
+       'lb.common' => [ qw/expat cares:B cppunit:B classads libtool:B globus:B/ ],
        'lb.doc' => [ qw/tetex-latex:B/ ],
-       'lb.logger' => [ qw/cppunit:B libtool:B/ ],
-       'lb.logger-msg' => [ qw/cppunit:B activemq libtool:B/ ],
-       '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.logger' => [ qw/cppunit:B libtool:B globus:B/ ],
+       'lb.logger-msg' => [ qw/cppunit:B activemq libtool:B globus:B/ ],
+       'lb.nagios' => [ qw/globus_proxy_utils:R/ ],
+       'lb.server' => [ qw/globus_essentials:R globus:B expat cares mysql-server:R cppunit:B gsoap:B classads voms:B lcas gridsite:B bison:B libtool:B libxml2 flex:B/ ],
+       'lb.state-machine' => [ qw/classads libtool:B libxslt:B expat:B globus:B/ ],
+       'lb.utils' => [ qw/cppunit:B libtool:B globus:B/ ],
+       'lb.ws-interface' => [ qw/libxslt:B tidy:B/ ],
+       'lb.ws-test' => [ qw/gsoap:B libtool:B globus: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/ ],
+       'lb.harvester' => [ qw/docbook-utils:B libtool:B globus:B/ ],
+       'lbjp-common.db' => [ qw/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/ ],
@@ -547,21 +617,23 @@ BEGIN{
        '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.index' => [ qw/gsoap globus_essentials:R globus:B mysql-server:R/ ],
+        'jp.primary' => [ qw/classads gsoap libtar globus_essentials:R globus:B  mysql-server:R/ ],
         '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.core' => [ qw/httpd-devel:B gsoap:B globus:B curl:B doxygen:B fuse-devel:B libxml2:B openssl: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.libs' => [ qw/libxml2:R openssl:R/ ],
        'gridsite.devel' => [ qw// ],
-       'gridsite.slashgrid' => [ qw/curl:R fuse-libs:R fuse:R/],
+       'gridsite.slashgrid' => [ qw/curl: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:R/ ],
+       'gridsite.1.5-compat' => [ qw/httpd-devel:B gsoap:B globus:B curl:B doxygen:B fuse-devel:B libxml2:B openssl:B doxygen:B/ ],
+       'px.proxyrenewal' => [ qw/globus:B globus_essentials:R myproxy-devel:B voms:B libtool:B/ ],
        'px.myproxy-config' => [ qw/myproxy-admin:R/ ], # in myproxy-config.spec
+       'canl.c' => [ qw/cares:B openssl:B libtool:B bison:B flex:B krb5-devel:B/ ],
 );
 
 %need_jars = (
@@ -600,10 +672,15 @@ for my $jar (keys %need_jars) {
                lbjp-common.gss
        / ],
        'lb.logger-msg' => [ qw/
-               lb.logger
+               lb.logger:B
+       / ],
+       'lb.nagios' => [ qw/
+               lb.client:R
+               lb.ws-test:R
+               lb.utils:R
        / ],
        'lb.server' => [ qw/
-               lb.ws-interface lb.types:B lb.common lb.state-machine
+               lb.ws-interface lb.types:B lb.common lb.state-machine lb.utils:R
                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
@@ -644,7 +721,7 @@ for my $jar (keys %need_jars) {
        'jobid.api-cpp' =>  [ qw/jobid.api-c/ ],
        'jobid.api-java' =>  [ qw// ],
 
-       'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ],
+       'lbjp-common.jp-interface' => [ qw/lbjp-common.trio lbjp-common.db jobid.api-c/ ],
 
        'jp.client' => [ qw/
                 jp.ws-interface
@@ -671,13 +748,13 @@ for my $jar (keys %need_jars) {
        '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.commands' => [ qw/gridsite.core:B/ ],
+       'gridsite.apache' => [ qw/gridsite.core:B/ ],
+       'gridsite.libs' => [ qw/gridsite.core:B / ],
+       'gridsite.devel' => [ qw/gridsite.core:B/ ],
+       'gridsite.slashgrid' => [ qw/gridsite.core:B/],
+       'gridsite.services' => [ qw/gridsite.core:B/ ],
+       'gridsite.service-clients' => [ qw/gridsite.core:B/ ],
        'gridsite.gsexec' => [ qw/gridsite.core:B/ ],
 
        'px.proxyrenewal' => [ qw// ],
@@ -685,6 +762,28 @@ for my $jar (keys %need_jars) {
        'px.emi-px' => [qw/px.myproxy-yaim:R/],
        'px.myproxy-yaim' => [ qw// ],
        'px.myproxy-config' => [],
+
+       'canl.c' => [],
+
+       # sub-packages (virtual ETICS components depending on the main)
+       'jobid.api-c-devel' => [ qw/jobid.api-c:B/ ],
+       'jobid.api-cpp-devel' => [ qw/jobid.api-cpp:B/ ],
+       'lbjp-common.db-devel' => [ qw/lbjp-common.db:B/ ],
+       'lbjp-common.gsoap-plugin-devel' => [ qw/lbjp-common.gsoap-plugin:B/ ],
+       'lbjp-common.gss-devel' => [ qw/lbjp-common.gss:B/ ],
+       'lbjp-common.jp-interface-devel' => [ qw/lbjp-common.jp-interface:B/ ],
+       'lbjp-common.log-devel' => [ qw/lbjp-common.log:B/ ],
+       'lbjp-common.maildir-devel' => [ qw/lbjp-common.maildir:B/ ],
+       'lbjp-common.server-bones-devel' => [ qw/lbjp-common.server-bones:B/ ],
+       'lbjp-common.trio-devel' => [ qw/lbjp-common.trio:B/ ],
+       'lb.client-progs' => [ qw/lb.client:B/ ],
+       'lb.client-devel' => [ qw/lb.client:B/ ],
+       'lb.common-devel' => [ qw/lb.common:B/ ],
+       'lb.logger-devel' => [ qw/lb.logger:B/ ],
+       'lb.state-machine-devel' => [ qw/lb.state-machine:B/ ],
+       'px.proxyrenewal-devel' => [ qw/px.proxyrenewal:B/ ],
+       'px.proxyrenewal-progs' => [ qw/px.proxyrenewal:B/ ],
+       'canl.c-devel' => [ qw/canl.c:B/ ],
 );
 
 for my $ext (keys %deps_aux) {
@@ -697,7 +796,28 @@ for my $ext (keys %deps_aux) {
 }
 
 
-%extrafull = ( gridsite=>'org.gridsite.core');
+%extrafull = (
+       gridsite=>'org.gridsite.core',
+       'canl.c' => 'emi.canl.canl-c',
+       'canl.c-devel' => 'emi.canl.canl-c',
+       'jobid.api-c-devel' => 'org.glite.jobid.api-c',
+       'jobid.api-cpp-devel' => 'org.glite.jobid.api-cpp',
+       'lbjp-common.db-devel' => 'org.glite.lbjp-common.db',
+       'lbjp-common.gsoap-plugin-devel' => 'org.glite.lbjp-common.gsoap-plugin',
+       'lbjp-common.gss-devel' => 'org.glite.lbjp-common.gss',
+       'lbjp-common.jp-interface-devel' => 'org.glite.lbjp-common.jp-interface',
+       'lbjp-common.log-devel' => 'org.glite.lbjp-common.log',
+       'lbjp-common.maildir-devel' => 'org.glite.lbjp-common.maildir',
+       'lbjp-common.server-bones-devel' => 'org.glite.lbjp-common.server-bones',
+       'lbjp-common.trio-devel' => 'org.glite.lbjp-common.trio',
+       'lb.client-devel' => 'org.glite.lb.client',
+       'lb.client-progs' => 'org.glite.lb.client',
+       'lb.common-devel' => 'org.glite.lb.common',
+       'lb.logger-devel' => 'org.glite.lb.logger',
+       'lb.state-machine-devel' => 'org.glite.lb.state-machine',
+       'px.proxyrenewal-devel' => 'org.glite.px.proxyrenewal',
+       'px.proxyrenewal-progs' => 'org.glite.px.proxyrenewal',
+);
 
 #( java => 'client-java' );
 %extranodmod = (
@@ -707,7 +827,8 @@ for my $ext (keys %deps_aux) {
        jpclient => 'jp.client',
        lb => 'lb.glite-LB',
        px => 'px.glite-PX',
-       proxyrenewal => 'px.proxyrenewal'
+       proxyrenewal => 'px.proxyrenewal',
+       canl => 'canl.c',
 );
 
 %obsoletes = (
@@ -720,10 +841,12 @@ for my $ext (keys %deps_aux) {
 );
 
 %conflicts = (
-       'lb.glite-LB' => [ qq/emi-lb/ ],
-       'px.glite-PX' => [ qq/emi-px/ ],
-       'lb.emi-lb' => [ qq/glite-LB/ ],
-       'px.emi-px' => [ qq/glite-PX/ ],
+);
+
+%provides = (
+       'lbjp-common.gss' => [ qq/glite-security-gss/ ],
+       'lbjp-common.gsoap-plugin' => [ qq/glite-security-gsoap-plugin/ ],
+       'lb.nagios' => [ qq/glite-lb-nagios-plugins/ ],
 );
 
 %cvs_prefix = (
@@ -733,6 +856,7 @@ for my $ext (keys %deps_aux) {
        'lbjp-common' => 'org.glite',
        'gridsite' => 'org',
        'px' => 'org.glite',
+       'canl' => 'emi',
 );
 
 %cvs_tag_prefix = (
@@ -742,6 +866,7 @@ for my $ext (keys %deps_aux) {
        'lbjp-common' => 'glite-',
        'gridsite' => '',
        'px' => 'glite-',
+       'canl' => 'emi-',
 );
 
 # ==== projects specification ====
@@ -753,135 +878,199 @@ for my $ext (keys %deps_aux) {
 #                        (${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 => {
+               current_version => 3,
                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 => {
-                       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',
+                       default => {
+                               globus_essentials=>'vdt_globus_essentials',
+                               globus=>'globus',
+                               globus_proxy_utils=>'vdt_globus_essentials',
+                               gridsite=>'org.gridsite.libs',
+                               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=>'-',
+                               jdk=>'jdk',
+                               voms=>'org.glite.security.voms-api-cpp',
+                       },
                },
                etics_externs_devel => {
-                       gridsite=>'org.gridsite.devel',
+                       default => {
+                               gridsite=>'org.gridsite.devel',
+                               voms=>'org.glite.security.voms-api',
+                       },
                },
                etics_projects => {
-                       vdt=>[qw/globus globus_essentials gpt/],
+                       vdt=>[qw/globus globus_essentials globus_proxy_utils 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/ ],
+                       'lb.yaim' => [ qw/yaim_core: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 => {
+               current_version => 2,
                etics_name => 'emi',
                conf_prefix => {
                        'lb' => 'emi-',
                        'jp' => 'emi-',
                        'jobid' => 'emi-',
                        'lbjp-common' => 'emi-',
-                       'gridsite' => '',
+                       'gridsite' => 'emi-',
                        'px' => 'emi-',
+                       'canl' => 'emi-',
                },
                tag_prefix => { %cvs_tag_prefix },
                flavours => '--thrflavour= --nothrflavour=',
                local_prefix => '/usr',
                etics_externs => {
-                       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_release=>'emi.bdii.glite-info-provider-release',
-                       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',
+                       default => {
+                               globus_essentials=>'globus-gssapi-gsi',
+                               globus=>'globus-gssapi-gsi-devel',
+                               globus_proxy_utils=>'globus-proxy-utils',
+                               gridsite=>'emi.gridsite.libs',
+                               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.emi-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=>'-',
+                               jdk=>'java',
+                               voms => 'emi.voms.voms-api',
+                       },
+                       sl5_x86_64_gcc412EPEL => {
+                               'myproxy-devel' => 'myproxy-devel.x86_64',
+                       },
+                       sl6_x86_64_gcc446EPEL => {
+                               'myproxy-devel' => 'myproxy-devel.x86_64',
+                       },
+                       deb6_x86_64_gcc445 => {
+                               axis => 'axis1.4',
+                               # mappings in ETICS project configuration
+                               #globus_essentials => 'libglobus-gssapi-gsi4',
+                               #globus => 'libglobus-gssapi-gsi-dev',
+                               #axis => 'libaxis-java',
+                               #cares => 'libc-ares2',
+                               #cppunit => 'libcppunit',
+                               #expat => 'libexpat1',
+                               #log4c => 'liblog4c3',
+                               #curl => 'libcurl3',
+                               #'mysql' => 'libmysqlclient16',
+                               #'mysql-devel' => 'libmysqlclient-dev',
+                               #libxslt => 'xsltproc',
+                               #'jakarta-commons-codec' => 'libcommons-codec-java',
+                               #'jakarta-commons-lang' => 'libcommons-lang-java',
+                               #'tetex-latex' => 'texlive-latex-extra',
+                               #'perl-LDAP' => 'libnet-ldap-perl',
+                               #'fuse-lib' => 'libfuse2',
+                               #'fuse' => 'fuse-utils',
+                       },
                },
                etics_externs_devel => {
-                       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',
+                       default => {
+                               cares => 'c-ares-devel',
+                               classads => 'classads-devel',
+                               cppunit => 'cppunit-devel',
+                               expat => 'expat-devel',
+                               gsoap => 'gsoap-devel',
+                               voms => 'emi.voms.voms-api-devel',
+                               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 => {
+                               # mappings in ETICS project configuration
+                               #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',
+                               #'httpd-devel' => 'apache2-prefork-dev',
+                               #'fuse-devel' => 'libfuse-dev',
+                               #gsoap => 'gsoap',
+                               #'krb5-devel' => 'libkrb5-dev',
+                       },
                },
                etics_projects => {
-                       'emi'=>[qw/voms voms-devel gridsite lcas gip_release gip_service bdii glite_version glue_schema yaim_core yaim_bdii trustmanager trustmanager_axis/],
+                       '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_release: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/],
+                       'lb.emi-lb' => [ qw/fetchcrl:R gip_service:R bdii:R glite_version:R glue_schema:R/ ],
+                       'lb.yaim' => [ qw/yaim_core:R yaim_bdii:R/ ],
+                       'px.emi-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_gcc446EPEL => 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' },
-               default => { 
-               }
-       },
        'jobid.api-java' => {
                default => { 'package.buildarch' => 'noarch' },
        },
@@ -897,12 +1086,87 @@ for my $ext (keys %deps_aux) {
        'lb.yaim' => {
                default => { 'package.buildarch' => 'noarch' },
        },
+       'lb.nagios' => {
+               default => { 'package.buildarch' => 'noarch' },
+       },
        'px.yaim' => {
                default => { 'package.buildarch' => 'noarch' },
        },
        'px.myproxy-config' => {
                default => { 'package.buildarch' => 'noarch' },
        },
+       'gridsite.devel' => {
+               default => { 'packageName' => 'gridsite-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libgridsite-dev' },
+       },
+       'canl.c-devel' => {
+               default => { 'packageName' => 'canl-c-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libcanl-dev' },
+       },
+       'jobid.api-c-devel' => {
+               default => { 'packageName' => 'glite-jobid-api-c-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-jobid-dev' },
+       },
+       'jobid.api-cpp-devel' => {
+               default => { 'packageName' => 'glite-jobid-api-cpp-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-jobid-cpp-dev' },
+       },
+       'lbjp-common.db-devel' => {
+               default => { 'packageName' => 'glite-lbjp-common-db-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lbjp-common-db-dev' },
+       },
+       'lbjp-common.gsoap-plugin-devel' => {
+               default => { 'packageName' => 'glite-lbjp-common-gsoap-plugin-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lbjp-common-gsoap-plugin-dev' },
+       },
+       'lbjp-common.gss-devel' => {
+               default => { 'packageName' => 'glite-lbjp-common-gss-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lbjp-common-gss-dev' },
+       },
+       'lbjp-common.jp-interface-devel' => {
+               default => { 'packageName' => 'glite-lbjp-common-jp-interface-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lbjp-common-jp-interface-dev' },
+       },
+       'lbjp-common.log-devel' => {
+               default => { 'packageName' => 'glite-lbjp-common-log-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lbjp-common-log-dev' },
+       },
+       'lbjp-common.maildir-devel' => {
+               default => { 'packageName' => 'glite-lbjp-common-maildir-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lbjp-common-maildir-dev' },
+       },
+       'lbjp-common.server-bones-devel' => {
+               default => { 'packageName' => 'glite-lbjp-common-server-bones-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lbjp-common-server-bones-dev' },
+       },
+       'lbjp-common.trio-devel' => {
+               default => { 'packageName' => 'glite-lbjp-common-trio-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lbjp-common-trio-dev' },
+       },
+       'lb.client-devel' => {
+               default => { 'packageName' => 'glite-lb-client-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lb-client-dev' },
+       },
+       'lb.common-devel' => {
+               default => { 'packageName' => 'glite-lb-common-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lb-common-dev' },
+       },
+       'lb.state-machine-devel' => {
+               default => { 'packageName' => 'glite-lb-state-machine-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lb-state-machine-dev' },
+       },
+       'lb.logger-devel' => {
+               default => { 'packageName' => 'glite-lb-logger-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-lb-logger-dev' },
+       },
+       'px.proxyrenewal-devel' => {
+               default => { 'packageName' => 'glite-px-proxyrenewal-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libglite-security-proxyrenewal-dev' },
+       },
+       'canl.c-devel' => {
+               default => { 'packageName' => 'canl-c-devel' },
+               deb6_x86_64_gcc445 => { 'packageName' => 'libcanl-c-dev' },
+       },
 );
 
 my @k = keys %deps_aux;
@@ -913,8 +1177,76 @@ $buildroot{'gridsite.core'} = 'src';
 
 sub full
 {
-       my $short = shift;
-       return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short;
+       my ($short) = @_;
+       my $subsys = $short;
+       $subsys =~ s/\..*//;
+
+       my $cvs_prefix = exists $cvs_prefix{$subsys} ? $cvs_prefix{$subsys} : 'org.glite';
+       return $extrafull{$short} ? $extrafull{$short} : "$cvs_prefix.$short";
+}
+
+sub get_version
+{
+       my ($fmod, $top_srcdir) = @_;
+
+       my ($subsys,$mod) = split /\./,$fmod,2;
+       my ($major,$minor,$rev,$age);
+       my $old_;
+
+       if ($force_version) {
+               $force_version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/;
+               ($major,$minor,$rev,$age) = ($1,$2,$3,$4);
+       }
+       else {
+               my $path = "$top_srcdir/project";
+               if ($subsys eq 'gridsite') {
+                       $path = "$cvs_prefix{$subsys}.$subsys.core/project";
+               }
+               open V,"$path/version.properties"
+                       or die "$path/version.properties: $!\n";
+
+               $old_ = $_;
+               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;
+               $_ = $old_;
+       }
+       $version = "$major.$minor.$rev-$age";
+
+       return ($major, $minor, $rev, $age);
+}
+
+sub get_description
+{
+       my ($top_srcdir) = @_;
+
+       my $cvs_module = $top_srcdir;
+       my $package_description = "";
+       my $package_summary = "";
+
+       if (-e "$cvs_module/project/package.description") {
+               open V, "$cvs_module/project/package.description";
+               $package_description = join ("", <V>);
+               close V;
+               chomp $package_description;
+       }
+       else {
+               print STDERR "package.description not found for $subsys.$module!\n"; }
+
+       if (-e "$cvs_module/project/package.summary") {
+               open V, "$cvs_module/project/package.summary";
+               $package_summary = join ("", <V>);
+               close V;
+               chomp $package_summary;
+               $package_summary =~ s/\n/\\n/g;
+       }
+       else {
+               print STDERR "package.summary not found for $subsys.$module!\n"; }
+
+       return ($package_summary, $package_description);
 }
 
 sub mkinc
@@ -922,17 +1254,20 @@ 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.types lb.common lb.server lb.utils lb.ws-test lb.client-java lb.harvester lb.yaim lb.glite-LB
+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 lb.emi-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
+px.proxyrenewal px.myproxy-yaim px.glite-PX px.myproxy-config px.emi-px
+canl.c
 /;
        @aux{@m} = (1) x ($#m+1);
 
-       my $short = shift;
+       my ($short) = @_;
        my $full = full $short;
+       my ($subsys,$mod) = split /\./,$short,2;
+       my $packageName = "$project{tag_prefix}{$subsys}$subsys-${mod}";
 
        unless ($aux{$short}) {
                print "Makefile.inc not needed in $full\n";
@@ -940,14 +1275,17 @@ px.proxyrenewal px.myproxy-yaim px.glite-PX px.myproxy-config
        }
 
        my $top_srcdir = '.';
+       my $abs_srcdir = '';
        my $build = '';
 
        if ($module) {
                $top_srcdir = $0;
                $top_srcdir =~ s,/?[^/]*$,,;
+               $abs_srcdir = $top_srcdir;
                $top_srcdir =~ s,^$,\.,;
        } else {
                $build = "$full/";
+               $abs_srcdir = "$full/";
                unless ($buildroot{$_} eq '') {
                        $top_srcdir = '..';
                        $build .= "$buildroot{$_}/";
@@ -956,17 +1294,32 @@ px.proxyrenewal px.myproxy-yaim px.glite-PX px.myproxy-config
                        }
                }
        }
+
+       my ($major, $minor, $rev, $age) = get_version $short, $abs_srcdir;
+       my ($package_summary, $package_description) = get_description $abs_srcdir;
+       if ($package_description) { $package_description =~ s/(.{1,78}\S|\S+)\s+/$1\n/mg; }
+       my $package_description_debian = $package_description;
+       $package_description_debian =~ s/^/ /mg;
+
+       my ($old_locale, $specdate, $debdate);
+
+       # files for ETICS always in root source directory
+       mkdir $abs_srcdir."project" unless (-d $abs_srcdir."project");
+       open PKGCHL,">".$abs_srcdir."project/changelog"
+               or die $abs_srcdir."project/changelog: $!\n";
+       $old_locale = setlocale(LC_TIME);
+       setlocale(LC_TIME, "C");
+       $specdate = strftime("%a %b %d %Y", gmtime());
+       $debdate = strftime("%a, %d %b %Y %H:%M:%S %z", gmtime());
+       setlocale(LC_TIME, $old_locale);
+       print PKGCHL qq{* $specdate CESNET team <emi-lb\@metacentrum.cz>
+- automatically generated package
+};
+       close PKGCHL;
+
        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"
@@ -1003,67 +1356,188 @@ top_srcdir = $top_srcdir
        print MKINC "gsoap_default_version=".gsoap_version()."\n"  if $need_gsoap;
 
        close MKINC;
+
+       my $dh;
+       my $debian = 0;
+
+       opendir $dh, "$abs_srcdir/project" || die "Can't open $abs_srcdir/project: $!";
+       for my $dir (readdir $dh) {
+               if ($dir=~/^(.*)\.spec$/) {
+                       if ($1 ne $packageName) {
+                               printf STDERR "Changed RPM name: $packageName --> $1\n" if ($debug);;
+                               $packageName=$1;
+                       }
+                       last;
+               }
+       }
+       closedir $dh;
+
+       for my $file ("$packageName.spec", "debian.rules", "debian.control", "debian.changelog", "debian.copyright") {
+               if (-f "$abs_srcdir/project/$file") {
+                       my $old_ = $_;
+                       printf STDERR "Creating $build$file\n" if ($debug);;
+                       open DST, ">$build$file";
+                       open SRC, "<$abs_srcdir/project/$file";
+                       while (<SRC>) {
+                               if (/\@MODULE\@/) { s/\@MODULE\@/$full/g; }
+                               if (/\@URL\@/) { s/\@URL\@/$package{url}/g; }
+                               if (/\@SUMMARY\@/) { s/\@SUMMARY\@/$package_summary/g; }
+                               if (/\@DESCRIPTION\@/) { s/\@DESCRIPTION\@/$package_description/g; }
+                               if (/\@DEBIAN_DESCRIPTION\@/) { s/\@DEBIAN_DESCRIPTION\@/$package_description_debian/g; }
+                               if (/\@VERSION\@/) { s/\@VERSION\@/$version/g; }
+                               if (/\@MAJOR\@/) { s/\@MAJOR\@/$major/g; }
+                               if (/\@MINOR\@/) { s/\@MINOR\@/$minor/g; }
+                               if (/\@REVISION\@/) { s/\@REVISION\@/$rev/g; }
+                               if (/\@AGE\@/) { s/\@AGE\@/$age/g; }
+                               if (/\@MAINTAINER\@/) { s/\@MAINTAINER\@/$package{maintainer}/g; }
+                               if (/\@UPLOADERS\@/) { s/\@UPLOADERS\@/$package{uploaders}/g; }
+                               if (/\@DEBIAN_VCS\@/) { s/\@DEBIAN_VCS\@/$package{debian_vcs}/g; }
+                               if (/\@DEBIAN_DATE\@/) { s/\@DEBIAN_DATE\@/$debdate/g; }
+                               if (/\@SPEC_DATE\@/) { s/\@SPEC_DATE\@/$specdate/g; }
+                               if (/^\s*.+\/configure\s/ and $force_version) {
+                                       print "Version forced to $version\n" if ($debug);;
+                                       s/--version\s+\S+\s?//;
+                                       s/$/ --version $version/;
+                               }
+                               printf DST "%s", "$_";
+                       }
+                       close SRC;
+                       close DST;
+                       $_ = $old_;
+               }
+       }
+
+       print "Creating ${build}debian/\n" if ($debug);;
+
+       `rm -rfv  ${build}debian`;
+       mkdir $build."debian" or die $!;
+       `cp $abs_srcdir/project/debian.* ${build}debian/ 2>/dev/null`;
+       `mv ${build}debian.* ${build}debian/ 2>/dev/null`;
+       `rm -f ${build}debian/*.orig`;
+       opendir $dh, "${build}debian" || die "Can't open ${build}debian: $!";
+       for $_ (readdir $dh) {
+               if (/^debian\.(.*)/) {
+                       `mv ${build}debian/$_ ${build}debian/$1`;
+                       $debian = 1;
+               }
+       }
+       closedir $dh;
+
+       if ($debian) {
+               my ($dir, $file);
+
+               chmod 0755, "${build}debian/rules";
+               $file="${build}debian/docs"; if (not -f $file) { `touch $file`; }
+               $dir="${build}debian/source"; if (not -d $dir) { mkdir $dir; }
+               $file="${build}debian/source/format"; if (not -f $file) { `echo "3.0 (quilt)" > $file` }
+               $file="${build}debian/compat"; if (not -f $file) { `echo "7" > $file` }
+               $file="${build}debian/changelog"; if (not -f $file) {
+                       open FH, ">$file" or die $!;
+                       print FH qq{$packageName ($major.$minor.$rev-$age) unstable; urgency=low
+
+  * Automatically generated package
+
+ -- $package{maintainer}  $debdate
+};
+                       close FH;
+               }
+
+       } else {
+               `rm -rf ${build}debian`;
+       }
 }
 
 BEGIN{
 };
 
+sub mode_etics_packaging {
+       my ($fmod, $cmd, $rpmprepare, $debprepare) = @_;
+       my ($workspaceDir, $srcPackageName, $srcAge, $topDir);
+
+       # old-school packaging by ETICS for EMI-1
+       if ($project eq 'emi' and $project_version == 1) { return; }
+
+       if ($fmod eq 'gridsite.core') {
+               $workspaceDir = '..';
+               $srcPackageName = 'gridsite';
+               $srcAge = '';
+               $topDir = '../';
+       } else {
+               $workspaceDir = '${workspaceDir}';
+               $srcPackageName = '${packageName}';
+               $srcAge = '-${age}';
+               $topDir = '';
+       }
+
+       $cmd->{clean} = 'make clean
+       rm -rfv ${package.tgzLocation} ${package.SRPMSLocation}';
+       $cmd->{default}{packaging} = $rpmprepare;
+       $cmd->{default}{packaging} .= "dir=\${workspaceDir}/rpm_build_src_\$\$
+       mkdir -p \${package.tgzLocation} \${package.SRPMSLocation} \$dir/{BUILD,RPMS,SOURCES,SRPMS} 2>/dev/null || true
+       cp -vf $workspaceDir/$srcPackageName-\${version}${srcAge}.src.tar.gz \${package.tgzLocation}/
+       cp -vf $workspaceDir/$srcPackageName-\${version}${srcAge}.src.tar.gz \$dir/SOURCES/
+       rpmbuild -bs --nodeps --define \"_topdir \$dir\" $srcPackageName.spec
+       cp -v \$dir/SRPMS/*.src.rpm \${package.SRPMSLocation}/
+       rm -rf \$dir";
+
+       for my $p ('deb5_x86_64_gcc432', 'deb5_ia32_gcc432', 'deb6_x86_64_gcc445', 'deb6_ia32_gcc445') {
+               for my $c (keys %{$cmd->{default}}) { $cmd->{$p}{$c} = $cmd->{default}{$c}; }
+               $cmd->{$p}{clean} = 'make clean
+       rm -rfv ${package.tgzLocation} ${package.SDEBSLocation}';
+               $cmd->{$p}{packaging} = $debprepare;
+               $cmd->{$p}{packaging} .= "dir=\${workspaceDir}/dpkg_build_src_\$\$
+       mkdir -p \${package.tgzLocation} \${package.SDEBSLocation} \$dir 2>/dev/null || true
+       cp -vf $workspaceDir/$srcPackageName-\${version}${srcAge}.src.tar.gz \${package.tgzLocation}/
+       cp -vf $workspaceDir/$srcPackageName-\${version}${srcAge}.src.tar.gz \$dir/${srcPackageName}_\${version}.orig.tar.gz
+       tar xzf \$dir/${srcPackageName}_\${version}.orig.tar.gz -C \$dir
+       cp -rf ${topDir}debian/ \$dir/$srcPackageName-\${version}/
+       cd \$dir/$srcPackageName-\${version}
+       dpkg-buildpackage -S -d -nc
+       cd -
+       cp -v \$dir/*.tar.gz \$dir/*.dsc \${package.SDEBSLocation}/
+       rm -rf \$dir";
+       }
+}
+
 sub mode_etics {
        $fmod = shift;
 
        die "$0: --module required with --etics\n" unless $fmod;
        
-       my ($subsys,$module) = split /\./,$fmod;
+       my ($subsys,$module) = split /\./,$fmod,2;
+       my $full = full "$subsys.$module";
 
-       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;
-       }
+       my ($major,$minor,$rev,$age) = get_version $fmod, $full;
 
+       # 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{$_} ? $etics_externs{$_} : $_;
+               my $eext = $etics_externs{default}{$_} ? $etics_externs{default}{$_} : $_;
                next if ($eext eq '-');
-               if ($project ne 'glite') {
+               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}";
                        }
-               } else {
-                       push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}";
                }
            }
        }
 
        for (@{$need_jars{"$subsys.$module"}}) {
-               my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_;
+               my $eext = $etics_externs{default}{$_} ? $etics_externs{default}{$_} : $_;
 
-               push @copts,"--with-$_ \${$eext.location}$jar{$_}" if ($project eq 'glite');
+               push @copts,"--with-$_ \${$eext.location}$jar{$_}" if (defined $project{etics_locations}{'*'} or defined $project{etics_locations}{$_});
        }
 
        my $conf;
        my $conftag;
-       my ($confprefix, $nameprefix);
+       my ($confprefix, $nameprefix, $packageName);
 
        $dwpath = "path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz\n";
 
@@ -1071,18 +1545,32 @@ sub mode_etics {
        $nameprefix = $confprefix;
        $nameprefix =~ s/-$//;
        $nameprefix =~ s/-/\./g;
+       $packageName = "$project{tag_prefix}{$subsys}$subsys-${module}";
 
        if ($branch) {
                $conf = "$confprefix${subsys}-${module}_$branch"; 
                $conftag = $branch;
                # forced low age number
-               $age = $branch eq 'HEAD' ? '0head' : '0dev'; }
+               $age = $branch eq 'HEAD' ? '0head' : '0dev';
+               push @copts, '--version ${version}-${age}';
+       }
        else {
-               $conf = "$confprefix$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; 
-
+               $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}"; }
+                       "$project{tag_prefix}{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}_${age}";
+
+               # lowering age for older packaging
+               if ($project eq 'emi' and $project_version == 1) {
+                       $age = $age - 1;
+               }
+       }
+
+       # emi1 suffix for older packaging
+       if ($project eq 'emi' and $project_version == 1) {
+               $age = $age.$project.$project_version;
+               $conf = $conf.$project.$project_version;
+       }
 
        my $file = $output ? $output : "$conf.ini";
        open C,">$file" or die "$file: $!\n";
@@ -1091,76 +1579,114 @@ sub mode_etics {
 
        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; 
+       my $cvs_module = full "$subsys.$module";
+       my ($package_summary, $package_description) = get_description $cvs_module;
+       if ($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; 
+       }
+       if ($package_summary) {
                $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';
+       $cmd_vcs{checkout} = "cvs -d \${vcsroot} co -d \${moduleName} ".($conftag eq 'HEAD' ? '-A' : '-r ${tag}')." $cvs_module 2>/dev/null";
+       #$cmd_vcs{checkout} = "((test -d jra1mw/.git && (cd jra1mw; git pull)) || (git clone -q http://scientific.zcu.cz/git/jra1mw.git";
+       #$cmd_vcs{checkout} .= " && (cd jra1mw; git checkout -b \${tag} --track origin/\${tag})" unless ($conftag eq /HEAD/);
+       #$cmd_vcs{checkout} .= ")) && (test -d \${moduleName} || ln -s jra1mw/$cvs_module \${moduleName})";
+       $cmd_vcs{checkout} .= "\n\ttest -f \${packageName}-\${version}-\${age}.src.tar.gz || (ln -s \${moduleName} \${packageName}-\${version}; tar -chf - \${packageName}-\${version} --exclude CVS --exclude .git --exclude .etics | gzip --best > \${packageName}-\${version}-\${age}.src.tar.gz; rm \${packageName}-\${version})";
+       $cmd_vcs{tag} = "cvs -d \${vcsroot} tag -R \${tag} ${moduleName}";
+
+       $cmd{default}{init} = 'None';
+       $cmd{default}{configure} = 'None';
+       $cmd{default}{compile} = 'None';
+       $cmd{default}{test} = 'None';
+       $cmd{default}{install} = 'None';
+       $cmd{default}{packaging} = 'None';
+       $cmd{default}{clean} = 'make clean';
+
+       if (exists $subpackages{$fmod}) {
+               $cmd{default}{clean} = 'None';
+               $cmd{default}{packaging} = "echo building nothing, $subpackages{$fmod} will build this package";
+               $cmd_vcs{checkout} = "mkdir -v \${moduleName} 2>/dev/null || true";
+       } elsif ($subsys eq 'gridsite') {
+               $cmd_vcs{tag} = 'None';
 
                if ($module eq 'core') {
-                       my ($flags, $prefix);
+                       my $flags;
 
                        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";
+                               # don't evaluate pkg-config calls to get them into source package
+                               $flags = 'RELEASE_VERSION=${age}
+       GSOAPDIR=\`pkg-config gsoap --variable=prefix\`
+       OPENSSL_GLOBUS_FLAGS=\`pkg-config globus-openssl --cflags\`
+       OPENSSL_GLOBUS_LIBS=\`pkg-config globus-openssl --libs\`';
                        } 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}";
+                               $flags = 'RELEASE_VERSION=${age}
+       GSOAPDIR=${gsoap.location}
+       OPENSSL_GLOBUS_FLAGS=-I${globus.location}/include/${globus.dbg.nothr.flavor}
+       OPENSSL_GLOBUS_LIBS=-L${globus.location}/${libdir}
+       HTTPD_FLAGS=-I${httpd-devel.location}/include/httpd -I${httpd-devel.location}/include/apache2 -I${httpd-devel.location}/include/apr-1 -I${httpd-devel.location}/include/apr-1.0 -I${httpd-devel.location}/include/apr-0 -I${httpd-devel.location}/include/pcre';
                        }
 
-                       $cmd{compile} = "echo 'make $flags' > build.sh\n\tmake $flags build";
-                       $cmd{clean} = "rm -rvf build.sh; $cmd{clean}";
-                       $cmd{install} = "make $prefix $flags install";
-                       $cmd{packaging} = "mkdir ${moduleDir}/src/tgz
-       make $prefix $flags rpm && \
-       cp ${moduleDir}/RPMTMP/SOURCES/gridsite-${version}.src.tar.gz ${moduleDir}/src/tgz";
+                       $cmd{default}{configure} = "cat > Makefile.inc <<EOF
+       project = $project
+       top_srcdir = ..
+       $flags
+       EOF";
+                       $cmd{default}{compile} = "make prefix=\${prefix}$project{local_prefix} libdir=\${libdir}";
+                       $cmd{default}{install} = "make prefix=\${prefix}$project{local_prefix} libdir=\${libdir} install";
+                       mode_etics_packaging($fmod, \%cmd,
+                               "make prefix=\${prefix}$project{local_prefix} rpm-prepare
+       cp gridsite.spec ../\n\t",
+                               "chmod +x \${moduleDir}/src/make-debian-files || true
+       make prefix=\${prefix}$project{local_prefix} deb-prepare\n\t"
+                       );
+               }
+               elsif ($module eq '1.5-compat') {
+                       $cmd_vcs{checkout} = "cvs -d \${vcsroot} co -d \${moduleName} ".($conftag eq 'HEAD' ? '-A' : '-r ${tag}')." $cvs_prefix{$subsys}.$subsys.core 2>/dev/null";
+                       $cmd{default}{init} = 'echo "/sbin/ldconfig" > project/.post
+       echo "/sbin/ldconfig" > project/.postun';
+                       $cmd{default}{configure} = "cat > src/Makefile.inc <<EOF
+       project = emi
+       libdir = \${libdir}
+       MAJOR_VERSION=1
+       MINOR_VERSION=1.5
+       PATCH_VERSION=1.5.0
+       VERSION=\\\$(PATCH_VERSION)
+       RELEASE_VERSION=\${age}
+       GSOAPDIR=\\`pkg-config gsoap --variable=prefix\\`
+       OPENSSL_GLOBUS_FLAGS=\\`pkg-config globus-openssl --cflags\\`
+       OPENSSL_GLOBUS_LIBS=\\`pkg-config globus-openssl --libs\\`
+       EOF";
+                       $cmd{default}{compile} = "make -C src prefix=\${prefix}$project{local_prefix}
+       rm -fv project/debian.changelog";
+                       $cmd{default}{install} = "make -C src prefix=\${prefix}$project{local_prefix} install-lib
+       rm -fv \${prefix}$project{local_prefix}/\${libdir}/libgridsite*.so.1
+       rm -fv \${prefix}$project{local_prefix}/\${libdir}/libgridsite*.so
+       rm -fv \${prefix}$project{local_prefix}/\${libdir}/libgridsite*.a";
+                       $cmd{default}{packaging} = "None";
                }
                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";
+                       $cmd{default}{clean} = 'None';
+                       $cmd{default}{packaging} = "echo building nothing, org.gridsite.core make rpm step will create this";
+                       $cmd_vcs{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";
+               $cmd{default}{configure} = "/usr/bin/perl $confdir/configure --root=\${prefix} --prefix= --stage=\${stageDir} --libdir=\${libdir} --project=\${projectName} --module $subsys.$module @copts";
+               $cmd{default}{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';
+               $cmd{default}{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{default}{compile} = 'make';
+               $cmd{default}{test} = 'make check';
+               $cmd{default}{install} = 'make install';
+               if ($subsys eq 'lb' and $module eq 'client') {
+                       $cmd{default}{compile} = "make rpath=$project{local_prefix}/\${libdir}";
+                       $cmd{default}{install} = "make install post-install rpath=$project{local_prefix}/\${libdir}";
+               }
+               mode_etics_packaging($fmod, \%cmd);
        }
 
        my $defprops = '';
@@ -1186,32 +1712,37 @@ $dwpath
 [Platform-default:VcsCommand]
 displayName = None
 description = None
-tag = $cmd{tag}
+tag = $cmd_vcs{tag}
 branch = None
 commit = None
-checkout = $cmd{checkout}
+checkout = $cmd_vcs{checkout}
+
+};
 
-[Platform-default:BuildCommand]
+       for my $p (keys %cmd) {
+               next if $p ne 'default' and exists $project{supported_platforms} and not exists $project{supported_platforms}{$p};
+
+               print C qq{[Platform-$p:BuildCommand]
 postpublish = None
-packaging = $cmd{packaging}
+packaging = $cmd{$p}{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}
+compile = $cmd{$p}{compile}
+init = $cmd{$p}{init}
+install = $cmd{$p}{install}
+clean = $cmd{$p}{clean}
+test = $cmd{$p}{test}
+configure = $cmd{$p}{configure}
 checkstyle = None
 
-[Platform-default:Property]
+};
+       }
+
+       print C qq{[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};
 
@@ -1222,6 +1753,10 @@ $package_description$package_summary$defprops};
        for (@{$conflicts{"$subsys.$module"}}) {
                print C "package.conflicts = $_\n";
        }
+       for (@{$provides{"$subsys.$module"}}) {
+               print C "package.provides = $_\n";
+       }
+       print C "\n";
 
        for my $pp (keys %{$platform_properties{"$subsys.$module"}}) {
                next if $pp eq 'default';
@@ -1232,44 +1767,116 @@ $package_description$package_summary$defprops};
                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";
        }
 
-       print C qq{
-[Platform-default:DynamicDependency]
-};
-       for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) {
-               my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_;
-               my $edev = $project{etics_externs_devel}{$_};
-               next if ($eext eq '-');
+       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 $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"}->{$_};
+                       my $type = $need_externs_type{"$subsys.$module"}->{$_};
 
-               if ($edev) {
-                       if ($type eq 'B') {
-                               $eext = $edev; # no runtime - change to devel pkg
-                       } elsif ($type eq 'BR' or $type eq 'RB') {
-                               print C "$proj|$edev = B\n"; # additional devel pkg
+                       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"; }
                }
-               print C "$proj|$eext = $type\n";
-       }
 
-       for (@{$deps{"$subsys.$module"}}) {
-               my $type = $deps_type{"$subsys.$module"}->{$_};
-               print C "$project{etics_name}|$project{etics_name}.$_ = $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;
+
+       for $file ("$cvs_module/project/debian.rules", "$cvs_module/project/$packageName.spec") {
+               my $lib;
+               my $main_module;
+               @copts = ();
+
+               if ($file =~ /debian\.rules$/) { $lib = 'lib'; }
+               else { $lib = '%{_lib}'; }
+
+               my $main_module = "$subsys.$module";
+               if (exists $subpackages{$main_module}) { $main_module = $subpackages{$main_module}; }
+
+               # locations hacks
+               if ($file =~ /$packageName\.spec$/) {
+                       if ($fmod eq 'lb.client-java') {
+                               push @copts, '';
+                               push @copts, '--with-axis=/usr/local/axis1.4';
+                       }
+               }
+
+               if (-f $file) {
+                       open DST,">$file.new" or die "$file.new: $!\n";
+                       open SRC,"<$file" or die "$file: $!\n";
+                       while (<SRC>) {
+                               if (/^(\s*).+\/configure\s/) {
+                                       printf DST "%s", "$1";
+                                       printf DST "/usr/bin/perl $confdir/configure $project{flavours} --root=/ --prefix=$project{local_prefix} --libdir=$lib --project=$project --module $main_module@copts\n";
+                               } else {
+                                       printf DST "%s", "$_";
+                               }
+                       }
+                       close SRC;
+                       close DST;
+
+                       `diff -b "$file" "$file.new"`;
+                       if ($? == 0) {
+                               print STDERR "($file not changed)\n";
+                               unlink "$file.new";
+                       } else {
+                               print STDERR "Writing $file\n";
+                               rename "$file", "$file.orig" unless -f "$file.orig";
+                               rename "$file.new", "$file";
+                       }
+               }
+       }
 }
 
 sub gsoap_version {
@@ -1337,6 +1944,62 @@ sub getlibdir {
         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;
@@ -1354,10 +2017,11 @@ General options (defaults in []):
   --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
+  --listmodules=module          list subpackages of a module
+  --version=maj.min.rev-age    version used 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]
+  --project=PROJECT            build or generate etics for a project (glite/emi1/emi) [emi]
   --debug                      print more details
   
 Mode of operation:
@@ -1371,6 +2035,7 @@ What to build:
   --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
+  --canl-tag=tag               checkout canl modules with specific tag
 
 Dependencies (summary of what will be used is always printed):
   --with-EXTERNAL=PATH         where to look for an external [autodetect]
index b6015f8..2426e4d 100644 (file)
@@ -6,7 +6,7 @@ glite-lb-notify - Register and receive notification from L&B
 .SH SYNOPSIS
 .B glite-lb-notify 
 .br
-       \fBnew\fR [ { \fB-s\fI socket_fd\fR | \fB-a \fIfake_addr\fR } \fB-t \fIrequested_validity\fR \fB-j \fIjobid \fR| { \fB-o \fIowner \fR | \fB -O \fR } \fB-n \fInetwork_server \fR \fB-v\fI virtual_organization\fR \fB-c \fR \fB-f\fI flags\fR ] 
+       \fBnew\fR [ { \fB-s\fI socket_fd\fR | \fB-a \fIfake_addr\fR } \fB-t \fIrequested_validity\fR \fB-j \fIjobid \fR| { \fB-o \fIowner \fR | \fB -O \fR } \fB-n \fInetwork_server \fR \fB-v\fI virtual_organization\fR \fB-c\fR \fB-J\fR \fB-B\fR \fB-T\fR \fB-E\fR \fB-f\fI flags\fR ] 
 .br
        \fBbind \fR [ { \fB-s\fI socket_fd\fR | \fB-a \fIfake_addr\fR } \fB-t \fIrequested_validity\fR ] \fInotifid\fR
 .br    
@@ -126,6 +126,40 @@ to get list of available fields.
 
 Drop the notification from the server, removing all messages on the way eventually.
 
+.SH \ 
+
+Options for the \fBnew\fR subcommand:
+.TP
+.B -o
+match on events for jobs belonging to the given \fIDN\fR.
+.TP
+.B -O
+match on events for jobs belonging to the current user.
+.TP
+.B -v
+match on events for jobs belonging to users from the given \fIVO\fR.
+.TP
+.B -c
+match only if job state has actually changed. Notification messages won't be sent for events that do not trigger job state change.
+.TP
+.B -S
+match only on jobs in certain \fIstates\fR listed in a comma-separated list.
+.TP
+.B -J
+pack JDL with the job status structure.
+.TP
+.B -B
+bootstrap -- send past events matching conditions.
+.TP
+.B -T
+match only on reaching a terminal state.
+.TP
+.B -H
+match only on reaching a terminal state and pack all events for that job.
+.TP
+.B -N
+anonymize all owner data in all messages under this registration.
+
 .SH EXAMPLE
 Installed with the package as share/examples/glite-lb-notify.pl.
 Demontstrates using the non-trivial
index a9ddd3b..8a9f526 100644 (file)
@@ -350,9 +350,8 @@ static void printstat(edg_wll_JobStat stat, int level)
        }
 
        /* CREAM state section */
-       if (stat.jobtype == EDG_WLL_STAT_CREAM) {
-               char    *cream_stat_name = edg_wll_CreamStatToString(stat.cream_state);
-
+       char *cream_stat_name = edg_wll_CreamStatToString(stat.cream_state);
+       if (stat.jobtype == EDG_WLL_STAT_CREAM || cream_stat_name) {
                printf("%scream_state : %s\n", ind, cream_stat_name);
                printf("%scream_owner : %s\n", ind, stat.cream_owner);
                printf("%scream_endpoint : %s\n", ind, stat.cream_endpoint);
@@ -365,9 +364,8 @@ static void printstat(edg_wll_JobStat stat, int level)
                printf("%scream_cancelling : %d\n", ind, stat.cream_cancelling);
                printf("%scream_cpu_time : %d\n", ind, stat.cream_cpu_time);
                printf("%scream_jw_status : %s\n", ind,  edg_wll_JWStatToString(stat.cream_jw_status));
-
-               free(cream_stat_name);
        }
+       if (cream_stat_name) free(cream_stat_name);
 
        /* File Transfer section */
        printf("%sft_compute_job : %s\n", ind, j1 = edg_wlc_JobIdUnparse(stat.ft_compute_job)); free(j1);
index 66aec08..ea45813 100644 (file)
@@ -26,6 +26,7 @@ limitations under the License.
 #include <unistd.h>
 
 #include "glite/lb/context-int.h"
+#include "glite/lb/connpool.h"
 #ifdef BUILDING_LB_CLIENT
 #include "consumer.h"
 #else
@@ -69,13 +70,13 @@ void *thread_meat(char *jobid) {
                        dgerr(ctx,"edg_wll_JobStatus"); result = 1; 
                } else {
                        printstat_oneline(status,0);
+                       edg_wll_FreeStatus(&status);
                        break;
                }
                sleep(3); 
        }
 
        if (job) edg_wlc_JobIdFree(job);
-//     if (status.state) edg_wll_FreeStatus(&status);
 
        cleanup:
        
@@ -140,6 +141,7 @@ int main(int argc,char *argv[]) {
        }
 
        free(threads);
+       edg_wll_poolFree(); // for hunting memleaks
 
        return 0;
 }
index 3443d33..643c0d9 100644 (file)
@@ -71,6 +71,9 @@ static void usage(void)
        fprintf(stderr, "    -e                 query events (default is 'query jobs')\n");
        fprintf(stderr, "    -P                 query the L&B Proxy server\n");
        fprintf(stderr, "    -p                 L&B Proxy socket path\n");
+       fprintf(stderr, "    -C                 send classad flag with job state queries\n");
+       fprintf(stderr, "    -S                 send childstat flag with job state queries\n");
+       fprintf(stderr, "    -N                 send no_jobs flag with job state queries\n");
        fprintf(stderr, "    -r type            returned results: limited | all | none\n\n");
        fprintf(stderr, "    -J num             jobs soft limit\n\n");
        fprintf(stderr, "    -E num             events soft limit (query events only)\n\n");
@@ -93,13 +96,15 @@ int main(int argc,char *argv[])
                                                        jobsLimit       = 0,
                                                        stdisp          = 0,
                                                        eventsLimit     = 0,
+                                                       resultsLimit    = 0,
                                                        i, j, ret,
-                                                       errCode;
+                                                       errCode,
+                                                       flags           = 0;
 
        myname  = argv[0];
        ret             = 0;
        do {
-               switch ( getopt(argc,argv,"hvsePp:i:m:r:J:E:") ) {
+               switch ( getopt(argc,argv,"hvsePp:i:m:r:J:E:CSNR:") ) {
                case 'h': usage();  exit(0);
                case '?': usage(); exit(EINVAL);
                case 'v': verbose = 1; break;
@@ -117,6 +122,10 @@ int main(int argc,char *argv[])
                        break;
                case 'J': jobsLimit = atoi(optarg); break;
                case 'E': eventsLimit = atoi(optarg); break;
+               case 'R': resultsLimit = atoi(optarg); break;
+               case 'C': flags = flags | EDG_WLL_STAT_CHILDSTAT; break;
+               case 'S': flags = flags | EDG_WLL_STAT_CLASSADS; break;
+               case 'N': flags = flags | 1024; break; //crude, I know
                case -1: ret = 1; break;
                }
        } while ( !ret );
@@ -132,6 +141,12 @@ int main(int argc,char *argv[])
        }
        else if ( verbose ) printf("Soft query limit for jobs not set\n");
 
+       if ( resultsLimit > 0 ) {
+               edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_RESULTS, resultsLimit);
+               if ( verbose ) printf("Results limit for jobs: %d\n", resultsLimit);
+       }
+       else if ( verbose ) printf("Results limit for jobs not set\n");
+
        if ( query_events ) {
                if ( eventsLimit > 0 ) {
                        edg_wll_SetParam(ctx, EDG_WLL_PARAM_QUERY_EVENTS_LIMIT, eventsLimit);
@@ -202,14 +217,14 @@ int main(int argc,char *argv[])
                }
 
                if ( query_jobs ) {
-                       if ( query_bkserver )
+                       if ( query_bkserver ) 
                                errCode = edg_wll_QueryJobsExt(ctx,
                                                                (const edg_wll_QueryRec **) jc,
-                                                               0, &jobsOut, stdisp? &statesOut: NULL);
+                                                               flags, &jobsOut, stdisp? &statesOut: NULL);
                        else
                                errCode = edg_wll_QueryJobsExtProxy(ctx,
                                                                (const edg_wll_QueryRec **) jc,
-                                                               0, &jobsOut, stdisp? &statesOut: NULL);
+                                                               flags, &jobsOut, stdisp? &statesOut: NULL);
                } else {
                        if ( query_bkserver )
                                errCode = edg_wll_QueryEventsExt(ctx,
@@ -931,7 +946,6 @@ static void dgerr(edg_wll_Context ctx, char *where)
 
 
        edg_wll_Error(ctx, &errText, &errDesc);
-       fprintf(stderr, "%s", errText);
        if ( where )
                fprintf(stderr, ": %s", where);
        if ( errDesc )
diff --git a/org.glite.lb.client/examples/reallyrunning.l b/org.glite.lb.client/examples/reallyrunning.l
new file mode 100644 (file)
index 0000000..9dc6177
--- /dev/null
@@ -0,0 +1,4 @@
+# macro definition for REALLYRUNNING state
+
+:running:
+-s LogMonitor,-e ReallyRunning,--wn_seq="${EDG_WL_SEQUENCE:-UI=000003:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000}"
index f50e853..330ac79 100644 (file)
@@ -20,6 +20,7 @@ limitations under the License.
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <getopt.h>
 
 #include "glite/lb/context.h"
 #include "glite/lb/xml_conversions.h"
@@ -31,13 +32,27 @@ limitations under the License.
 
 int use_proxy = 0;
 
+static const char *get_opt_string = "hxn";
+
+static struct option opts[] = {
+       {"help",        0,      NULL,   'h'},
+       {"proxy",       0,      NULL,   'x'},
+       {"no-states",   0,      NULL,   'n'},
+       {NULL,  0,      NULL,   0}
+};
+
 int (*user_jobs)(edg_wll_Context, edg_wlc_JobId **, edg_wll_JobStat **);
 
 
 void
 usage(char *me)
 {
-       fprintf(stderr,"usage: %s [-h] [-x] [userid]\n", me);
+       fprintf(stderr,"usage: %s [options] [userid]\n"
+               "\t-h, --help           show this help\n"
+               "\t-x, --proxy          contact proxy\n"
+               "\t-n, --no-states      do not show job states"
+               "\n",
+               me);
 }
 
 int main(int argc,char **argv)
@@ -46,21 +61,31 @@ int main(int argc,char **argv)
        char            *errt,*errd;
        edg_wlc_JobId           *jobs = NULL;
        edg_wll_JobStat         *states = NULL;
-       int             i,j;
+       int             opt,i,j;
        char            *owner = NULL;
+       int             show_states = 1;
 
        user_jobs = edg_wll_UserJobs;
-       for ( i = 1; i < argc; i++ ) {
-               if ( !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help") ) {
+
+       while ((opt = getopt_long(argc, argv, get_opt_string, opts, NULL)) != EOF) {
+               switch (opt) {
+               case 'h':
                        usage(argv[0]);
                        exit(0);
-               } else if ( !strcmp(argv[i], "-x") ) {
+               case 'x':
                        user_jobs = edg_wll_UserJobsProxy;
-                       continue;
+                       break;
+               case 'n':
+                       show_states = 0;
+                       break;
+               default:
+                       if (owner || !optarg) {
+                               usage(argv[0]);
+                               exit(1);
+                       }
+                       owner = strdup(optarg);
+                       break;
                }
-
-               owner = strdup(argv[i]);
-               break;  
        }
 
        if (edg_wll_InitContext(&ctx) != 0) {
@@ -70,11 +95,13 @@ int main(int argc,char **argv)
        if ( user_jobs == edg_wll_UserJobsProxy  && owner )
                edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_USER, owner);
 
-       if (user_jobs(ctx,&jobs,&states)) goto err;
-       for (i=0; states[i].state != EDG_WLL_JOB_UNDEF; i++) {  
+       if (user_jobs(ctx,&jobs,show_states ? &states : NULL)) goto err;
+       for (i=0; states && states[i].state != EDG_WLL_JOB_UNDEF; i++) {
                char *id = edg_wlc_JobIdUnparse(states[i].jobId),
                     *st = edg_wll_StatToString(states[i].state);
                
+               printf("Job: %s\n", id);
+
                if (!states[i].parent_job) {
                        if (states[i].jobtype == EDG_WLL_STAT_SIMPLE) { 
                                printf("      %s .... %s %s\n", id, st, (states[i].state==EDG_WLL_JOB_DONE) ? edg_wll_done_codeToString(states[i].done_code) : "" );
@@ -103,6 +130,13 @@ int main(int argc,char **argv)
                free(id);
                free(st);
        }
+       if (!show_states) {
+               for (i = 0; jobs[i]; i++) {
+                       char *id = edg_wlc_JobIdUnparse(jobs[i]);
+                       printf("        %s\n", id);
+                       free(id);
+               }
+       }
 
        printf("\nFound %d jobs\n",i);
 
index 2b1f5f7..95ac0fc 100644 (file)
@@ -24,6 +24,7 @@ void glite_lb_print_stat_fields(void **,edg_wll_JobStat *);
 void glite_lb_dump_stat_fields(void);
 
 #include <time.h>
+#include <stdio.h>
 
 static char *TimeToStr(time_t t) 
 {
index 3546e97..8af089e 100644 (file)
 4.1.8-1
 - Optimized handling of simultaneous proxy&direct logging (fix for bug #77366)
 
+4.1.9-1
+- Fixed default setting for GLITE_LB_EXPORT_PURGE_ARGS
+
+4.1.10-1
+- Proper handling of background purge error messages (fix for bug #77974)
+
 5.0.0-1
 - Fixes for parallel release in EMI & gLite
 - Version numbering fixed
 
 5.0.6-1
 - Using rpath only as $prefix/$libdir (fixes rpmlint rpath check in mock environment)
+
+5.0.7-1
+- Fixed default setting for GLITE_LB_EXPORT_PURGE_ARGS
+- Proper handling of background purge error messages (fix for bug #77974)
+- Fix locations in automatic purge (SB #81646).
+- Makefile adjustments for eticsless build
+
+5.0.8-1
+- Finalized ETICS+rpath+libtool mock build problem, workaround inside ETICS configurations now
+- Fixing rpath problem in mock builds
+
+5.0.9-1
+- Examples linked explicitely with L&B common library
+- Reduce memory consumption on query (SB #46437)
+- Support Debian 6 build
+
+5.1.0-1
+- Preparation for a new multiplatform release
+- Fix removing of .la files (for ETICS build).
+- Now with post-install
+
+5.1.1-1
+- Notification client supports new flags (anonymization, terminal states, job history)
+- Support of Debian packaging
+
+5.1.2-1
+- Packaging improvements (rpmlint and lintian checks)
+- Extended job query example to allow setting selected query flags through cmdline arguments
+- Correct module name in spec file
+- License string as recognized by rpmlint and packaging guidelines.
+- Fixes in notification client:
+  - notification refresh - missing ID
+  - client timeout - '999999999 + time(NULL)' overflows on 32bit since 2006
+- "Megajob" perftest updates
+
+5.1.3-1
+- New example script
+- Memory leaks fixed in client and common library when looking for non-existant job
+- Fixed race condition during context initializations
+
+5.1.4-1
+- Fixed connection pool unlocking in error conditions (SB #92783)
+
diff --git a/org.glite.lb.client/project/debian.control b/org.glite.lb.client/project/debian.control
new file mode 100644 (file)
index 0000000..4fd28e5
--- /dev/null
@@ -0,0 +1,41 @@
+Source: glite-lb-client
+Priority: extra
+Maintainer: @MAINTAINER@
+Uploaders: @UPLOADERS@
+Build-Depends: debhelper (>= 7.0.50~), chrpath, libtool, libclassad1, libclassad-dev, glite-lb-types, libglite-jobid-api-c-dev, libglite-jobid-api-cpp-dev, libglite-lb-common-dev, libglite-lbjp-common-gss-dev, libglite-lbjp-common-trio-dev
+Standards-Version: 3.9.1
+Section: libs
+Homepage: @URL@
+DM-Upload-Allowed: yes
+@DEBIAN_VCS@
+
+Package: libglite-lb-client11
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: @SUMMARY@
+@DEBIAN_DESCRIPTION@
+
+Package: libglite-lb-client-dev
+Section: libdevel
+Architecture: any
+Provides: glite-lb-client
+Depends: libglite-lb-client11 (= ${binary:Version}), ${misc:Depends}, libglite-lb-common-dev, libglite-jobid-api-c-dev, libglite-jobid-api-cpp-dev
+Description: Development files for gLite L&B/JP common log module
+ This package contains development libraries and header files for gLite L&B
+ client library.
+
+Package: glite-lb-client-progs
+Section: misc
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: gLite L&B client programs and examples
+ This package contains client programs and examples for gLite L&B.
+
+Package: glite-lb-client-dbg
+Section: debug
+Architecture: any
+Priority: extra
+Depends: libglite-lb-client11 (= ${binary:Version}), ${misc:Depends}
+Description: gLite L&B client library debugging symbols
+ This package contains debugging symbols for gLite L&B client library.
diff --git a/org.glite.lb.client/project/debian.copyright b/org.glite.lb.client/project/debian.copyright
new file mode 100644 (file)
index 0000000..3d762ae
--- /dev/null
@@ -0,0 +1,38 @@
+This work was packaged for Debian by:
+
+    @MAINTAINER@ on Thu, 08 Dec 2011 00:46:07 +0100
+
+It was downloaded from:
+
+    @URL@
+
+Upstream Author(s):
+
+    @MAINTAINER@
+
+Copyright:
+
+    <Copyright (C) 2004-2011 Members of the EGEE Collaboration>
+
+License:
+
+   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.
+
+On Debian systems, the complete text of the Apache version 2.0 license
+can be found in "/usr/share/common-licenses/Apache-2.0".
+
+The Debian packaging is:
+
+    Copyright (C) 2004-2011 Members of the EGEE Collaboration
+
+and is licensed under the Apache License, Version 2.0.
diff --git a/org.glite.lb.client/project/debian.glite-lb-client-progs.dirs b/org.glite.lb.client/project/debian.glite-lb-client-progs.dirs
new file mode 100644 (file)
index 0000000..bb9ceb6
--- /dev/null
@@ -0,0 +1,3 @@
+usr/bin
+usr/lib/glite-lb/exampes
+usr/sbin
diff --git a/org.glite.lb.client/project/debian.glite-lb-client-progs.install b/org.glite.lb.client/project/debian.glite-lb-client-progs.install
new file mode 100644 (file)
index 0000000..2250368
--- /dev/null
@@ -0,0 +1,3 @@
+usr/bin/*
+usr/lib/glite-lb/examples/*
+usr/sbin/*
diff --git a/org.glite.lb.client/project/debian.libglite-lb-client-dev.dirs b/org.glite.lb.client/project/debian.libglite-lb-client-dev.dirs
new file mode 100644 (file)
index 0000000..7abab4d
--- /dev/null
@@ -0,0 +1,6 @@
+usr/include/glite/lb
+usr/lib
+usr/share/emi/build/m4
+usr/share/doc/glite-lb-client/examples
+usr/share/man/man1
+usr/share/man/man8
diff --git a/org.glite.lb.client/project/debian.libglite-lb-client-dev.install b/org.glite.lb.client/project/debian.libglite-lb-client-dev.install
new file mode 100644 (file)
index 0000000..2222094
--- /dev/null
@@ -0,0 +1,5 @@
+usr/include/glite/lb/*.h
+usr/lib/lib*.so
+usr/share/doc/glite-lb-client/examples/*
+usr/share/emi/build/m4/*
+usr/share/man/*/*
diff --git a/org.glite.lb.client/project/debian.libglite-lb-client11.dirs b/org.glite.lb.client/project/debian.libglite-lb-client11.dirs
new file mode 100644 (file)
index 0000000..53c4714
--- /dev/null
@@ -0,0 +1,2 @@
+usr/lib
+usr/share/doc/glite-lb-client
\ No newline at end of file
diff --git a/org.glite.lb.client/project/debian.libglite-lb-client11.install b/org.glite.lb.client/project/debian.libglite-lb-client11.install
new file mode 100644 (file)
index 0000000..8606864
--- /dev/null
@@ -0,0 +1,4 @@
+usr/lib/lib*.so.*
+usr/share/doc/glite-lb-client/changelog.gz
+usr/share/doc/glite-lb-client/package.*
+usr/share/doc/glite-lb-client/README-notify
diff --git a/org.glite.lb.client/project/debian.rules b/org.glite.lb.client/project/debian.rules
new file mode 100644 (file)
index 0000000..3016ca3
--- /dev/null
@@ -0,0 +1,70 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+-include /usr/share/dpkg/buildflags.mk
+
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=1
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       /usr/bin/perl ./configure --thrflavour= --nothrflavour= --root=/ --prefix=/usr --libdir=lib --project=emi --module lb.client
+       touch $@
+
+build: build-arch build-indep
+
+build-arch build-indep: build-stamp
+
+build-stamp: configure-stamp
+       dh_testdir
+       CFLAGS="$(CFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(MAKE)
+       CFLAGS="$(CFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(MAKE) check
+       touch $@
+
+clean: configure-stamp
+       dh_testdir
+       dh_testroot
+       rm -f configure-stamp build-stamp
+       $(MAKE) clean
+       rm -f Makefile.inc config.status
+       dh_clean
+
+install: build-stamp
+       dh_testdir
+       dh_testroot
+       dh_prep
+       dh_installdirs
+       $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
+       rm -vf $(CURDIR)/debian/tmp/usr/lib/*.la
+       rm -vf $(CURDIR)/debian/tmp/usr/lib/*.a
+       find $(CURDIR)/debian/tmp -name '*' -print | xargs -I {} -i bash -c "chrpath -d {} > /dev/null 2>&1" || echo 'Stripped RPATH'
+       mv $(CURDIR)/debian/tmp/usr/share/doc/glite-lb-client-@MAJOR@.@MINOR@.@REVISION@ $(CURDIR)/debian/tmp/usr/share/doc/glite-lb-client
+       (cd $(CURDIR)/debian/tmp/usr/share/doc/glite-lb-client; \
+        rm -fv ChangeLog LICENSE; \
+        cat $(CURDIR)/project/ChangeLog | gzip -9 > changelog.gz)
+
+binary-indep:
+
+binary-arch: install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs
+       dh_installdocs
+       dh_installexamples
+       dh_installman
+       dh_installlogrotate
+       dh_installcron
+       dh_install --fail-missing
+       dh_link
+       dh_strip --dbg-package=glite-lb-client-dbg
+       dh_compress
+       dh_fixperms
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-arch binary-indep
diff --git a/org.glite.lb.client/project/glite-lb-client.spec b/org.glite.lb.client/project/glite-lb-client.spec
new file mode 100644 (file)
index 0000000..d41ee0f
--- /dev/null
@@ -0,0 +1,130 @@
+Summary: @SUMMARY@
+Name: glite-lb-client
+Version: @MAJOR@.@MINOR@.@REVISION@
+Release: @AGE@%{?dist}
+Url: @URL@
+License: ASL 2.0
+Vendor: EMI
+Group: System Environment/Libraries
+BuildRequires: classads
+BuildRequires: classads-devel
+BuildRequires: cppunit-devel
+BuildRequires: chrpath
+BuildRequires: glite-lb-types
+BuildRequires: glite-jobid-api-c-devel
+BuildRequires: glite-jobid-api-cpp-devel
+BuildRequires: glite-lb-common-devel
+BuildRequires: glite-lbjp-common-gss-devel
+BuildRequires: glite-lbjp-common-trio-devel
+BuildRequires: libtool
+BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+AutoReqProv: yes
+Source: http://eticssoft.web.cern.ch/eticssoft/repository/emi/emi.lb.client/%{version}/src/%{name}-@VERSION@.src.tar.gz
+
+
+%description
+@DESCRIPTION@
+
+
+%package devel
+Summary: Development files for gLite L&B client library
+Group: Development/Libraries
+Requires: %{name}%{?_isa} = %{version}-%{release}
+Requires: glite-lb-common-devel
+Requires: glite-jobid-api-c-devel
+Requires: glite-jobid-api-cpp-devel
+
+
+%description devel
+This package contains development libraries and header files for gLite L&B
+client library.
+
+
+%package progs
+Summary: gLite L&B client programs and examples
+Group: System Environment/Base
+
+
+%description progs
+This package contains client programs and examples for gLite L&B.
+
+
+%prep
+%setup -q
+
+
+%build
+/usr/bin/perl ./configure --thrflavour= --nothrflavour= --root=/ --prefix=/usr --libdir=%{_lib} --project=emi --module lb.client
+make
+
+
+%check
+make check
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+find $RPM_BUILD_ROOT -name '*.la' -exec rm -rf {} \;
+find $RPM_BUILD_ROOT -name '*.a' -exec rm -rf {} \;
+find $RPM_BUILD_ROOT -name '*' -print | xargs -I {} -i bash -c "chrpath -d {} > /dev/null 2>&1" || echo 'Stripped RPATH'
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%post -p /sbin/ldconfig
+
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%defattr(-,root,root)
+%dir /usr/share/doc/%{name}-%{version}/
+/usr/%{_lib}/libglite_lb_client.so.11.@MINOR@.@REVISION@
+/usr/%{_lib}/libglite_lb_client.so.11
+/usr/%{_lib}/libglite_lb_clientpp.so.11.@MINOR@.@REVISION@
+/usr/%{_lib}/libglite_lb_clientpp.so.11
+/usr/share/doc/%{name}-%{version}/ChangeLog
+/usr/share/doc/%{name}-%{version}/LICENSE
+/usr/share/doc/%{name}-%{version}/README-notify
+/usr/share/doc/%{name}-%{version}/package.description
+/usr/share/doc/%{name}-%{version}/package.summary
+
+
+%files devel
+%defattr(-,root,root)
+%dir /usr/share/emi/
+%dir /usr/share/emi/build/
+%dir /usr/share/emi/build/m4/
+%dir /usr/share/doc/%{name}-%{version}/examples/
+%dir /usr/include/glite/
+%dir /usr/include/glite/lb/
+/usr/include/glite/lb/*.h
+/usr/%{_lib}/libglite_lb_client.so
+/usr/%{_lib}/libglite_lb_clientpp.so
+/usr/share/doc/%{name}-%{version}/examples/*
+/usr/share/emi/build/m4/glite_lb.m4
+/usr/share/man/man1/glite-lb-notify.1.gz
+/usr/share/man/man1/glite-lb-logevent.1.gz
+/usr/share/man/man8/glite-lb-dump.8.gz
+/usr/share/man/man8/glite-lb-load.8.gz
+
+
+%files progs
+%defattr(-,root,root)
+%dir /usr/%{_lib}/glite-lb/
+%dir /usr/%{_lib}/glite-lb/examples/
+/usr/bin/glite-lb-logevent
+/usr/bin/glite-lb-notify
+/usr/bin/glite-lb-register_sandbox
+/usr/%{_lib}/glite-lb/examples/*
+/usr/sbin/glite-lb-export.sh
+
+
+%changelog
+* @SPEC_DATE@ @MAINTAINER@ - @MAJOR@.@MINOR@.@REVISION@-@AGE@%{?dist}
+- automatically generated package
index 2dd8c47..413aefd 100644 (file)
        CREAM_ID
        PAYLOAD_OWNER
        ACCESS_RIGHTS
+       HISTORY
 /;
index e5ab489..45ba4e7 100644 (file)
@@ -304,11 +304,15 @@ int edg_wll_open(edg_wll_Context ctx, int* connToUse)
        if ( (index = ConnectionIndex(ctx, ctx->srvName, ctx->srvPort)) == -1 ) {
                /* no such open connection in pool */
                if (ctx->connections->connOpened == ctx->connections->poolSize)
-                       if(ReleaseConnection(ctx, NULL, 0)) goto end;
+                       if(ReleaseConnection(ctx, NULL, 0)) {
+                               edg_wll_poolUnlock(); 
+                               goto end;
+                       }
                
                index = AddConnection(ctx, ctx->srvName, ctx->srvPort);
                if (index < 0) {
                     edg_wll_SetError(ctx,EAGAIN,"connection pool size exceeded");
+                   edg_wll_poolUnlock(); 
                    goto end;
                }
 
@@ -568,7 +572,10 @@ int http_check_status(
                        break;
                case HTTP_UNSUPPORTED:
                        edg_wll_SetError(ctx, ENOTSUP, "Protocol versions incompatible");
-                       break;                                                          
+                       break;
+               case HTTP_ACCEPTED:
+                       edg_wll_SetError(ctx,EDG_WLL_ERROR_ACCEPTED_OK,response+len);
+                       break;
                case HTTP_INTERNAL:
                        /* fall through */
                default: 
@@ -713,7 +720,7 @@ int edg_wll_accept(edg_wll_Context ctx, int fd)
        }
 
         #ifdef EDG_WLL_CONNPOOL_DEBUG  
-               printf("Connection with fd %d accepted. %d in the pool\n",>srvName,ctx->srvPort,ctx->connNotif->connToUse);
+               printf("Connection with fd %d accepted. %d in the pool\n",ctx->srvName,ctx->srvPort,ctx->connNotif->connToUse);
         #endif
                
 
index 8836d5c..a4a6c8c 100644 (file)
@@ -444,6 +444,7 @@ int set_server_name_and_port(edg_wll_Context ctx, const edg_wll_QueryRec **job_c
        }
        else if ( !ctx->srvName || !ctx->srvPort )
        {
+               if (found) free(srvName);
                if (!ctx->p_query_server) 
                        return(edg_wll_SetError(ctx, (edg_wll_ErrorCode) EINVAL, "Hostname of server to query is not set"));
                else ctx->srvName = strdup(ctx->p_query_server);
index a1427f6..b20663d 100644 (file)
@@ -54,6 +54,7 @@ static const char* const request_headers[] = {
        NULL
 };
 
+static int zero = 0;
 
 
 
@@ -94,58 +95,74 @@ static void get_name_and_port(const char *address, char **name, int *port)
 }      
 
 
-static int my_bind(edg_wll_Context ctx, const char *name, int port, int *fd)
-{
-       int             sock;
-       int             ret;
-       struct addrinfo *ai;
-       struct addrinfo hints;
-       char            *portstr = NULL;
-
-       asprintf(&portstr, "%d", port);
-       if (portstr == NULL) {
-               return edg_wll_SetError(ctx, ENOMEM, "my_bind(): ENOMEM converting port number");
-       }
+static int daemon_listen(edg_wll_Context ctx, const char *name, char *port, int *conn_out) {
+       struct  addrinfo *ai;
+       struct  addrinfo hints;
+       int     conn;
+       int     gaie;
 
        memset (&hints, '\0', sizeof (hints));
        hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV | AI_PASSIVE | AI_ADDRCONFIG;
        hints.ai_socktype = SOCK_STREAM;
+       hints.ai_family = AF_INET6;
 
-       ret = getaddrinfo (name, portstr, &hints, &ai);
-       free(portstr);
-       if (ret != 0) {
-               return edg_wll_SetError(ctx, EADDRNOTAVAIL, gai_strerror(ret));
+       gaie = getaddrinfo (name, port, &hints, &ai);
+       if (gaie != 0 || ai == NULL) {
+               hints.ai_family = 0;
+               gaie = getaddrinfo (NULL, port, &hints, &ai);
+       }
+
+       gaie = getaddrinfo (name, port, &hints, &ai);
+       if (gaie != 0) {
+               return edg_wll_SetError(ctx, EADDRNOTAVAIL, gai_strerror(gaie));
        }
        if (ai == NULL) {
                return edg_wll_SetError(ctx, EADDRNOTAVAIL, "no result from getaddrinfo");
        }
 
-       sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
-       if (sock == -1) { 
+       conn = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+       if ( conn < 0 ) { 
                freeaddrinfo(ai);
-               return  edg_wll_SetError(ctx, errno, "socket() failed");
+               return edg_wll_SetError(ctx, errno, "socket() failed");
        }
+       //setsockopt(conn, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
+       if (ai->ai_family == AF_INET6)
+               setsockopt(conn, IPPROTO_IPV6, IPV6_V6ONLY, &zero, sizeof(zero));
 
-//     setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
-       ret = bind(sock, ai->ai_addr, ai->ai_addrlen);
-       if (ret == -1) { 
+       if ( bind(conn, ai->ai_addr, ai->ai_addrlen) )
+       {
                edg_wll_SetError(ctx, errno, "bind() failed");
-               close(sock); 
+               close(conn); 
                freeaddrinfo(ai);
                return edg_wll_Error(ctx, NULL, NULL);
        }
-       freeaddrinfo(ai);
 
-       ret = listen(sock, CON_QUEUE);
-       if (ret == -1) { 
+       if ( listen(conn, CON_QUEUE) ) { 
                edg_wll_SetError(ctx, errno, "listen() failed");
-               close(sock); 
+               close(conn); 
                return edg_wll_Error(ctx, NULL, NULL);
        }
 
-       *fd = sock;
-       
-       return edg_wll_Error(ctx,NULL,NULL);
+       freeaddrinfo(ai);
+
+       *conn_out = conn;
+       return 0;
+}
+
+
+static int my_bind(edg_wll_Context ctx, const char *name, int port, int *fd)
+{
+       int             ret;
+       char            *portstr = NULL;
+
+       asprintf(&portstr, "%d", port);
+       if (portstr == NULL) {
+               return edg_wll_SetError(ctx, ENOMEM, "my_bind(): ENOMEM converting port number");
+       }
+       ret = daemon_listen(ctx, name, portstr, fd);
+       free(portstr);
+
+       return ret;
 }
        
 
index df10e43..220d4e6 100644 (file)
@@ -50,16 +50,20 @@ static void usage(char *cmd)
                        me);
        }
        if ( !cmd || !strcmp(cmd, "new") )
-               fprintf(stderr,"\n'new' command usage: %s new [ { -s socket_fd | -a fake_addr } -t requested_validity -j jobid  { -o owner | -O }  -n network_server -v virtual_organization --states state1,state2,... -c -f flags]\n"
+               fprintf(stderr,"\n'new' command usage: %s new [ { -s socket_fd | -a fake_addr } -t requested_validity -j jobid  { -o owner | -O }  -n network_server -v virtual_organization --state state1,state2,... -c -J -B -T -H -f flags]\n"
                        "    jobid              Job ID to connect notif. reg. with\n"
                        "    owner              Match this owner DN\n"
                        "    requested_validity Validity of notification req. in seconds\n"
-                       "    flags              0 - return basic status, 1 - return also JDL in status\n"
-                       "                       256 - bootstrap stream (send all existing jobs too)\n"
+                       "    flags              Numeric flags, can be also represented by cmdline options bellow\n"
                        "    network_server     Match only this network server (WMS entry point)\n"
                        "    -O                 Match owner - credentials are retrieved from environment\n"
                        "    -c                 Match only on state change\n"
                        "    -S | --state       Match on events resulting in listed (coma-delimited) states\n"
+                       "    -J | --jdl         Attach JDL to job status being returned\n"
+                       "    -B | --bootstrap   Also send past events matching conditions\n"
+                       "    -T | --terminal    Notify only when a job reaches terminal state\n"
+                       "    -H | --history     Same as -T plus attach a history of all job's Events\n"
+                       "    -N | --aNonymize   Anonymize all owner data in all messages under this registration\n"
                        , me);
        if ( !cmd || !strcmp(cmd, "bind") )
                fprintf(stderr,"\n'bind' command usage: %s bind [ { -s socket_fd | -a fake_addr } -t requested_validity ] notifids \n"
@@ -99,7 +103,7 @@ int main(int argc,char **argv)
 {
        edg_wll_Context         ctx;
        edg_wll_QueryRec  **conditions = NULL;
-       time_t                          valid = time(NULL) + 999999999;
+       time_t                          valid = 0;
        char                       *errt, *errd;
        void            *fields = NULL;
 
@@ -133,6 +137,11 @@ int main(int argc,char **argv)
                 edg_wll_GssStatus      gss_code;
                static struct option long_options[] = {
                        {"state", required_argument, 0, 'S'},
+                       {"jdl", no_argument, 0, 'J'},
+                       {"bootstrap", no_argument, 0, 'B'},
+                       {"terminal", no_argument, 0, 'T'},
+                       {"history", no_argument, 0, 'H'},
+                       {"anonymize", no_argument, 0, 'N'},
                        {0, 0, 0, 0}};
                int option_index = 0;
                char *single, *statelist, *notif_server;
@@ -144,7 +153,7 @@ int main(int argc,char **argv)
                conditions = (edg_wll_QueryRec **)calloc(MAX_NEW_CONDS + 1,sizeof(edg_wll_QueryRec *));
                conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
 
-               while ((c = getopt_long(argc-1,argv+1,"j:o:v:n:s:a:t:f:cOS:",long_options,&option_index)) > 0) { switch (c) {
+               while ((c = getopt_long(argc-1,argv+1,"j:o:v:n:s:a:t:f:cOS:JBTHN",long_options,&option_index)) > 0) { switch (c) {
                        case 'j':
                                conditions[i] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
                                conditions[i][0].attr = EDG_WLL_QUERY_ATTR_JOBID;
@@ -196,7 +205,17 @@ int main(int argc,char **argv)
                        case 't':
                                valid = time(NULL) + atol(optarg); break;
                        case 'f':
-                               flags = atoi(optarg); break;
+                               flags |= atoi(optarg); break;
+                       case 'J':
+                               flags |= EDG_WLL_STAT_CLASSADS; break;
+                       case 'B':
+                               flags |= EDG_WLL_NOTIF_BOOTSTRAP; break;
+                       case 'T':
+                               flags |= EDG_WLL_NOTIF_TERMINAL_STATES; break;
+                       case 'H':
+                               flags |= EDG_WLL_NOTIF_TERMINAL_STATES | EDG_WLL_NOTIF_HISTORY; break;
+                       case 'N':
+                               flags |= EDG_WLL_NOTIF_ANONYMIZE; break;
                        case 'c':
                                conditions[i] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
                                conditions[i][0].attr = EDG_WLL_QUERY_ATTR_STATUS;
@@ -306,7 +325,7 @@ int main(int argc,char **argv)
                time_t  client_tout = time(NULL) + 600;
                int     refresh = 0;
                struct timeval          tout;
-               time_t  opt_valid = 0,do_refresh = client_tout + 999999999,now;
+               time_t  opt_valid = 0,do_refresh = client_tout,now;
 
                while ((c = getopt(argc-1,argv+1,"s:a:i:f:t:r")) > 0) switch (c) {
                        case 's':
@@ -361,11 +380,10 @@ int main(int argc,char **argv)
                                        goto receive_err;
                                fprintf(stderr,"notification is valid until: %s (%ld)\n", TimeToStr(valid), valid);
                                
-                               if (nid) edg_wll_NotifIdFree(nid); nid = NULL;
                                param++;
                        }
                        now = time(NULL);
-                       do_refresh = now + (refresh ? (valid - now)/2 : 999999999);
+                       do_refresh = now + (valid - now)/2;
                        if (refresh) fprintf(stderr,"next refresh %s (%ld)\n",
                                        TimeToStr(do_refresh),do_refresh);
                }
@@ -374,8 +392,7 @@ int main(int argc,char **argv)
                        edg_wll_NotifId         recv_nid = NULL;
                        int     err;
 
-                       tout.tv_sec = (client_tout < do_refresh ? 
-                                       client_tout : do_refresh)
+                       tout.tv_sec = (refresh && client_tout >= do_refresh ? do_refresh : client_tout)
                                        - time(NULL);
                        if (tout.tv_sec < 0) tout.tv_sec = 0;
                        tout.tv_usec = 0;
@@ -538,13 +555,14 @@ cleanup:
                */
                free(conditions);
        }
-       
-       if (edg_wll_Error(ctx,&errt,&errd))
+
+       int retval;
+       if (retval = edg_wll_Error(ctx,&errt,&errd)) 
                fprintf(stderr, "%s: %s (%s)\n", me, errt, errd);
 
        edg_wll_NotifCloseFd(ctx);
        edg_wll_FreeContext(ctx);
        edg_wll_poolFree();
 
-       return 0;
+       return retval;
 }
index dbbd7f9..de960d6 100644 (file)
@@ -20,13 +20,17 @@ clients=${1:-3}
 
 jobs=${2:-/tmp/perftest_10.jobids}
 
-# XXX - there must be better way to find stage
 if [ -z "${GLITE_LOCATION}" ]; then
-        STAGEDIR=/home/michal/shared/egee/jra1-head/stage
+       # let's be in stage
+        STAGEDIR=`pwd`/stage/usr
 else
         STAGEDIR=${GLITE_LOCATION}
 fi
-JOBSTAT=$STAGEDIR/examples/glite-lb-job_status
+for dir in $STAGEDIR/lib/glite-lb/examples $STAGEDIR/lib64/glite-lb/examples; do
+       EXAMPLES=$dir
+       if test -d $dir; then break; fi
+done
+JOBSTAT=$EXAMPLES/glite-lb-job_status
 
 ask() {
        $JOBSTAT `cat $jobs`
index e111ffc..ce8142a 100644 (file)
@@ -249,11 +249,13 @@ int edg_wll_log_connect(edg_wll_Context ctx, int *conn)
                if (ctx->connections->connOpened == ctx->connections->poolSize)
                        if (ReleaseConnection(ctx, NULL, 0)) {
                                answer = edg_wll_SetError(ctx,EAGAIN,"cannot release connection (pool size exceeded)");
+                               edg_wll_poolUnlock();
                                goto edg_wll_log_connect_end;
                        }
                index = AddConnection(ctx, ctx->p_destination, ctx->p_dest_port);
                if (index < 0) {
                     answer = edg_wll_SetError(ctx,EAGAIN,"cannot add connection to pool");
+                   edg_wll_poolUnlock();
                    goto edg_wll_log_connect_end;
                }
 #ifdef EDG_WLL_LOG_STUB