From da2547bc7d4ba5a9eef0e72746c78807010138d4 Mon Sep 17 00:00:00 2001 From: "Timothy St. Clair" Date: Wed, 15 Oct 2014 08:30:46 -0500 Subject: [PATCH] WIP update to 3.4.6 --- ZOOKEEPER-1557.patch | 152 ---------- mt_adaptor.c.patch | 32 -- zkEnv.sh | 91 ++++++ zookeeper-3.4.4-build.patch | 449 ---------------------------- zookeeper-3.4.5-build-contrib.patch | 133 -------- zookeeper-3.4.5-log4j.patch | 26 -- zookeeper-3.4.6-ivy-build.patch | 52 ++++ zookeeper.service | 11 +- zookeeper.spec | 250 ++++++---------- 9 files changed, 245 insertions(+), 951 deletions(-) delete mode 100644 ZOOKEEPER-1557.patch delete mode 100644 mt_adaptor.c.patch create mode 100755 zkEnv.sh delete mode 100644 zookeeper-3.4.4-build.patch delete mode 100644 zookeeper-3.4.5-build-contrib.patch delete mode 100644 zookeeper-3.4.5-log4j.patch create mode 100644 zookeeper-3.4.6-ivy-build.patch diff --git a/ZOOKEEPER-1557.patch b/ZOOKEEPER-1557.patch deleted file mode 100644 index e273685..0000000 --- a/ZOOKEEPER-1557.patch +++ /dev/null @@ -1,152 +0,0 @@ -diff --git src/java/test/org/apache/zookeeper/test/SaslAuthFailNotifyTest.java src/java/test/org/apache/zookeeper/test/SaslAuthFailNotifyTest.java -new file mode 100644 -index 0000000..2b00d86 ---- /dev/null -+++ src/java/test/org/apache/zookeeper/test/SaslAuthFailNotifyTest.java -@@ -0,0 +1,98 @@ -+/** -+ * Licensed to the Apache Software Foundation (ASF) under one -+ * or more contributor license agreements. See the NOTICE file -+ * distributed with this work for additional information -+ * regarding copyright ownership. The ASF licenses this file -+ * to you 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. -+ */ -+ -+package org.apache.zookeeper.test; -+ -+import java.io.File; -+import java.io.FileWriter; -+import java.io.IOException; -+import java.util.concurrent.atomic.AtomicInteger; -+ -+import org.apache.zookeeper.CreateMode; -+import org.apache.zookeeper.TestableZooKeeper; -+import org.apache.zookeeper.WatchedEvent; -+import org.apache.zookeeper.ZooKeeper; -+import org.apache.zookeeper.Watcher.Event.KeeperState; -+import org.apache.zookeeper.ZooDefs.Ids; -+import org.junit.Test; -+import org.junit.Assert; -+ -+public class SaslAuthFailNotifyTest extends ClientBase { -+ static { -+ System.setProperty("zookeeper.authProvider.1","org.apache.zookeeper.server.auth.SASLAuthenticationProvider"); -+ System.setProperty("zookeeper.allowSaslFailedClients","true"); -+ -+ try { -+ File tmpDir = createTmpDir(); -+ File saslConfFile = new File(tmpDir, "jaas.conf"); -+ FileWriter fwriter = new FileWriter(saslConfFile); -+ -+ fwriter.write("" + -+ "Server {\n" + -+ " org.apache.zookeeper.server.auth.DigestLoginModule required\n" + -+ " user_super=\"test\";\n" + -+ "};\n" + -+ "Client {\n" + -+ " org.apache.zookeeper.server.auth.DigestLoginModule required\n" + -+ " username=\"super\"\n" + -+ " password=\"test1\";\n" + // NOTE: wrong password ('test' != 'test1') : this is to test SASL authentication failure. -+ "};" + "\n"); -+ fwriter.close(); -+ System.setProperty("java.security.auth.login.config",saslConfFile.getAbsolutePath()); -+ } -+ catch (IOException e) { -+ // could not create tmp directory to hold JAAS conf file. -+ } -+ } -+ -+ private AtomicInteger authFailed = new AtomicInteger(0); -+ -+ @Override -+ protected TestableZooKeeper createClient(String hp) -+ throws IOException, InterruptedException -+ { -+ MyWatcher watcher = new MyWatcher(); -+ return createClient(watcher, hp); -+ } -+ -+ private class MyWatcher extends CountdownWatcher { -+ @Override -+ public synchronized void process(WatchedEvent event) { -+ if (event.getState() == KeeperState.AuthFailed) { -+ synchronized(authFailed) { -+ authFailed.incrementAndGet(); -+ authFailed.notify(); -+ } -+ } -+ else { -+ super.process(event); -+ } -+ } -+ } -+ -+ @Test -+ public void testBadSaslAuthNotifiesWatch() throws Exception { -+ ZooKeeper zk = createClient(); -+ // wait for authFailed event from client's EventThread. -+ synchronized(authFailed) { -+ authFailed.wait(); -+ } -+ Assert.assertEquals(authFailed.get(),1); -+ zk.close(); -+ } -+} -diff --git src/java/test/org/apache/zookeeper/test/SaslAuthFailTest.java src/java/test/org/apache/zookeeper/test/SaslAuthFailTest.java -index 1589b1f..33a505e 100644 ---- src/java/test/org/apache/zookeeper/test/SaslAuthFailTest.java -+++ src/java/test/org/apache/zookeeper/test/SaslAuthFailTest.java -@@ -59,43 +59,6 @@ public class SaslAuthFailTest extends ClientBase { - // could not create tmp directory to hold JAAS conf file. - } - } -- -- private AtomicInteger authFailed = new AtomicInteger(0); -- -- @Override -- protected TestableZooKeeper createClient(String hp) -- throws IOException, InterruptedException -- { -- MyWatcher watcher = new MyWatcher(); -- return createClient(watcher, hp); -- } -- -- private class MyWatcher extends CountdownWatcher { -- @Override -- public synchronized void process(WatchedEvent event) { -- if (event.getState() == KeeperState.AuthFailed) { -- synchronized(authFailed) { -- authFailed.incrementAndGet(); -- authFailed.notify(); -- } -- } -- else { -- super.process(event); -- } -- } -- } -- -- @Test -- public void testBadSaslAuthNotifiesWatch() throws Exception { -- ZooKeeper zk = createClient(); -- // wait for authFailed event from client's EventThread. -- synchronized(authFailed) { -- authFailed.wait(); -- } -- Assert.assertEquals(authFailed.get(),1); -- zk.close(); -- } -- - - @Test - public void testAuthFail() throws Exception { diff --git a/mt_adaptor.c.patch b/mt_adaptor.c.patch deleted file mode 100644 index 4b230d2..0000000 --- a/mt_adaptor.c.patch +++ /dev/null @@ -1,32 +0,0 @@ -Index: src/c/src/mt_adaptor.c -=================================================================== ---- src/c/src/mt_adaptor.c (revision 1447974) -+++ src/c/src/mt_adaptor.c (working copy) -@@ -484,25 +484,9 @@ - int32_t fetch_and_add(volatile int32_t* operand, int incr) - { - #ifndef WIN32 -- int32_t result; -- asm __volatile__( -- "lock xaddl %0,%1\n" -- : "=r"(result), "=m"(*(int *)operand) -- : "0"(incr) -- : "memory"); -- return result; -+ return __sync_fetch_and_add(operand, incr); - #else -- volatile int32_t result; -- _asm -- { -- mov eax, operand; //eax = v; -- mov ebx, incr; // ebx = i; -- mov ecx, 0x0; // ecx = 0; -- lock xadd dword ptr [eax], ecx; -- lock xadd dword ptr [eax], ebx; -- mov result, ecx; // result = ebx; -- } -- return result; -+ return InterlockedExchangeAdd(operand, incr); - #endif - } - diff --git a/zkEnv.sh b/zkEnv.sh new file mode 100755 index 0000000..122a948 --- /dev/null +++ b/zkEnv.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +# This script should be sourced into other zookeeper +# scripts to setup the env variables + +# We use ZOOCFGDIR if defined, +# otherwise we use /etc/zookeeper +# or the conf directory that is +# a sibling of this script's directory + +ZOOBINDIR="${ZOOBINDIR:-/usr/bin}" +ZOOKEEPER_PREFIX="${ZOOBINDIR}/.." +ZOOCFGDIR="/etc/zookeeper" + +if [ -f "${ZOOCFGDIR}/zookeeper-env.sh" ]; then + . "${ZOOCFGDIR}/zookeeper-env.sh" +fi + +if [ "x$ZOOCFG" = "x" ] +then + ZOOCFG="zoo.cfg" +fi + +ZOOCFG="$ZOOCFGDIR/$ZOOCFG" + +if [ -f "$ZOOCFGDIR/java.env" ] +then + . "$ZOOCFGDIR/java.env" +fi + +if [ "x${ZOO_LOG_DIR}" = "x" ] +then + ZOO_LOG_DIR="." +fi + +if [ "x${ZOO_LOG4J_PROP}" = "x" ] +then + ZOO_LOG4J_PROP="INFO,CONSOLE" +fi + +if [ "$JAVA_HOME" != "" ]; then + JAVA="$JAVA_HOME/bin/java" +else + JAVA=java +fi + +## TSTCLAIR: TODO +# + +#add the zoocfg dir to classpath +CLASSPATH="$ZOOCFGDIR:$CLASSPATH" + +for i in "$ZOOBINDIR"/../src/java/lib/*.jar +do + CLASSPATH="$i:$CLASSPATH" +done + +#make it work in the binary package +#(use array for LIBPATH to account for spaces within wildcard expansion) +if [ -e "${ZOOKEEPER_PREFIX}"/share/zookeeper/zookeeper-*.jar ]; then + LIBPATH=("${ZOOKEEPER_PREFIX}"/share/zookeeper/*.jar) +else + #release tarball format + for i in "$ZOOBINDIR"/../zookeeper-*.jar + do + CLASSPATH="$i:$CLASSPATH" + done + LIBPATH=("${ZOOBINDIR}"/../lib/*.jar) +fi + +for i in "${LIBPATH[@]}" +do + CLASSPATH="$i:$CLASSPATH" +done + +#echo "CLASSPATH=$CLASSPATH" diff --git a/zookeeper-3.4.4-build.patch b/zookeeper-3.4.4-build.patch deleted file mode 100644 index b6e2380..0000000 --- a/zookeeper-3.4.4-build.patch +++ /dev/null @@ -1,449 +0,0 @@ -diff -Nru zookeeper-3.4.4/build.xml zookeeper-3.4.4-gil/build.xml ---- zookeeper-3.4.4/build.xml 2012-09-17 10:34:37.000000000 +0200 -+++ zookeeper-3.4.4-gil/build.xml 2012-10-12 17:51:43.676211458 +0200 -@@ -36,7 +36,7 @@ - - - -- -+ - - - -@@ -89,46 +89,28 @@ - - - -- -- -- -- -- - - - - - -- -- -+ value="file:/usr/share/java/" /> -+ -+ - - - - - -- -- - - - -- -- -- -- -- -- - - - - - - -- -- - - - -@@ -198,7 +180,6 @@ - - - -- - - - -@@ -225,7 +206,7 @@ - - - -- -+ - - - -@@ -312,8 +293,8 @@ - - -- -+ - - - -@@ -329,32 +310,20 @@ - - - -+ pattern="${ivy.lib}/[artifact].[ext]"/> - - - - -+ pattern="${ivy.test.lib}/[artifact].[ext]"/> - - - - -- -- -- -- -- -- -- -- -- -- -+ pattern="${ivy.package.lib}/[artifact].[ext]"/> - - -- -+ - - -@@ -498,7 +467,6 @@ - - - -- - - - -@@ -541,7 +509,6 @@ - - - -- - - - -@@ -634,7 +601,7 @@ - - - - - -@@ -733,7 +700,7 @@ - - - - - -@@ -1094,9 +1061,6 @@ - - - -- -- -- - - - -@@ -1260,7 +1224,6 @@ - - - -- - - - -@@ -1304,50 +1267,6 @@ - - - -- -- -- -- -- -- -- -- -- -- -- -- -- -- Clover not found. Code coverage reports disabled. -- -- -- -- -- -- ################################################################## -- Clover not found. -- Please make sure clover.jar is in ANT_HOME/lib, or made available -- to Ant using other mechanisms like -lib or CLASSPATH. -- ################################################################## -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -@@ -1356,11 +1275,11 @@ - - - -+ classpath="${ivy.lib}/ant/ant-findbugs.jar" /> - - -- -+ - - - -@@ -1369,7 +1288,7 @@ - - - -- -+ - - - -@@ -1479,51 +1398,6 @@ - - - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -diff -Nru zookeeper-3.4.4/ivysettings.xml zookeeper-3.4.4-gil/ivysettings.xml ---- zookeeper-3.4.4/ivysettings.xml 2012-09-17 10:34:37.000000000 +0200 -+++ zookeeper-3.4.4-gil/ivysettings.xml 2012-10-12 17:02:35.706545077 +0200 -@@ -18,13 +18,13 @@ - --> - - -+ value="file:///usr/share/java/" override="false"/> - -+ value="file:///usr/share/java/" override="false"/> - -+ value="file:///usr/share/java/" override="false"/> - -+ value="[module]"/> - - - -diff -Nru zookeeper-3.4.4/ivy.xml zookeeper-3.4.4-gil/ivy.xml ---- zookeeper-3.4.4/ivy.xml 2012-09-17 10:34:37.000000000 +0200 -+++ zookeeper-3.4.4-gil/ivy.xml 2012-10-12 17:41:46.216338834 +0200 -@@ -39,36 +39,36 @@ - - - -- -- -+ -+ - - -- -- -+ -+ - -- -- -- -+ - -- -+ - -- -- -+ -- - -- -- - -- -+ - -+ rev="" conf="releaseaudit->default"/> - -+ rev="" conf="releaseaudit->default"/--> - - - diff --git a/zookeeper-3.4.5-build-contrib.patch b/zookeeper-3.4.5-build-contrib.patch deleted file mode 100644 index 8e988aa..0000000 --- a/zookeeper-3.4.5-build-contrib.patch +++ /dev/null @@ -1,133 +0,0 @@ -diff -Nru zookeeper-3.4.5/src/contrib/build-contrib.xml zookeeper-3.4.5-gil/src/contrib/build-contrib.xml ---- zookeeper-3.4.5/src/contrib/build-contrib.xml 2012-09-30 19:53:32.000000000 +0200 -+++ zookeeper-3.4.5-gil/src/contrib/build-contrib.xml 2013-04-27 11:51:59.684011892 +0200 -@@ -43,9 +43,9 @@ - - - -+ value="file:/usr/share/java/" /> - -- -+ - - - -@@ -70,24 +70,17 @@ - - - -- -- -- -- -+ -+ -+ -+ -+ -+ -+ -+ - -- -- -- -- -- -- -- -- -- -- -- -- -- -+ -+ - - - -@@ -103,7 +96,7 @@ - - - -- -+ - - - -@@ -133,7 +126,7 @@ - - - - -@@ -233,15 +226,9 @@ - - - -- -- - - - -- - - - -diff -Nru zookeeper-3.4.5/src/contrib/zooinspector/build.xml zookeeper-3.4.5-gil/src/contrib/zooinspector/build.xml ---- zookeeper-3.4.5/src/contrib/zooinspector/build.xml 2012-09-30 19:53:32.000000000 +0200 -+++ zookeeper-3.4.5-gil/src/contrib/zooinspector/build.xml 2013-04-27 11:42:13.257105341 +0200 -@@ -20,7 +20,7 @@ - - - -- -+ - - - -@@ -37,11 +37,11 @@ - - - -- -+ - - - -- -+ - - - -@@ -55,7 +55,6 @@ - - - -- - - - -@@ -140,12 +139,12 @@ - - - -- -+ - - - diff --git a/zookeeper-3.4.5-log4j.patch b/zookeeper-3.4.5-log4j.patch deleted file mode 100644 index a513ef3..0000000 --- a/zookeeper-3.4.5-log4j.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/conf/log4j.properties 2012-09-30 12:53:31.000000000 -0500 -+++ b/conf/log4j.properties 2013-06-25 12:28:56.833948571 -0500 -@@ -1,10 +1,11 @@ - # Define some default values that can be overridden by system properties --zookeeper.root.logger=INFO, CONSOLE -+zookeeper.root.logger=INFO, SYSTEMD - zookeeper.console.threshold=INFO --zookeeper.log.dir=. -+zookeeper.systemd.threshold=INFO -+zookeeper.log.dir=/var/log/zookeeper - zookeeper.log.file=zookeeper.log - zookeeper.log.threshold=DEBUG --zookeeper.tracelog.dir=. -+zookeeper.tracelog.dir=/var/log/zookeeper - zookeeper.tracelog.file=zookeeper_trace.log - - # -@@ -56,3 +57,8 @@ - log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout - ### Notice we are including log4j's NDC here (%x) - log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L][%x] - %m%n -+ -+log4j.appender.SYSTEMD=org.apache.log4j.ConsoleAppender -+log4j.appender.SYSTEMD.Threshold=${zookeeper.systemd.threshold} -+log4j.appender.SYSTEMD.layout=org.apache.log4j.PatternLayout -+log4j.appender.SYSTEMD.layout.ConversionPattern=[myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n diff --git a/zookeeper-3.4.6-ivy-build.patch b/zookeeper-3.4.6-ivy-build.patch new file mode 100644 index 0000000..437bd48 --- /dev/null +++ b/zookeeper-3.4.6-ivy-build.patch @@ -0,0 +1,52 @@ +diff --git a/build.xml b/build.xml +index 442d52e..bc1f4a2 100644 +--- a/build.xml ++++ b/build.xml +@@ -257,7 +257,7 @@ xmlns:maven="antlib:org.apache.maven.artifact.ant"> + + + +- ++ + + + +@@ -343,9 +343,9 @@ xmlns:maven="antlib:org.apache.maven.artifact.ant"> + + + +- ++ includes="ivy.jar" excludes="ivy.jar"/> ++ + + + +diff --git a/src/contrib/build-contrib.xml b/src/contrib/build-contrib.xml +index 0e57d08..708f64f 100644 +--- a/src/contrib/build-contrib.xml ++++ b/src/contrib/build-contrib.xml +@@ -103,7 +103,7 @@ + + + +- ++ + + + +@@ -219,9 +219,9 @@ + + + +- ++ includes="ivy.jar" excludes="ivy.jar"/> ++ + + + diff --git a/zookeeper.service b/zookeeper.service index 5cdb4b2..db4b2c9 100644 --- a/zookeeper.service +++ b/zookeeper.service @@ -6,17 +6,12 @@ ConditionPathExists=/etc/zookeeper/log4j.properties ConditionPathExists=/var/lib/zookeeper/data/myid [Service] -Type=simple +Type=forking User=zookeeper SyslogIdentifier=zookeeper WorkingDirectory=/var/lib/zookeeper - -#UMask=0027 -#Environment="CP=/etc/zookeeper:/usr/share/java/slf4j/slf4j-log4j12.jar:/usr/share/java/slf4j/slf4j-api.jar:/usr/share/java/netty.jar:/usr/share/java/log4j.jar:/usr/share/java/jline.jar:/usr/share/java/zookeeper/zookeeper.jar" -#Environment="IPv6=-Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true" -#Environment="JMX=-Dcom.sun.management.jmxremote" - -ExecStart=/usr/lib/jvm/jre-1.7.0/bin/java -cp $CP $JMX $IPv6 org.apache.zookeeper.server.quorum.QuorumPeerMain /etc/zookeeper/zoo.cfg +ExecStart=/usr/bin/zkServer.sh +#ExecStop= [Install] WantedBy=multi-user.target diff --git a/zookeeper.spec b/zookeeper.spec index 22b600d..ccde1b0 100644 --- a/zookeeper.spec +++ b/zookeeper.spec @@ -1,24 +1,22 @@ %global commit 601207e1151b2691112c431fc3b4130a85ac93b5 -%global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global shortcommit %(c=%{commit}; echo ${c:0:7}) %global _hardened_build 1 +%global skiptests 1 Name: zookeeper Version: 3.4.6 Release: 1%{?dist} Summary: A high-performance coordination service for distributed applications -#Group: Development/Libraries License: ASL 2.0 and BSD URL: http://zookeeper.apache.org/ Source0: https://github.com/apache/zookeeper/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz Source1: %{name}-ZooInspector-template.pom Source2: %{name}.service +Source3: zkEnv.sh Patch1: %{name}-3.4.5-zktreeutil-gcc.patch Patch2: %{name}-3.4.6-ivy-build.patch - -#Patch2: %{name}-3.4.5-log4j.patch -#Patch2: %{name}-3.4.5-build-contrib.patch -#Patch5: %{name}-3.4.5-add-PIE-and-RELRO.patch +#Patch3: {name}-3.4.5-add-PIE-and-RELRO.patch BuildRequires: autoconf BuildRequires: automake @@ -43,8 +41,11 @@ BuildRequires: checkstyle BuildRequires: jline1 BuildRequires: jtoaster BuildRequires: junit -#BuildRequires: log4j12 -BuildRequires: log4j +%if 0%{?fedora} >= 21 +BuildRequires: mvn(org.slf4j:slf4j-log4j12) +%else +BuildRequires: mvn(log4j:log4j) +%endif BuildRequires: json_simple BuildRequires: mockito @@ -55,37 +56,6 @@ BuildRequires: xml-commons-apis BuildRequires: systemd -%description -ZooKeeper is a centralized service for maintaining configuration information, -naming, providing distributed synchronization, and providing group services. - -%package lib -Summary: Zookeeper C client library -#Group: System Environment/Libraries - -%description lib -ZooKeeper C client library for communicating with ZooKeeper Server. - -%package lib-devel -Summary: Development files for the %{name} library -#Group: Development/Libraries -Requires: %{name}-lib%{?_isa} = %{version}-%{release} - -%description lib-devel -Development files for the ZooKeeper C client library. - -%package lib-doc -Summary: Documentation for the %{name} library -#Group: Documentation -BuildArch: noarch - -%description lib-doc -Documentation for the ZooKeeper C client library. - -%package java -#Group: Development/Libraries -Summary: Zookeeper Java client library - Requires: checkstyle Requires: jline1 Requires: jtoaster @@ -94,56 +64,41 @@ Requires: log4j Requires: mockito Requires: netty3 Requires: slf4j - Requires: java Requires: jpackage-utils -BuildArch: noarch -%description java -This package provides a Java client interface to Zookeeper server. +%description +ZooKeeper is a centralized service for maintaining configuration information, +naming, providing distributed synchronization, and providing group services. + +%package devel +Summary: Development files for the %{name} library +Requires: %{name}-lib%{?_isa} = %{version}-%{release} + +%description devel +Development files for the ZooKeeper C client library. %package javadoc -#Group: Documentation Summary: Javadoc for %{name} -BuildArch: noarch %description javadoc This package contains javadoc for %{name}. -%package -n python-ZooKeeper -#Group: Development/Libraries -Summary: ZooKeeper python binding library +%package -n python-%{name} +Summary: Python support for %{name} Requires: %{name}-lib%{?_isa} = %{version}-%{release} Provides: zkpython%{?_isa} = %{version}-%{release} +Requires: python2 -%description -n python-ZooKeeper -ZooKeeper python binding library - -%package server -#Group: System Environment/Daemons -Summary: ZooKeeper server -Requires: %{name}-java = %{version}-%{release} -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd -Requires(pre): shadow-utils -BuildArch: noarch - -%description server -ZooKeeper server +%description -n python-%{name} +The python-%{name} package contains Python bindings for %{name}. %prep %setup -q -n %{name}-%{commit} %patch1 -p0 %patch2 -p1 -#%patch3 -p1 -#%patch4 -p1 - -# - -#cp -p %{SOURCE1} dist-maven/%{name}-%{version}-ZooInspector.pom -#sed -i "s|@version@|%{version}|" dist-maven/%{name}-%{version}-ZooInspector.pom +#%%patch3 -p1 iconv -f iso8859-1 -t utf-8 src/c/ChangeLog > src/c/ChangeLog.conv && mv -f src/c/ChangeLog.conv src/c/ChangeLog sed -i 's/\r//' src/c/ChangeLog @@ -159,50 +114,54 @@ sed -i 's@^dataDir=.*$@dataDir=%{_sharedstatedir}/zookeeper/data\ndataLogDir=%{_ -Djavadoc.link.java=%{_javadocdir}/java \ -Dant.build.javac.source=1.5 \ -Dant.build.javac.target=1.5 \ --Ddist.dir=%{buildroot} \ -package-native +package -#Compile zktreeutil -# TODO - determine why it's not part of the default build -pushd src/contrib/zktreeutil -rm -rf autom4te.cache +pushd src/c autoreconf -if %configure %{__make} %{?_smp_mflags} popd +## TODO: install utilities? + %check -%ant -Divy.mode=local \ -test +%if %skiptests + echo "Testing disabled, please enable in mock" +%else + %ant -Divy.mode=local test +%endif %install +#install the c tools +pushd src/c +%make_install +popd + +# install the java dependencies. mkdir -p %{buildroot}%{_javadir}/%{name} install -pm 644 build/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}/%{name}.jar install -pm 644 build/%{name}-%{version}-test.jar %{buildroot}%{_javadir}/%{name}/%{name}-tests.jar install -pm 644 build/contrib/ZooInspector/%{name}-%{version}-ZooInspector.jar %{buildroot}%{_javadir}/%{name}/%{name}-ZooInspector.jar +install -pm 755 bin/zkCleanup.sh %{buildroot}%{_bindir} +install -pm 755 bin/zkCli.sh %{buildroot}%{_bindir} +install -pm 755 bin/zkServer.sh %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_libexecdir} +install -pm 755 %{SOURCE3} %{buildroot}%{_libexecdir} + +%if 0%{?fedora} >= 21 +mkdir -p %{buildroot}%{_datadir}/maven-metadata +mkdir -p %{buildroot}%{_datadir}/maven-poms/%{name} + +%add_maven_depmap %{name}-%{name}.pom %{name}/%{name}.jar +%add_maven_depmap org.apache.zookeeper:zookeeper::tests:%{version} %{name}/%{name}-tests.jar + +install -pm 644 %{SOURCE1} %{buildroot}%{_datadir}/maven-poms/%{name}/%{name}-%{name}-ZooInspector.pom +sed -i "s|@version@|%{version}|" %{buildroot}%{_datadir}/maven-poms/%{name}/%{name}-%{name}-ZooInspector.pom +%add_maven_depmap %{name}-%{name}-ZooInspector.pom %{name}/%{name}-ZooInspector.jar +%else mkdir -p %{buildroot}%{_mavenpomdir} -install -pm 644 build/%{name}-%{version}/dist-maven/%{name}.pom %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}.pom - -#################################################### -# we will need to do our pom cleanup here. -#%pom_remove_dep org.vafer:jdeb dist-maven/%{name}-%{version}.pom -# jdiff task deps -#%pom_remove_dep jdiff:jdiff dist-maven/%{name}-%{version}.pom -#%pom_remove_dep xerces:xerces dist-maven/%{name}-%{version}.pom -# rat-lib task deps -#%pom_remove_dep org.apache.rat:apache-rat-tasks dist-maven/%{name}-%{version}.pom -#%pom_remove_dep commons-collections:commons-collections dist-maven/%{name}-%{version}.pom -#%pom_remove_dep commons-lang:commons-lang dist-maven/%{name}-%{version}.pom - -#sed -i "s|0.9.94|1.0|" dist-maven/%{name}-%{version}.pom -#sed -i "s|3.2.2.Final|3.6.6.Final|" dist-maven/%{name}-%{version}.pom -#sed -i "s|org.jboss.netty|io.netty|" dist-maven/%{name}-%{version}.pom - -#sed -i "s|pom|jar|" dist-maven/%{name}-%{version}.pom -#sed -i "s|checkstyle|com.puppycrawl.tools|" dist-maven/%{name}-%{version}.pom -#sed -i "s|mockito-all|mockito-core|" dist-maven/%{name}-%{version}.pom -#################################################### +install -pm 644 build/%{name}-%{version}/dist-maven/%{name}-%{version}.pom %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}.pom %add_maven_depmap JPP.%{name}-%{name}.pom %{name}/%{name}.jar %add_maven_depmap org.apache.zookeeper:zookeeper::tests:%{version} %{name}/%{name}-tests.jar @@ -211,26 +170,19 @@ install -pm 644 %{SOURCE1} %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-ZooIn sed -i "s|@version@|%{version}|" %{buildroot}%{_mavenpomdir}/JPP.%{name}-%{name}-ZooInspector.pom %add_maven_depmap JPP.%{name}-%{name}-ZooInspector.pom %{name}/%{name}-ZooInspector.jar +%endif + mkdir -p %{buildroot}%{_javadocdir}/%{name} cp -pr build/docs/api/* %{buildroot}%{_javadocdir}/%{name}/ -#pushd build/c -#%{__make} install DESTDIR=%{buildroot} -# cleanup -#rm -f docs/html/*.map -#popd - -#pushd src/contrib/zktreeutil -#%{__make} install DESTDIR=%{buildroot} -#popd - -pushd build/contrib/zkpython +pushd src/contrib/zkpython %{__python} src/python/setup.py build --build-base=$PWD/build \ install --root=%{buildroot} ;\ chmod 0755 %{buildroot}%{python_sitearch}/zookeeper.so popd find %{buildroot} -name '*.la' -exec rm -f {} ';' +find %{buildroot} -name '*.a' -exec rm -f {} ';' mkdir -p %{buildroot}%{_unitdir} mkdir -p %{buildroot}%{_sysconfdir}/zookeeper @@ -244,68 +196,45 @@ install -p -m 0640 conf/zoo_sample.cfg %{buildroot}%{_sysconfdir}/zookeeper touch %{buildroot}%{_sysconfdir}/zookeeper/zoo.cfg touch %{buildroot}%{_sharedstatedir}/zookeeper/data/myid -# TODO -# bin/zkCleanup.sh -# bin/zkCli.sh -# bin/zkEnv.sh - -%post lib -p /sbin/ldconfig -%postun lib -p /sbin/ldconfig - -%pre server +%pre getent group zookeeper >/dev/null || groupadd -r zookeeper getent passwd zookeeper >/dev/null || \ useradd -r -g zookeeper -d %{_sharedstatedir}/zookeeper -s /sbin/nologin \ -c "ZooKeeper service account" zookeeper -%post server -%systemd_post zookeeper.service -%preun server +%post +%systemd_post zookeeper.service +/sbin/ldconfig + +%preun %systemd_preun zookeeper.service -%postun server +%postun %systemd_postun_with_restart zookeeper.service +/sbin/ldconfig %files %{_bindir}/cli_mt %{_bindir}/cli_st %{_bindir}/load_gen -%{_bindir}/zktreeutil -%doc src/c/ChangeLog src/c/LICENSE src/c/NOTICE.txt src/c/README src/contrib/zktreeutil/README.txt - -%files lib +%{_bindir}/zk*.sh +%{_libexecdir}/zkEnv.sh %{_libdir}/lib*.so.* -%doc src/c/LICENSE src/c/NOTICE.txt - -%files lib-devel -%dir %{_includedir}/%{name} -%{_includedir}/%{name}/*.h -%{_libdir}/*.so -%doc src/c/LICENSE src/c/NOTICE.txt - -%files lib-doc -%doc src/c/LICENSE src/c/NOTICE.txt src/c/docs/html/* - -%files java %dir %{_javadir}/%{name} %{_javadir}/%{name}/%{name}.jar %{_javadir}/%{name}/%{name}-tests.jar %{_javadir}/%{name}/%{name}-ZooInspector.jar + +%if 0%{?fedora} >= 21 +%{_datadir}/maven-poms/%{name}/%{name}-%{name}.pom +%{_datadir}/maven-poms/%{name}/%{name}-%{name}-ZooInspector.pom +%{_datadir}/maven-metadata/%{name}.xml +%else +%{_mavendepmapfragdir}/%{name} %{_mavenpomdir}/JPP.%{name}-%{name}.pom %{_mavenpomdir}/JPP.%{name}-%{name}-ZooInspector.pom -%{_mavendepmapfragdir}/%{name} -%doc CHANGES.txt LICENSE.txt NOTICE.txt README.txt +%endif -%files javadoc -%{_javadocdir}/%{name} -%doc LICENSE.txt NOTICE.txt - -%files -n python-ZooKeeper -%{python_sitearch}/ZooKeeper-?.?-py%{python_version}.egg-info -%{python_sitearch}/zookeeper.so -%doc LICENSE.txt NOTICE.txt src/contrib/zkpython/README - -%files server %attr(0755,root,root) %dir %{_sysconfdir}/zookeeper %attr(0644,root,root) %ghost %config(noreplace) %{_sysconfdir}/zookeeper/zoo.cfg %attr(0644,root,root) %{_sysconfdir}/zookeeper/zoo_sample.cfg @@ -317,8 +246,27 @@ getent passwd zookeeper >/dev/null || \ %attr(0640,zookeeper,zookeeper) %ghost %{_sharedstatedir}/zookeeper/data/myid %attr(0750,zookeeper,zookeeper) %dir %{_sharedstatedir}/zookeeper/log %{_unitdir}/zookeeper.service +%doc CHANGES.txt LICENSE.txt NOTICE.txt README.txt + +%files devel +%{_includedir}/%{name}/ +%{_libdir}/*.so +%doc src/c/LICENSE src/c/NOTICE.txt + +%files javadoc +%{_javadocdir}/%{name} +%doc LICENSE.txt NOTICE.txt + +%files -n python-%{name} +%{python_sitearch}/ZooKeeper-?.?-py%{python_version}.egg-info +%{python_sitearch}/zookeeper.so +%doc LICENSE.txt NOTICE.txt src/contrib/zkpython/README %changelog +* Wed Oct 8 2014 Timothy St. Clair - 3.4.6-1 +- Update to latest stable series +- Cleanup and overhaul package + * Mon Aug 18 2014 Fedora Release Engineering - 3.4.5-20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild