reenabled check_version
authorJan Pospíšil <honik@ntc.zcu.cz>
Thu, 9 Aug 2007 09:56:51 +0000 (09:56 +0000)
committerJan Pospíšil <honik@ntc.zcu.cz>
Thu, 9 Aug 2007 09:56:51 +0000 (09:56 +0000)
- client's version now must follow common
- modified to support negative VERSION_AHEAD

org.glite.lb.client/Makefile
org.glite.lb.common/Makefile
org.glite.lb.types/Makefile
org.glite.lb.types/check_version.pl [new file with mode: 0755]

index 6f50e23..56f25cf 100644 (file)
@@ -18,10 +18,17 @@ CXX:=g++
 
 version=${module.version}
 
+# We must follow major version changes of org.glite.lb.common due to
+# binary compatibility. However, we may live a life of our own, changing our
+# major version more frequently. This variable specifies how many steps ahead
+# we are (the number can be even negative).
+
+VERSION_AHEAD=-3
+
 VPATH=${top_srcdir}/src:${top_srcdir}/interface:${top_srcdir}/test:${top_srcdir}/examples:${top_srcdir}/doc
 AT3=${stagedir}/sbin/glite-lb-at3
 GENSAM=${top_srcdir}/examples/gen_sample_job
-CHECK_VERSION:=VERSION=${version} VERSION_AHEAD=0 perl ${top_srcdir}/project/check_version.pl
+CHECK_VERSION:=VERSION=${version} VERSION_AHEAD=${VERSION_AHEAD} perl ${stagedir}/sbin/glite-lb-check_version.pl
 
 SUFFIXES = .T .l
 
@@ -106,7 +113,7 @@ PLUSOBJS:=Event.o Job.o JobStatus.o Notification.o ServerConnection.o
 HDRS:=consumer.h notification.h statistics.h prod_proto.h connection.h \
        Job.h Notification.h ServerConnection.h 
 FAKE_HDRS:=consumer_fake.h producer_fake.h
-GEN_HDRS:=JobStatus.h producer.h interface_version.h
+GEN_HDRS:=JobStatus.h producer.h
 
 LIBTHROBJS:=${LIBOBJS:.o=.thr.o}
 LIBLOBJS:=${LIBOBJS:.o=.lo}
@@ -149,9 +156,7 @@ version_info:=-version-info ${shell \
 ifdef LB_STANDALONE
 compile all: generate ${LIB} ${THRLIB} ${TOOLS} logevent examples ${MAN_GZ}
 else
-# FIXME:
-#compile all: generate ${LIB} ${THRLIB} ${PLUSLIB} ${THRPLUSLIB} ${TOOLS} logevent examples ${MAN_GZ}
-compile all: generate ${LIB} ${THRLIB} ${TOOLS} logevent examples ${MAN_GZ}
+compile all: check_version generate ${LIB} ${THRLIB} ${PLUSLIB} ${THRPLUSLIB} ${TOOLS} logevent examples ${MAN_GZ}
 endif
 
 generate: ${GEN_HDRS}
@@ -160,9 +165,6 @@ generate: ${GEN_HDRS}
        ln -vs . ${lbprefix}
        for i in ${HDRS}; do ln -vs ../interface/$$i $$i ; done
 
-interface_version.h: ${top_srcdir}/project/version.properties
-       echo "#define GLITE_LB_CLIENT_INTERFACE \"${version}\"" >$@ 
-
 ${LIB}: ${LIBOBJS}
        ${LINK} ${version_info} -o $@ ${LIBLOBJS} -rpath ${PREFIX}/lib \
                        ${COMMON_LIB} \
@@ -341,6 +343,6 @@ clean:
        rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/
 
 check_version:
-       ${CHECK_VERSION} ${stagedir}/include/glite/lb/interface_version.h
+       ${CHECK_VERSION} ${stagedir}/include/glite/lb/common_version.h
 
 .PHONY: default all compile examples fake check stage dist distsrc distbin install clean check_version
index 839308f..517c0a8 100644 (file)
@@ -47,14 +47,6 @@ CFLAGS:=${DEBUG} -I${top_srcdir}/src -I${top_srcdir}/interface \
        -D_GNU_SOURCE \
        -DDATAGRID_EXTENSION ${LB_STANDALONE_FLAGS}
 
-# We must follow major version changes of org.glite.lb.client-interface due to
-# binary compatibility. However, we may live a life of our own, changing our
-# major version more frequently. This variable specifies how many steps ahead
-# we are.
-
-VERSION_AHEAD=3
-CHECK_VERSION:=VERSION=${version} VERSION_AHEAD=${VERSION_AHEAD} perl ${top_srcdir}/project/check_version.pl
-
 ifneq (${expat_prefix},/usr)
        EXPAT_LIBS:=-L${expat_prefix}/lib
 endif
@@ -99,7 +91,7 @@ HDRS:=context.h context-int.h lb_plain_io.h mini_http.h authz.h xml_parse.h \
        xml_conversions.h log_proto.h events_parse.h il_string.h il_msg.h \
        escape.h ulm_parse.h trio.h lb_maildir.h connpool.h notifid.h notif_rec.h \
        query_rec.h timeouts.h LoggingExceptions.h CountRef.h ${PERF_HDRS} 
-GEN_HDRS:=Event.h events.h jobstat.h
+GEN_HDRS:=Event.h events.h jobstat.h common_version.h
 
 STATICLIB:=libglite_lb_common_${nothrflavour}.a
 THRSTATICLIB:=libglite_lb_common_${thrflavour}.a
@@ -124,6 +116,9 @@ generate: ${GEN_HDRS}
        ln -vs . ${lbprefix}
        for i in ${HDRS}; do ln -vs ../interface/$$i $$i ; done
 
+common_version.h: ${top_srcdir}/project/version.properties
+       echo "#define GLITE_LB_COMMON_VERSION \"${version}\"" >$@
+
 all compile: generate ${STATICLIB} ${LTLIB} ${THRSTATICLIB} ${THRLTLIB} ${TRIO_LIB} ${MAILDIR_LIB}
 
 # In order to use libtool versioning correcty, we must have:
@@ -266,6 +261,3 @@ il_int_test.o il_string_test.o il_test.o il_msg_test.o parse.o: %.o: %.cpp
        rm -f $@
        ${AT3} $< >$@ || rm -f $@
        chmod -w $@ >/dev/null
-
-check_version:
-       ${CHECK_VERSION} ${stagedir}/include/glite/lb/interface_version.h
index f5a650c..ae4686f 100644 (file)
@@ -7,7 +7,8 @@ T_DEST=${stagedir}/share/lb/at3
 SBIN=${stagedir}/sbin
 
 PM=StructField.pm MultiStruct.pm
-T=events.T  status.T  types.T
+T=events.T status.T types.T
+SCRIPTS=at3 check_version.pl
 
 default: compile
 
@@ -16,13 +17,18 @@ compile: at3
 at3: at3.in
        sed "s?%PREFIX%?${stagedir}?" at3.in >$@
 
+stage: install
+
 install: compile
        mkdir -p ${PM_DEST} ${T_DEST} ${SBIN}
        install -m 644 ${PM} ${PM_DEST}
        install -m 644 ${T} ${T_DEST}
-       install -m 755 at3 ${SBIN}/glite-lb-at3
+       for p in ${SCRIPTS} ; do \
+               install -m 755 "$$p" "${SBIN}/glite-lb-$$p"; \
+       done
        
 clean:
-       rm -f at3
+       rm -vf at3
+       rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/
 
 check:
diff --git a/org.glite.lb.types/check_version.pl b/org.glite.lb.types/check_version.pl
new file mode 100755 (executable)
index 0000000..5fb1a20
--- /dev/null
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+# check_version script to be used to compare common and client module versions
+# Usage:
+#   - set environment variables VERSION and VERSION_AHEAD of the module
+#   - run against ${stagedir}/include/glite/lb/common_version.h
+# Example: 
+#    ./check_version.pl common_version.h
+
+my $version = $ENV{VERSION};
+if ($version =~ /(\d+)\.\d+\.\d+/)  {
+       $version = $1;
+} else {
+       print "error: wrong version format ($version)\n";
+       exit 1;
+}
+
+my $ahead = $ENV{VERSION_AHEAD};
+if ($ahead =~ /(\-?\d+)/) {
+       $ahead = $1;
+} else {
+       print "error: wrong version_ahead format ($ahead)\n";
+       exit 1;
+}
+
+my $iface;
+
+while (<>) {
+       /#define GLITE_LB_COMMON_VERSION "(\d+)\.\d+\.\d+"/; 
+       $iface = $1; 
+}
+
+if ($iface + $ahead != $version) { 
+       print "error: Major version of the common ($iface and $ahead ahead) DOES NOT match implementation ($version)\n" ;
+       exit 1;  
+}