Skip to content

Commit

Permalink
BIGTOP-317. rename hadoop-zookeeper package into zookeeper
Browse files Browse the repository at this point in the history
  • Loading branch information
rvs authored and Roman Shaposhnik committed Jan 3, 2012
1 parent 9c4d2fc commit 9744615
Show file tree
Hide file tree
Showing 20 changed files with 115 additions and 109 deletions.
12 changes: 6 additions & 6 deletions bigtop-deploy/puppet/modules/hadoop-zookeeper/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@

class hadoop-zookeeper {
define client {
package { "hadoop-zookeeper":
package { "zookeeper":
ensure => latest,
}
}

define server($myid, $ensemble = ["localhost:2888:3888"]) {
package { "hadoop-zookeeper-server":
package { "zookeeper-server":
ensure => latest,
}

service { "hadoop-zookeeper-server":
service { "zookeeper-server":
ensure => running,
require => Package["hadoop-zookeeper-server"],
require => Package["zookeeper-server"],
subscribe => File["/etc/zookeeper/conf/zoo.cfg"],
hasrestart => true,
hasstatus => true,
}

file { "/etc/zookeeper/conf/zoo.cfg":
content => template("hadoop-zookeeper/zoo.cfg"),
require => Package["hadoop-zookeeper-server"],
require => Package["zookeeper-server"],
}

file { "/var/lib/zookeeper/myid":
content => inline_template("<%= myid %>"),
require => Package["hadoop-zookeeper-server"],
require => Package["zookeeper-server"],
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# processname: java
# pidfile: /var/run/zookeeper/zookeeper-server.pid
### BEGIN INIT INFO
# Provides: hadoop-zookeeper-server
# Provides: zookeeper-server
# Required-Start: $network $local_fs
# Required-Stop:
# Should-Start: $named
Expand All @@ -41,7 +41,7 @@ fi
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON_SCRIPT="/usr/bin/zookeeper-server"

NAME=hadoop-zookeeper-server
NAME=zookeeper-server
DESC="ZooKeeper daemon"
PID_FILE=/var/run/zookeeper/zookeeper_server.pid
install -d -m 0755 -o zookeeper -g zookeeper /var/run/zookeeper/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# description: Summary: ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications. Each time they are implemented there is a lot of work that goes into fixing the bugs and race conditions that are inevitable. Because of the difficulty of implementing these kinds of services, applications initially usually skimp on them ,which make them brittle in the presence of change and difficult to manage. Even when done correctly, different implementations of these services lead to management complexity when the applications are deployed.
#
### BEGIN INIT INFO
# Provides: hadoop-zookeeper-server
# Provides: zookeeper-server
# Required-Start: $network $local_fs
# Should-Start: $named
# Required-Stop: $syslog $remote_fs
Expand Down Expand Up @@ -49,7 +49,7 @@ ERROR_PROGRAM_NOT_INSTALLED=5

RETVAL=0
EXEC_PATH="/usr/bin/zookeeper-server"
NAME=hadoop-zookeeper-server
NAME=zookeeper-server
DESC="$NAME"
PIDFILE=/var/run/zookeeper/zookeeper_server.pid
LOCKFILE="/var/lock/subsys/zookeeper"
Expand Down
2 changes: 1 addition & 1 deletion bigtop-packages/src/common/zookeeper/zookeeper.1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ these services lead to management complexity when the applications are deployed.

For more information about ZooKeeper, see
.RS 0
http://hadoop.apache.org/zookeeper/.
http://zookeeper.apache.org/.

To find the list of available commands and options for \fBzookeeper-client\fR type:
\fBzookeeper-client help\fR
Expand Down
2 changes: 1 addition & 1 deletion bigtop-packages/src/deb/flume/control
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Homepage: http://incubator.apache.org/projects/flume.html

Package: flume
Architecture: all
Depends: hadoop-zookeeper (>= 3.3.1), adduser, hadoop, bigtop-utils
Depends: zookeeper (>= 3.3.1), adduser, hadoop, bigtop-utils
Description: reliable, scalable, and manageable distributed data collection application
Flume is a reliable, scalable, and manageable distributed data collection
application for collecting data such as logs and delivering it to data stores
Expand Down
2 changes: 1 addition & 1 deletion bigtop-packages/src/deb/hbase/control
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Homepage: http://hbase.apache.org/

Package: hadoop-hbase
Architecture: all
Depends: adduser, hadoop-zookeeper (>= 3.3.1), hadoop, bigtop-utils
Depends: adduser, zookeeper (>= 3.3.1), hadoop, bigtop-utils
Recommends: ntp
Description: HBase is the Hadoop database
Use it when you need random, realtime read/write access to your Big Data.
Expand Down
10 changes: 4 additions & 6 deletions bigtop-packages/src/deb/zookeeper/control
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,21 @@
# 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.
Source: hadoop-zookeeper
Source: zookeeper
Section: misc
Priority: extra
Maintainer: Bigtop <bigtop-dev@incubator.apache.org>
Build-Depends: debhelper (>= 6), ant, ant-optional, autoconf, automake
Standards-Version: 3.8.0
Homepage: http://zookeeper.apache.org/

Package: hadoop-zookeeper
Package: zookeeper
Architecture: all
Conflicts: zookeeper
Replaces: zookeeper
Depends: bigtop-utils
Description: A high-performance coordination service for distributed applications.
ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications. Each time they are implemented there is a lot of work that goes into fixing the bugs and race conditions that are inevitable. Because of the difficulty of implementing these kinds of services, applications initially usually skimp on them ,which make them brittle in the presence of change and difficult to manage. Even when done correctly, different implementations of these services lead to management complexity when the applications are deployed.

Package: hadoop-zookeeper-server
Package: zookeeper-server
Architecture: all
Depends: hadoop-zookeeper (= ${source:Version})
Depends: zookeeper (= ${source:Version})
Description: This runs the zookeeper server on startup.
4 changes: 3 additions & 1 deletion bigtop-packages/src/deb/zookeeper/rules
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export DH_VERBOSE=1
# This has to be exported to make some magic below work.
export DH_OPTIONS

zookeeper_pkg_name=zookeeper

patch: patch-stamp
patch-stamp:
touch $@
Expand All @@ -32,7 +34,7 @@ clean:
dh_testroot
rm -f *-stamp
dh_clean
rm -Rf debian/tmp debian/hadoop-zookeeper debian/zookeeper
rm -Rf debian/tmp debian/$(zookeeper_pkg_name)
find debian -name .\*swp -exec rm -f {} \;

build-indep: build-indep-stamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# processname: java
# pidfile: /var/run/zookeeper/zookeeper-server.pid
### BEGIN INIT INFO
# Provides: hadoop-zookeeper-server
# Provides: zookeeper-server
# Required-Start: $network $local_fs
# Required-Stop:
# Should-Start: $named
Expand All @@ -34,7 +34,7 @@ set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON_SCRIPT="/usr/bin/zookeeper-server"

NAME=hadoop-zookeeper-server
NAME=zookeeper-server
DESC="ZooKeeper daemon"
PID_FILE=/var/run/zookeeper/zookeeper_server.pid
install -d -m 0755 -o zookeeper -g zookeeper /var/run/zookeeper/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

# postinst script for zookeeper

zookeeper_pkg_name=zookeeper

set -e

case "$1" in
configure)
# Install config alternatives
update-alternatives --install /etc/zookeeper/conf hadoop-zookeeper-conf /etc/zookeeper/conf.dist 30
update-alternatives --install /etc/${zookeeper_pkg_name}/conf ${zookeeper_pkg_name}-conf /etc/${zookeeper_pkg_name}/conf.dist 30
;;

abort-upgrade|abort-remove|abort-deconfigure)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
#
# see: dh_installdeb(1)

zookeeper_pkg_name=zookeeper

set -e

case "$1" in
remove|upgrade|deconfigure)
update-alternatives --remove hadoop-zookeeper-conf /etc/zookeeper/conf.dist || :
update-alternatives --remove ${zookeeper_pkg_name}-conf /etc/${zookeeper_pkg_name}/conf.dist || :
;;

failed-upgrade)
Expand Down
2 changes: 1 addition & 1 deletion bigtop-packages/src/rpm/flume/SPECS/flume.spec
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Source1: do-component-build
Source2: install_%{name}.sh
Source3: init.d
Source4: init.d.suse
Requires: coreutils, /usr/sbin/useradd, hadoop-zookeeper >= 3.3.1, hadoop >= 0.20.2
Requires: coreutils, /usr/sbin/useradd, zookeeper >= 3.3.1, hadoop >= 0.20.2
Requires: bigtop-utils
BuildRequires: ant xml-commons xml-commons-apis

Expand Down
2 changes: 1 addition & 1 deletion bigtop-packages/src/rpm/hbase/SPECS/hbase.spec
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Source5: hbase.default
Source6: hbase.nofiles.conf
BuildArch: noarch
Requires: coreutils, /usr/sbin/useradd, /sbin/chkconfig, /sbin/service
Requires: hadoop >= 0.20.2, hadoop-zookeeper >= 3.3.1, bigtop-utils
Requires: hadoop >= 0.20.2, zookeeper >= 3.3.1, bigtop-utils

%if 0%{?mgaversion}
Requires: bsh-utils
Expand Down
52 changes: 27 additions & 25 deletions bigtop-packages/src/rpm/zookeeper/SPECS/zookeeper.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
# 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.
%define etc_zookeeper /etc/zookeeper
%define etc_zookeeper /etc/%{name}
%define bin_zookeeper %{_bindir}
%define lib_zookeeper /usr/lib/zookeeper
%define log_zookeeper /var/log/zookeeper
%define run_zookeeper /var/run/zookeeper
%define lib_zookeeper /usr/lib/%{name}
%define log_zookeeper /var/log/%{name}
%define run_zookeeper /var/run/%{name}
%define vlb_zookeeper /var/lib/%{name}
%define svc_zookeeper %{name}-server
%define man_dir %{_mandir}

%if %{?suse_version:1}0
Expand All @@ -37,7 +39,7 @@
%{nil}


%define doc_zookeeper %{_docdir}/zookeeper
%define doc_zookeeper %{_docdir}/%{name}
%define alternatives_cmd update-alternatives
%define alternatives_dep update-alternatives
%define chkconfig_dep aaa_base
Expand All @@ -46,7 +48,7 @@

%else

%define doc_zookeeper %{_docdir}/zookeeper-%{zookeeper_version}
%define doc_zookeeper %{_docdir}/%{name}-%{zookeeper_version}
%define alternatives_cmd alternatives
%define alternatives_dep chkconfig
%define chkconfig_dep chkconfig
Expand All @@ -57,19 +59,19 @@



Name: hadoop-zookeeper
Name: zookeeper
Version: %{zookeeper_version}
Release: %{zookeeper_release}
Summary: A high-performance coordination service for distributed applications.
URL: http://hadoop.apache.org/zookeeper/
URL: http://zookeeper.apache.org/
Group: Development/Libraries
Buildroot: %{_topdir}/INSTALL/%{name}-%{version}
License: APL2
Source0: zookeeper-%{zookeeper_patched_version}.tar.gz
Source0: %{name}-%{zookeeper_patched_version}.tar.gz
Source1: do-component-build
Source2: install_zookeeper.sh
Source3: hadoop-zookeeper.sh
Source4: hadoop-zookeeper.sh.suse
Source3: zookeeper-server.sh
Source4: zookeeper-server.sh.suse
Source5: zookeeper.1
Source6: zoo.cfg
BuildArch: noarch
Expand All @@ -92,8 +94,8 @@ difficult to manage. Even when done correctly, different implementations of thes
%package server
Summary: The Hadoop Zookeeper server
Group: System/Daemons
Provides: hadoop-zookeeper-server
Requires: hadoop-zookeeper = %{version}-%{release}
Provides: %{svc_zookeeper}
Requires: %{name} = %{version}-%{release}
Requires(post): %{chkconfig_dep}
Requires(preun): %{service_dep}, %{chkconfig_dep}
BuildArch: noarch
Expand All @@ -120,7 +122,7 @@ Requires: redhat-lsb
This package starts the zookeeper server on startup

%prep
%setup -n zookeeper-%{zookeeper_patched_version}
%setup -n %{name}-%{zookeeper_patched_version}

%build
env FULL_VERSION=%{zookeeper_patched_version} bash %{SOURCE1}
Expand All @@ -129,19 +131,19 @@ env FULL_VERSION=%{zookeeper_patched_version} bash %{SOURCE1}
%__rm -rf $RPM_BUILD_ROOT
cp $RPM_SOURCE_DIR/zookeeper.1 $RPM_SOURCE_DIR/zoo.cfg .
sh %{SOURCE2} \
--build-dir=build/zookeeper-%{zookeeper_patched_version} \
--build-dir=build/%{name}-%{zookeeper_patched_version} \
--doc-dir=%{doc_zookeeper} \
--prefix=$RPM_BUILD_ROOT


%if %{?suse_version:1}0
orig_init_file=$RPM_SOURCE_DIR/hadoop-zookeeper.sh.suse
orig_init_file=%{SOURCE4}
%else
orig_init_file=$RPM_SOURCE_DIR/hadoop-zookeeper.sh
orig_init_file=%{SOURCE3}
%endif

%__install -d -m 0755 $RPM_BUILD_ROOT/%{initd_dir}/
init_file=$RPM_BUILD_ROOT/%{initd_dir}/hadoop-zookeeper-server
init_file=$RPM_BUILD_ROOT/%{initd_dir}/%{svc_zookeeper}
%__cp $orig_init_file $init_file
chmod 755 $init_file

Expand All @@ -151,34 +153,34 @@ getent group zookeeper >/dev/null || groupadd -r zookeeper
getent passwd zookeeper > /dev/null || useradd -c "ZooKeeper" -s /sbin/nologin -g zookeeper -r -d %{run_zookeeper} zookeeper 2> /dev/null || :

%__install -d -o zookeeper -g zookeeper -m 0755 %{run_zookeeper}
%__install -d -o zookeeper -g zookeeper -m 0755 /var/log/zookeeper
%__install -d -o zookeeper -g zookeeper -m 0755 %{log_zookeeper}

# Manage configuration symlink
%post
%{alternatives_cmd} --install %{etc_zookeeper}/conf %{name}-conf %{etc_zookeeper}/conf.dist 30
%__install -d -o zookeeper -g zookeeper -m 0755 /var/lib/zookeeper
%__install -d -o zookeeper -g zookeeper -m 0755 %{vlb_zookeeper}

%preun
if [ "$1" = 0 ]; then
%{alternatives_cmd} --remove %{name}-conf %{etc_zookeeper}/conf.dist || :
fi

%post server
chkconfig --add hadoop-zookeeper-server
chkconfig --add %{svc_zookeeper}

%preun server
if [ $1 = 0 ] ; then
service hadoop-zookeeper-server stop > /dev/null 2>&1
chkconfig --del hadoop-zookeeper-server
service %{svc_zookeeper} stop > /dev/null 2>&1
chkconfig --del %{svc_zookeeper}
fi

%postun server
if [ $1 -ge 1 ]; then
service hadoop-zookeeper-server condrestart > /dev/null 2>&1
service %{svc_zookeeper} condrestart > /dev/null 2>&1
fi

%files server
%attr(0755,root,root) %{initd_dir}/hadoop-zookeeper-server
%attr(0755,root,root) %{initd_dir}/%{svc_zookeeper}

#######################
#### FILES SECTION ####
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class DEBPackage extends ManagedPackage {

Map<String, String> getDeps() {
Map<String, String> res = [:];
// sample input: sun-java6-jre | sun-java6-sdk, hadoop-zookeeper (= 3.3.1+8), hadoop-0.20 (>= 0.20.2+700)
// sample input: sun-java6-jre | sun-java6-sdk, zookeeper (= 3.3.1+8), hadoop-0.20 (>= 0.20.2+700)
// NOTE: we currently do NOT support alternative specification i.e. sun-java6-jre | sun-java6-sdk
shUser.exec("dpkg -s $name | sed -ne 's#^Depends: ##p'").getOut().join(' ').split(',').each {
def matcher = (it =~ /(\S+)( \(.+\))*/);
Expand Down
Loading

0 comments on commit 9744615

Please sign in to comment.