You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by ma...@apache.org on 2015/02/25 19:06:58 UTC

[2/2] bigtop git commit: BIGTOP-1448. Include ZooKeeper C libraries, headers, and clients in Bigtop

BIGTOP-1448. Include ZooKeeper C libraries, headers, and clients in Bigtop


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/23b95eb2
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/23b95eb2
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/23b95eb2

Branch: refs/heads/master
Commit: 23b95eb22038e0344a6f774a6cbf9fc150a324fa
Parents: abd615c
Author: Sean Mackrory <ma...@apache.org>
Authored: Mon Oct 6 08:43:28 2014 -0600
Committer: Sean Mackrory <ma...@apache.org>
Committed: Wed Feb 25 10:06:27 2015 -0800

----------------------------------------------------------------------
 .../src/common/zookeeper/do-component-build     |  2 +-
 .../src/common/zookeeper/install_zookeeper.sh   | 35 +++++++++++++++++++-
 bigtop-packages/src/deb/zookeeper/control       |  5 +++
 bigtop-packages/src/deb/zookeeper/rules         |  7 ++++
 .../src/rpm/zookeeper/SPECS/zookeeper.spec      | 23 ++++++++++---
 5 files changed, 66 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/23b95eb2/bigtop-packages/src/common/zookeeper/do-component-build
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/zookeeper/do-component-build b/bigtop-packages/src/common/zookeeper/do-component-build
index 85abf3d..200d233 100644
--- a/bigtop-packages/src/common/zookeeper/do-component-build
+++ b/bigtop-packages/src/common/zookeeper/do-component-build
@@ -25,7 +25,7 @@ ANT_OPTS="-Dversion=$ZOOKEEPER_VERSION -f build.xml $@"
 sed -i.orig -e 's#test-jar,api-report#test-jar#g' build.xml
 ant compile ${ANT_OPTS}
 (cd src/contrib/rest && ant jar ${ANT_OPTS})
-ant package ${ANT_OPTS}
+ant package package-native tar ${ANT_OPTS}
 
 mvn install:install-file -DcreateChecksum=true -DgroupId=org.apache.zookeeper -DartifactId=zookeeper -Dversion=$ZOOKEEPER_VERSION -Dpackaging=jar -Dfile=build/zookeeper-$ZOOKEEPER_VERSION.jar
 mvn install:install-file -DcreateChecksum=true -DgroupId=org.apache.zookeeper -DartifactId=zookeeper -Dversion=$ZOOKEEPER_VERSION -Dclassifier=tests -Dpackaging=jar -Dfile=build/zookeeper-$ZOOKEEPER_VERSION-test.jar

http://git-wip-us.apache.org/repos/asf/bigtop/blob/23b95eb2/bigtop-packages/src/common/zookeeper/install_zookeeper.sh
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/common/zookeeper/install_zookeeper.sh b/bigtop-packages/src/common/zookeeper/install_zookeeper.sh
index e0edbd8..35c0617 100755
--- a/bigtop-packages/src/common/zookeeper/install_zookeeper.sh
+++ b/bigtop-packages/src/common/zookeeper/install_zookeeper.sh
@@ -29,6 +29,8 @@ usage: $0 <options>
      --lib-dir=DIR               path to install zookeeper home [/usr/lib/zookeeper]
      --bin-dir=DIR               path to install bins [/usr/bin]
      --examples-dir=DIR          path to install examples [doc-dir/examples]
+     --system-include-dir=DIR    path to install development headers [/usr/include]
+     --system-lib-dir=DIR        path to install native libraries [/usr/lib]
      ... [ see source for more similar options ]
   "
   exit 1
@@ -42,6 +44,8 @@ OPTS=$(getopt \
   -l 'lib-dir:' \
   -l 'bin-dir:' \
   -l 'examples-dir:' \
+  -l 'system-include-dir:' \
+  -l 'system-lib-dir:' \
   -l 'build-dir:' -- "$@")
 
 if [ $? != 0 ] ; then
@@ -69,6 +73,12 @@ while true ; do
         --examples-dir)
         EXAMPLES_DIR=$2 ; shift 2
         ;;
+        --system-include-dir)
+        SYSTEM_INCLUDE_DIR=$2 ; shift 2
+        ;;
+        --system-lib-dir)
+        SYSTEM_LIB_DIR=$2 ; shift 2
+        ;;
         --)
         shift ; break
         ;;
@@ -93,6 +103,8 @@ LIB_DIR=${LIB_DIR:-/usr/lib/zookeeper}
 BIN_DIR=${BIN_DIR:-/usr/bin}
 CONF_DIR=/etc/zookeeper/conf
 CONF_DIST_DIR=/etc/zookeeper/conf.dist/
+SYSTEM_INCLUDE_DIR=${SYSTEM_INCLUDE_DIR:-/usr/include}
+SYSTEM_LIB_DIR=${SYSTEM_LIB_DIR:-/usr/lib}
 
 install -d -m 0755 $PREFIX/$LIB_DIR/
 rm -f $BUILD_DIR/zookeeper-*-javadoc.jar $BUILD_DIR/zookeeper-*-bin.jar $BUILD_DIR/zookeeper-*-sources.jar $BUILD_DIR/zookeeper-*-test.jar
@@ -107,7 +119,6 @@ for x in $PREFIX/$LIB_DIR/zookeeper*jar ; do
   x=$(basename $x)
   ln -s $x $PREFIX/$LIB_DIR/zookeeper.jar
 done
-  
 
 install -d -m 0755 $PREFIX/$LIB_DIR/lib
 cp $BUILD_DIR/lib/*.jar $PREFIX/$LIB_DIR/lib
@@ -186,3 +197,25 @@ gzip -c zookeeper.1 > $PREFIX/$MAN_DIR/zookeeper.1.gz
 # Zookeeper log and tx log directory
 install -d -m 1766 $PREFIX/var/log/zookeeper
 install -d -m 1766 $PREFIX/var/log/zookeeper/txlog
+
+# ZooKeeper native libraries
+install -d ${PREFIX}/$SYSTEM_INCLUDE_DIR
+install -d ${PREFIX}/$SYSTEM_LIB_DIR
+install -d ${PREFIX}/${LIB_DIR}-native
+
+(cd ${BUILD_DIR}/.. && tar xzf zookeeper-*-lib.tar.gz)
+cp -R ${BUILD_DIR}/../usr/include/* ${PREFIX}/${SYSTEM_INCLUDE_DIR}/
+cp -R ${BUILD_DIR}/../usr/lib*/* ${PREFIX}/${SYSTEM_LIB_DIR}/
+cp -R ${BUILD_DIR}/../usr/bin/* ${PREFIX}/${LIB_DIR}-native/
+for binary in ${PREFIX}/${LIB_DIR}-native/*; do
+  cat > ${PREFIX}/${BIN_DIR}/`basename ${binary}` <<EOF
+#!/bin/bash
+
+PREFIX=\$(dirname \$(readlink -f \$0))
+export LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:\${PREFIX}/../lib:\${PREFIX}/../lib64
+/usr/lib/zookeeper-native/`basename ${binary}` \$@
+
+EOF
+done
+chmod 755 ${PREFIX}/${BIN_DIR}/* ${PREFIX}/${LIB_DIR}-native/*
+

http://git-wip-us.apache.org/repos/asf/bigtop/blob/23b95eb2/bigtop-packages/src/deb/zookeeper/control
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/deb/zookeeper/control b/bigtop-packages/src/deb/zookeeper/control
index 5fd7171..c175bf6 100755
--- a/bigtop-packages/src/deb/zookeeper/control
+++ b/bigtop-packages/src/deb/zookeeper/control
@@ -38,3 +38,8 @@ Depends: zookeeper (= ${source:Version})
 Description: The Zookeeper REST server
  This package starts the zookeeper REST server on startup
 
+Package: zookeeper-native
+Architecture: any
+Description: C bindings for ZooKeeper clients
+ Provides native libraries and development headers for C / C++ ZooKeeper clients. Consists of both single-threaded and multi-threaded implementations.
+

http://git-wip-us.apache.org/repos/asf/bigtop/blob/23b95eb2/bigtop-packages/src/deb/zookeeper/rules
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/deb/zookeeper/rules b/bigtop-packages/src/deb/zookeeper/rules
index 532b9ec..4438d55 100755
--- a/bigtop-packages/src/deb/zookeeper/rules
+++ b/bigtop-packages/src/deb/zookeeper/rules
@@ -39,5 +39,12 @@ override_dh_auto_install:
 	bash -x debian/install_zookeeper.sh \
 	  --build-dir=build/zookeeper-${ZOOKEEPER_BASE_VERSION} \
 	  --prefix=debian/$(zookeeper_pkg_name)
+	   # Move native files to a dedicated package
+	   mkdir -p debian/zookeeper-native/usr/bin
+	   mkdir -p debian/zookeeper-native/usr/lib
+	   mv debian/zookeeper/usr/bin/cli_* debian/zookeeper/usr/bin/load_gen debian/zookeeper-native/usr/bin/
+	   mv debian/zookeeper/usr/lib/libzookeeper* debian/zookeeper-native/usr/lib/
+	   mv debian/zookeeper/usr/lib/zookeeper-native debian/zookeeper-native/usr/lib/
+	   mv debian/zookeeper/usr/include debian/zookeeper-native/usr/include
 	bash debian/init.d.tmpl debian/zookeeper-rest.svc deb debian/zookeeper-rest/etc/init.d/zookeeper-rest
 	dh_install -i

http://git-wip-us.apache.org/repos/asf/bigtop/blob/23b95eb2/bigtop-packages/src/rpm/zookeeper/SPECS/zookeeper.spec
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/rpm/zookeeper/SPECS/zookeeper.spec b/bigtop-packages/src/rpm/zookeeper/SPECS/zookeeper.spec
index 1a05ecd..16d1852 100644
--- a/bigtop-packages/src/rpm/zookeeper/SPECS/zookeeper.spec
+++ b/bigtop-packages/src/rpm/zookeeper/SPECS/zookeeper.spec
@@ -79,8 +79,7 @@ Source7: zookeeper.default
 Source8: init.d.tmpl
 Source9: zookeeper-rest.svc
 Source10: ZOOKEEPER-1911.patch
-BuildArch: noarch
-BuildRequires: autoconf, automake
+BuildRequires: autoconf, automake, cppunit-devel
 Requires(pre): coreutils, /usr/sbin/groupadd, /usr/sbin/useradd
 Requires(post): %{alternatives_dep}
 Requires(preun): %{alternatives_dep}
@@ -103,7 +102,6 @@ Requires: %{name} = %{version}-%{release}
 Requires(pre): %{name} = %{version}-%{release}
 Requires(post): %{chkconfig_dep}
 Requires(preun): %{service_dep}, %{chkconfig_dep}
-BuildArch: noarch
 
 %if  %{?suse_version:1}0
 # Required for init scripts
@@ -134,6 +132,13 @@ Requires(pre): %{name} = %{version}-%{release}
 Requires(post): %{chkconfig_dep}
 Requires(preun): %{service_dep}, %{chkconfig_dep}
 
+%package native
+Summary: C bindings for ZooKeeper clients
+Group: Development/Libraries
+
+%description native
+Provides native libraries and development headers for C / C++ ZooKeeper clients. Consists of both single-threaded and multi-threaded implementations.
+
 %description rest
 This package starts the zookeeper REST server on startup
 
@@ -150,7 +155,9 @@ cp $RPM_SOURCE_DIR/zookeeper.1 $RPM_SOURCE_DIR/zoo.cfg $RPM_SOURCE_DIR/zookeeper
 bash %{SOURCE2} \
           --build-dir=build/%{name}-%{zookeeper_base_version} \
           --doc-dir=%{doc_zookeeper} \
-          --prefix=$RPM_BUILD_ROOT
+          --prefix=$RPM_BUILD_ROOT \
+          --system-include-dir=%{_includedir} \
+          --system-lib-dir=%{_libdir}
 
 %if  %{?suse_version:1}0
 orig_init_file=%{SOURCE4}
@@ -233,3 +240,11 @@ fi
 %files rest
 %attr(0755,root,root) %{initd_dir}/%{svc_zookeeper_rest}
 
+%files native
+%defattr(-,root,root)
+%{lib_zookeeper}-native
+%{bin_zookeeper}/cli_*
+%{bin_zookeeper}/load_gen*
+%{_includedir}/zookeeper
+%{_libdir}/*
+