From 01f881461cb8c425f1dfbca7fc240ab805d0d9d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Posp=C3=AD=C5=A1il?= Date: Sat, 15 Dec 2007 20:04:54 +0000 Subject: [PATCH] GGUS#19469: - Install also the source code of the examples together with a minimal Makefile. - Installed examples are now buildable on hosts with glite-lb-client installed. --- org.glite.lb.client/Makefile | 26 ++++++-- org.glite.lb.client/examples/Makefile | 78 +++++++++++++++++++++++ org.glite.lb.client/examples/README.examples | 32 ++++++++++ org.glite.lb.client/examples/abort_job.c | 4 +- org.glite.lb.client/examples/change_acl.c | 2 +- org.glite.lb.client/examples/consumer_fake.c | 2 +- org.glite.lb.client/examples/dagids.c | 2 +- org.glite.lb.client/examples/feed_shark.c | 2 +- org.glite.lb.client/examples/flood_proxy.c | 2 +- org.glite.lb.client/examples/job_log.c | 2 +- org.glite.lb.client/examples/job_reg.c | 2 +- org.glite.lb.client/examples/job_status.c | 2 +- org.glite.lb.client/examples/log_usertag_proxy.c | 2 +- org.glite.lb.client/examples/notify.c | 2 +- org.glite.lb.client/examples/parse_eventsfile.c | 2 +- org.glite.lb.client/examples/producer_fake.c | 2 +- org.glite.lb.client/examples/query_ext.c | 2 +- org.glite.lb.client/examples/query_seq_code.c | 2 +- org.glite.lb.client/examples/stats.c | 2 +- org.glite.lb.client/examples/stress_context.c | 2 +- org.glite.lb.client/examples/stresslog.c | 2 +- org.glite.lb.client/examples/user_jobs.c | 2 +- org.glite.lb.client/examples/user_jobs_threaded.c | 2 +- 23 files changed, 150 insertions(+), 28 deletions(-) create mode 100644 org.glite.lb.client/examples/Makefile create mode 100644 org.glite.lb.client/examples/README.examples diff --git a/org.glite.lb.client/Makefile b/org.glite.lb.client/Makefile index 6efa685..6df58e8 100644 --- a/org.glite.lb.client/Makefile +++ b/org.glite.lb.client/Makefile @@ -146,13 +146,19 @@ PLUSLIB:=libglite_lb_clientpp_${nothrflavour}.la THRPLUSLIB:=libglite_lb_clientpp_${thrflavour}.la TOOLS:=${LB_PERF_TOOLS} -EXAMPLES:=log_usertag_proxy job_log job_reg feed_shark notify query_ext query_seq_code stats abort_job change_acl stresslog flood_proxy dagids stress_context parse_eventsfile +EXAMPLES_SRC:=log_usertag_proxy.c job_log.c job_reg.c feed_shark.c notify.c query_ext.c query_seq_code.c stats.c abort_job.c change_acl.c stresslog.c flood_proxy.c dagids.c stress_context.c parse_eventsfile.c +EXAMPLES:=${EXAMPLES_SRC:.c=} # TODO: migrate them here from branch_RC31_3 -# EXAMPLES_PLUS:=indexed_attrs_plus job_status_plus query_events_plus listener user_jobs_plus job_log_plus notify_plus +# EXAMPLES_PLUS_SRC:=indexed_attrs_plus.cpp job_status_plus.cpp query_events_plus.cpp listener.cpp user_jobs_plus.cpp job_log_plus.cpp notify_plus.cpp +# EXAMPLES_PLUS:=${EXAMPLES_PLUS_SRC:.cpp=} + +EXAMPLES_CL_SRC:=user_jobs.c job_status.c +EXAMPLES_CL:=${EXAMPLES_CL_SRC:.c=} + +EXAMPLES_CL_THR_SRC:=user_jobs_threaded.c +EXAMPLES_CL_THR:=${EXAMPLES_CL_THR_SRC:.c=} -EXAMPLES_CL:=user_jobs job_status -EXAMPLES_CL_THR:=user_jobs_threaded FAKE_EXAMPLES:=job_log_fake MAN_GZ:=glite-lb-logevent.1.gz @@ -320,7 +326,9 @@ install: doc mkdir -p ${PREFIX}/include/${globalprefix}/${lbprefix} mkdir -p ${PREFIX}/lib mkdir -p ${PREFIX}/share/doc/${package}-${version}/api + mkdir -p ${PREFIX}/share/doc/${package}-${version}/examples mkdir -p ${PREFIX}/share/man/man1 + mkdir -p ${PREFIX}/examples ifdef LB_STANDALONE ${INSTALL} -m 644 ${LIB} ${THRLIB} ${PREFIX}/lib else @@ -335,17 +343,21 @@ ifndef LB_STANDALONE cp -r C CPP ${PREFIX}/share/doc/${package}-${version} # cp -r ${top_srcdir}/doc/api/{Makefile,api.tex,fig} ${PREFIX}/share/doc/${package}-${version}/api endif - mkdir -p ${PREFIX}/examples for p in logevent; do \ ${INSTALL} -m 755 "$$p" "${PREFIX}/bin/glite-lb-$$p"; \ done for p in ${TOOLS} ; do \ ${INSTALL} -m 755 "$$p" "${PREFIX}/sbin/glite-lb-$$p"; \ done -# TODO: restructuring - install also source code of examples together with some good Makefile - for p in ${EXAMPLES} ${EXAMPLES_CL} ${EXAMPLES_CL_THR} ${sh_PROGS} ; do \ +# TODO: restructuring - do we really need binaries of the examples to be installed? + for p in ${EXAMPLES} ${EXAMPLES_PLUS} ${EXAMPLES_CL} ${EXAMPLES_CL_THR} ${sh_PROGS} ; do \ ${INSTALL} -m 755 "$$p" "${PREFIX}/examples/glite-lb-$$p"; \ done + for p in ${EXAMPLES_SRC} ${EXAMPLES_PLUS_SRC} ${EXAMPLES_CL_SRC} ${EXAMPLES_CL_THR_SRC} ; do \ + ${INSTALL} -m 644 "${top_srcdir}/examples/$$p" "${PREFIX}/share/doc/${package}-${version}/examples/"; \ + done + ${INSTALL} -m 644 ${top_srcdir}/examples/Makefile "${PREFIX}/share/doc/${package}-${version}/examples/" + ${INSTALL} -m 644 ${top_srcdir}/examples/README.examples "${PREFIX}/share/doc/${package}-${version}/examples/" ${INSTALL} -m 755 ${top_srcdir}/src/export.sh "${PREFIX}/sbin/glite-lb-export.sh" ${INSTALL} -m 644 ${MAN_GZ} ${PREFIX}/share/man/man1 diff --git a/org.glite.lb.client/examples/Makefile b/org.glite.lb.client/examples/Makefile new file mode 100644 index 0000000..ee5fc6f --- /dev/null +++ b/org.glite.lb.client/examples/Makefile @@ -0,0 +1,78 @@ +glite_location:=${GLITE_LOCATION} +glite_prefix:=${glite_location} + +nothrflavour=gcc32dbg +thrflavour=gcc32dbgpthr + +CC:=gcc +CXX:=g++ + +COMMON_LIB:=-lglite_lb_common_${nothrflavour} +COMMON_LIB_THR:=-lglite_lb_common_${thrflavour} +CLIENT_LIB:=-lglite_lb_client_${nothrflavour} +CLIENT_LIB_THR:=-lglite_lb_client_${thrflavour} +JOBID_LIB:=-lglite_jobid + +LIB:=${COMMON_LIB} ${CLIENT_LIB} ${JOBID_LIB} +LIB_THR:=${COMMON_LIB_THR} ${CLIENT_LIB_THR} ${JOBID_LIB} +PLUSLIB:= +PLUSLIB_THR:= + +CFLAGS:=${DEBUG} \ + -I${glite_prefix}/include \ + -D_GNU_SOURCE + +CXXFLAGS:=${CFLAGS} + +host_cpu:=${shell uname -m} +ifeq (${host_cpu},x86_64) + LDFLAGS:=-L${glite_prefix}/lib64 +else + LDFLAGS:=-L${glite_prefix}/lib +endif + +COMPILE:=libtool --mode=compile ${CC} ${CFLAGS} +CXXCOMPILE:=libtool --mode=compile ${CXX} ${CXXFLAGS} +LINK:=libtool --mode=link ${CC} ${LDFLAGS} +LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} +INSTALL:=libtool --mode=install install + +EXAMPLES_SRC:=log_usertag_proxy.c job_log.c job_reg.c feed_shark.c notify.c query_ext.c query_seq_code.c stats.c abort_job.c change_acl.c stresslog.c flood_proxy.c dagids.c stress_context.c parse_eventsfile.c user_jobs.c job_status.c +EXAMPLES:=${EXAMPLES_SRC:.c=} + +# TODO: migrate them here from branch_RC31_3 +# EXAMPLES_PLUS_SRC:=indexed_attrs_plus.cpp job_status_plus.cpp query_events_plus.cpp listener.cpp user_jobs_plus.cpp job_log_plus.cpp notify_plus.cpp +# EXAMPLES_PLUS:=${EXAMPLES_PLUS_SRC:.cpp=} +# EXAMPLES_PLUS_THR_SRC:= +# EXAMPLES_PLUS_THR:=${EXAMPLES_PLUS_THR_SRC:.cpp=} + +EXAMPLES_THR_SRC:=user_jobs_threaded.c +EXAMPLES_THR:=${EXAMPLES_CL_THR_SRC:.c=} + +default all: examples + +examples: ${EXAMPLES} ${EXAMPLES_THR} ${EXAMPLES_PLUS} ${EXAMPLES_PLUS_THR} + +${EXAMPLES}: %: %.o + ${LINK} -o $@ $< ${LIB} + +${EXAMPLES_THR}: %: %.o + ${LINK} -o $@ $< ${LIB_THR} + +${EXAMPLES_PLUS}: %: %.o + ${LINKXX} -o $@ $< ${PLUSLIB} + +${EXAMPLES_PLUS_THR}: %: %.o + ${LINKXX} -o $@ $< ${PLUSLIB_THR} + +# catches $TOOLS and logevent compilation +%.o: %.c + ${CC} ${CFLAGS} -c $< + +%.o: %.cpp + ${CXX} ${CXXFLAGS} -c $< + +clean: + rm -rvf ${EXAMPLES} ${EXAMPLES_CL} ${EXAMPLES_CL_THR} + rm -rvf *.o .libs/ + diff --git a/org.glite.lb.client/examples/README.examples b/org.glite.lb.client/examples/README.examples new file mode 100644 index 0000000..a500dfb --- /dev/null +++ b/org.glite.lb.client/examples/README.examples @@ -0,0 +1,32 @@ +These are examples demonsrtating the usage of LB client API: + +abort_job.c - Manual abort of a job +change_acl.c - Change ACL +dagids.c - (sub)JobIds of a DAG job +feed_shark.c - Notifications "Shark" +flood_proxy.c - Log User Tag to LB Proxy from multiple processes +job_log.c - Return all events for given JobId +job_reg.c - Register a job in LB +job_status.c - Return a job status of given job +log_usertag_proxy.c - Log User Tag to LB Proxy +notify.c - Notifications handling tool (new, bind, change, refresh, receive, test, drop) +parse_eventsfile.c - Check parsing of dglogd* and notif-dglogd* files +query_ext.c - Complex querying tool +query_seq_code.c - How to query the sequence code of a job +stats.c - Return CE rank statistics from LB +stress_context.c - Stress test for working with LB context (Init, SetLoggingJob, Free - multiple processes) +stresslog.c - Stress test for logging (RegisterJOb, LogEvent) +user_jobs.c - Return jobs owned by given user +user_jobs_threaded.c - Return jobs owned by given user (threaded version) + + +The following RPMs must be installed in order to be able to build all the examples: + +glite-lb-client + +(and all its dependencies). + + +To build these examples, just set the GLITE_LOCATION environment variable and run make, e.g. + +$ GLITE_LOCATION=/opt/glite make diff --git a/org.glite.lb.client/examples/abort_job.c b/org.glite.lb.client/examples/abort_job.c index 24e9d05..d8a293f 100644 --- a/org.glite.lb.client/examples/abort_job.c +++ b/org.glite.lb.client/examples/abort_job.c @@ -10,8 +10,8 @@ #include #include "glite/lb/events_parse.h" -#include "consumer.h" -#include "producer.h" +#include "glite/lb/consumer.h" +#include "glite/lb/producer.h" #include "glite/jobid/cjobid.h" #include "glite/lb/context-int.h" diff --git a/org.glite.lb.client/examples/change_acl.c b/org.glite.lb.client/examples/change_acl.c index feb4ba4..c48d06a 100644 --- a/org.glite.lb.client/examples/change_acl.c +++ b/org.glite.lb.client/examples/change_acl.c @@ -4,7 +4,7 @@ #include #include "glite/jobid/cjobid.h" -#include "producer.h" +#include "glite/lb/producer.h" #include "glite/lb/authz.h" void diff --git a/org.glite.lb.client/examples/consumer_fake.c b/org.glite.lb.client/examples/consumer_fake.c index 98e6c75..55140ca 100644 --- a/org.glite.lb.client/examples/consumer_fake.c +++ b/org.glite.lb.client/examples/consumer_fake.c @@ -5,7 +5,7 @@ #include #include -#include "consumer.h" +#include "glite/lb/consumer.h" #include "glite/lb/context-int.h" #include "consumer_fake.h" diff --git a/org.glite.lb.client/examples/dagids.c b/org.glite.lb.client/examples/dagids.c index a710148..9ca6c21 100644 --- a/org.glite.lb.client/examples/dagids.c +++ b/org.glite.lb.client/examples/dagids.c @@ -6,7 +6,7 @@ #include #include "glite/jobid/cjobid.h" -#include "producer.h" +#include "glite/lb/producer.h" #include "glite/lb/events.h" extern char *optarg; diff --git a/org.glite.lb.client/examples/feed_shark.c b/org.glite.lb.client/examples/feed_shark.c index 63eafe1..824e781 100644 --- a/org.glite.lb.client/examples/feed_shark.c +++ b/org.glite.lb.client/examples/feed_shark.c @@ -7,7 +7,7 @@ #include #include -#include "notification.h" +#include "glite/lb/notification.h" static void usage(const char *); static void printstat(edg_wll_JobStat, int); diff --git a/org.glite.lb.client/examples/flood_proxy.c b/org.glite.lb.client/examples/flood_proxy.c index 9f2a3aa..652c387 100644 --- a/org.glite.lb.client/examples/flood_proxy.c +++ b/org.glite.lb.client/examples/flood_proxy.c @@ -7,7 +7,7 @@ #include #include -#include "producer.h" +#include "glite/lb/producer.h" #include "glite/jobid/cjobid.h" static void slave(); diff --git a/org.glite.lb.client/examples/job_log.c b/org.glite.lb.client/examples/job_log.c index 0a6d6ff..ba571e1 100644 --- a/org.glite.lb.client/examples/job_log.c +++ b/org.glite.lb.client/examples/job_log.c @@ -10,7 +10,7 @@ #include #include "glite/lb/events_parse.h" -#include "consumer.h" +#include "glite/lb/consumer.h" #include "glite/jobid/cjobid.h" #ifdef USE_CALLBACKS #include "glite/lb/consumer_fake.h" diff --git a/org.glite.lb.client/examples/job_reg.c b/org.glite.lb.client/examples/job_reg.c index 2a411c3..7f0767b 100644 --- a/org.glite.lb.client/examples/job_reg.c +++ b/org.glite.lb.client/examples/job_reg.c @@ -6,7 +6,7 @@ #include #include "glite/jobid/cjobid.h" -#include "producer.h" +#include "glite/lb/producer.h" #include "glite/lb/events.h" extern char *optarg; diff --git a/org.glite.lb.client/examples/job_status.c b/org.glite.lb.client/examples/job_status.c index fb4a765..c38eae0 100644 --- a/org.glite.lb.client/examples/job_status.c +++ b/org.glite.lb.client/examples/job_status.c @@ -9,7 +9,7 @@ #include #include "glite/lb/context-int.h" -#include "consumer.h" +#include "glite/lb/consumer.h" #include "glite/lb/xml_conversions.h" static void dgerr(edg_wll_Context,char *); diff --git a/org.glite.lb.client/examples/log_usertag_proxy.c b/org.glite.lb.client/examples/log_usertag_proxy.c index 1719ea8..39c9a1c 100644 --- a/org.glite.lb.client/examples/log_usertag_proxy.c +++ b/org.glite.lb.client/examples/log_usertag_proxy.c @@ -9,7 +9,7 @@ #include "glite/lb/notifid.h" #include "glite/lb/events.h" -#include "producer.h" +#include "glite/lb/producer.h" static struct option opts[] = { {"help", 0, NULL, 'h'}, diff --git a/org.glite.lb.client/examples/notify.c b/org.glite.lb.client/examples/notify.c index 1773919..ddbc36e 100644 --- a/org.glite.lb.client/examples/notify.c +++ b/org.glite.lb.client/examples/notify.c @@ -6,7 +6,7 @@ #include "glite/security/glite_gss.h" #include "glite/lb/context.h" -#include "notification.h" +#include "glite/lb/notification.h" static char *me; diff --git a/org.glite.lb.client/examples/parse_eventsfile.c b/org.glite.lb.client/examples/parse_eventsfile.c index 83ee8f2..16e8019 100644 --- a/org.glite.lb.client/examples/parse_eventsfile.c +++ b/org.glite.lb.client/examples/parse_eventsfile.c @@ -5,7 +5,7 @@ #include #include -#include "producer.h" +#include "glite/lb/producer.h" #include "glite/lb/events.h" #include "glite/lb/events_parse.h" diff --git a/org.glite.lb.client/examples/producer_fake.c b/org.glite.lb.client/examples/producer_fake.c index d75d7e6..1401b13 100644 --- a/org.glite.lb.client/examples/producer_fake.c +++ b/org.glite.lb.client/examples/producer_fake.c @@ -2,7 +2,7 @@ * fake implementation of the producer API */ -#include "producer.h" +#include "glite/lb/producer.h" #include "glite/lb/context-int.h" #include "producer_fake.h" diff --git a/org.glite.lb.client/examples/query_ext.c b/org.glite.lb.client/examples/query_ext.c index e47eee9..42ee3af 100644 --- a/org.glite.lb.client/examples/query_ext.c +++ b/org.glite.lb.client/examples/query_ext.c @@ -7,7 +7,7 @@ #include #include "glite/jobid/cjobid.h" -#include "consumer.h" +#include "glite/lb/consumer.h" #define BUFF_LEN 1024 #define MAX_AND_CONDS 20 diff --git a/org.glite.lb.client/examples/query_seq_code.c b/org.glite.lb.client/examples/query_seq_code.c index 29e9de7..85a0265 100644 --- a/org.glite.lb.client/examples/query_seq_code.c +++ b/org.glite.lb.client/examples/query_seq_code.c @@ -6,7 +6,7 @@ #include #include "glite/jobid/cjobid.h" -#include "consumer.h" +#include "glite/lb/consumer.h" static struct option opts[] = { diff --git a/org.glite.lb.client/examples/stats.c b/org.glite.lb.client/examples/stats.c index af6dcb1..2f32cc6 100644 --- a/org.glite.lb.client/examples/stats.c +++ b/org.glite.lb.client/examples/stats.c @@ -2,7 +2,7 @@ #include #include -#include "statistics.h" +#include "glite/lb/statistics.h" int main(int argc,char **argv) diff --git a/org.glite.lb.client/examples/stress_context.c b/org.glite.lb.client/examples/stress_context.c index a551d30..1bfdf34 100644 --- a/org.glite.lb.client/examples/stress_context.c +++ b/org.glite.lb.client/examples/stress_context.c @@ -5,7 +5,7 @@ #include #include "glite/jobid/cjobid.h" -#include "producer.h" +#include "glite/lb/producer.h" #include "glite/lb/events.h" char *outfile = "context_errors"; diff --git a/org.glite.lb.client/examples/stresslog.c b/org.glite.lb.client/examples/stresslog.c index da07f89..e6d75f2 100644 --- a/org.glite.lb.client/examples/stresslog.c +++ b/org.glite.lb.client/examples/stresslog.c @@ -6,7 +6,7 @@ #include #include "glite/jobid/cjobid.h" -#include "producer.h" +#include "glite/lb/producer.h" #include "glite/lb/events.h" #define MAXMSGSIZE 10240 diff --git a/org.glite.lb.client/examples/user_jobs.c b/org.glite.lb.client/examples/user_jobs.c index a593e08..151e8e5 100644 --- a/org.glite.lb.client/examples/user_jobs.c +++ b/org.glite.lb.client/examples/user_jobs.c @@ -8,7 +8,7 @@ #include "glite/lb/context.h" #include "glite/lb/xml_conversions.h" -#include "consumer.h" +#include "glite/lb/consumer.h" int use_proxy = 0; diff --git a/org.glite.lb.client/examples/user_jobs_threaded.c b/org.glite.lb.client/examples/user_jobs_threaded.c index b6c9a59..ce01e0e 100644 --- a/org.glite.lb.client/examples/user_jobs_threaded.c +++ b/org.glite.lb.client/examples/user_jobs_threaded.c @@ -12,7 +12,7 @@ #include "glite/lb/context.h" #include "glite/lb/xml_conversions.h" -#include "consumer.h" +#include "glite/lb/consumer.h" int use_proxy = 0; -- 1.8.2.3