GGUS#19469:
authorJan Pospíšil <honik@ntc.zcu.cz>
Sat, 15 Dec 2007 20:04:54 +0000 (20:04 +0000)
committerJan Pospíšil <honik@ntc.zcu.cz>
Sat, 15 Dec 2007 20:04:54 +0000 (20:04 +0000)
- 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.

23 files changed:
org.glite.lb.client/Makefile
org.glite.lb.client/examples/Makefile [new file with mode: 0644]
org.glite.lb.client/examples/README.examples [new file with mode: 0644]
org.glite.lb.client/examples/abort_job.c
org.glite.lb.client/examples/change_acl.c
org.glite.lb.client/examples/consumer_fake.c
org.glite.lb.client/examples/dagids.c
org.glite.lb.client/examples/feed_shark.c
org.glite.lb.client/examples/flood_proxy.c
org.glite.lb.client/examples/job_log.c
org.glite.lb.client/examples/job_reg.c
org.glite.lb.client/examples/job_status.c
org.glite.lb.client/examples/log_usertag_proxy.c
org.glite.lb.client/examples/notify.c
org.glite.lb.client/examples/parse_eventsfile.c
org.glite.lb.client/examples/producer_fake.c
org.glite.lb.client/examples/query_ext.c
org.glite.lb.client/examples/query_seq_code.c
org.glite.lb.client/examples/stats.c
org.glite.lb.client/examples/stress_context.c
org.glite.lb.client/examples/stresslog.c
org.glite.lb.client/examples/user_jobs.c
org.glite.lb.client/examples/user_jobs_threaded.c

index 6efa685..6df58e8 100644 (file)
@@ -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 (file)
index 0000000..ee5fc6f
--- /dev/null
@@ -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 (file)
index 0000000..a500dfb
--- /dev/null
@@ -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
index 24e9d05..d8a293f 100644 (file)
@@ -10,8 +10,8 @@
 #include <errno.h>
 
 #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"
 
index feb4ba4..c48d06a 100644 (file)
@@ -4,7 +4,7 @@
 #include <unistd.h>
 
 #include "glite/jobid/cjobid.h"
-#include "producer.h"
+#include "glite/lb/producer.h"
 #include "glite/lb/authz.h"
 
 void
index 98e6c75..55140ca 100644 (file)
@@ -5,7 +5,7 @@
 #include <stddef.h>
 #include <string.h>
 
-#include "consumer.h"
+#include "glite/lb/consumer.h"
 #include "glite/lb/context-int.h"
 #include "consumer_fake.h"
 
index a710148..9ca6c21 100644 (file)
@@ -6,7 +6,7 @@
 #include <fcntl.h>
 
 #include "glite/jobid/cjobid.h"
-#include "producer.h"
+#include "glite/lb/producer.h"
 #include "glite/lb/events.h"
 
 extern char *optarg;
index 63eafe1..824e781 100644 (file)
@@ -7,7 +7,7 @@
 #include <errno.h>
 #include <sysexits.h>
 
-#include "notification.h"
+#include "glite/lb/notification.h"
 
 static void usage(const char *);
 static void printstat(edg_wll_JobStat, int);
index 9f2a3aa..652c387 100644 (file)
@@ -7,7 +7,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
-#include "producer.h"
+#include "glite/lb/producer.h"
 #include "glite/jobid/cjobid.h"
 
 static void slave();
index 0a6d6ff..ba571e1 100644 (file)
@@ -10,7 +10,7 @@
 #include <errno.h>
 
 #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"
index 2a411c3..7f0767b 100644 (file)
@@ -6,7 +6,7 @@
 #include <fcntl.h>
 
 #include "glite/jobid/cjobid.h"
-#include "producer.h"
+#include "glite/lb/producer.h"
 #include "glite/lb/events.h"
 
 extern char *optarg;
index fb4a765..c38eae0 100644 (file)
@@ -9,7 +9,7 @@
 #include <expat.h>
 
 #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 *);
index 1719ea8..39c9a1c 100644 (file)
@@ -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'},
index 1773919..ddbc36e 100644 (file)
@@ -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;
index 83ee8f2..16e8019 100644 (file)
@@ -5,7 +5,7 @@
 #include <errno.h>
 #include <fcntl.h>
 
-#include "producer.h"
+#include "glite/lb/producer.h"
 #include "glite/lb/events.h"
 #include "glite/lb/events_parse.h"
 
index d75d7e6..1401b13 100644 (file)
@@ -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"
 
index e47eee9..42ee3af 100644 (file)
@@ -7,7 +7,7 @@
 #include <time.h>
 
 #include "glite/jobid/cjobid.h"
-#include "consumer.h"
+#include "glite/lb/consumer.h"
 
 #define BUFF_LEN               1024
 #define MAX_AND_CONDS  20
index 29e9de7..85a0265 100644 (file)
@@ -6,7 +6,7 @@
 #include <errno.h>
 
 #include "glite/jobid/cjobid.h"
-#include "consumer.h"
+#include "glite/lb/consumer.h"
 
 
 static struct option opts[] = {
index af6dcb1..2f32cc6 100644 (file)
@@ -2,7 +2,7 @@
 #include <time.h>
 #include <string.h>
 
-#include "statistics.h"
+#include "glite/lb/statistics.h"
 
 
 int main(int argc,char **argv)
index a551d30..1bfdf34 100644 (file)
@@ -5,7 +5,7 @@
 #include <limits.h>
 
 #include "glite/jobid/cjobid.h"
-#include "producer.h"
+#include "glite/lb/producer.h"
 #include "glite/lb/events.h"
 
 char   *outfile = "context_errors";
index da07f89..e6d75f2 100644 (file)
@@ -6,7 +6,7 @@
 #include <fcntl.h>
 
 #include "glite/jobid/cjobid.h"
-#include "producer.h"
+#include "glite/lb/producer.h"
 #include "glite/lb/events.h"
 
 #define        MAXMSGSIZE      10240
index a593e08..151e8e5 100644 (file)
@@ -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;
 
index b6c9a59..ce01e0e 100644 (file)
@@ -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;