From c3e54b8c6330b5f7410416213a397a11f10fef7d Mon Sep 17 00:00:00 2001 From: xingweidong Date: Tue, 26 Dec 2017 15:18:09 +0800 Subject: [PATCH 1/2] add storm --- .../src/common/storm/do-component-build | 33 ++++ .../src/common/storm/install_storm.sh | 161 ++++++++++++++++++ .../src/rpm/storm/SPECS/storm.spec | 137 +++++++++++++++ bigtop.bom | 10 ++ 4 files changed, 341 insertions(+) create mode 100755 bigtop-packages/src/common/storm/do-component-build create mode 100755 bigtop-packages/src/common/storm/install_storm.sh create mode 100755 bigtop-packages/src/rpm/storm/SPECS/storm.spec diff --git a/bigtop-packages/src/common/storm/do-component-build b/bigtop-packages/src/common/storm/do-component-build new file mode 100755 index 0000000000..b49cd23646 --- /dev/null +++ b/bigtop-packages/src/common/storm/do-component-build @@ -0,0 +1,33 @@ +#!/bin/sh -x +# 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. + +set -e + +#base_path=`pwd` +#build_support_dir=`echo ${base_path%bigtop*}` + + +. `dirname $0`/bigtop.bom + +mkdir build + +mvn clean install -DskipTests "$@" + +pushd storm-dist/binary/ +mvn package -Dgpg.skip "$@" +popd + +(cd build ; tar --strip-components=1 -xzvf ../storm-dist/binary/target/apache-storm-${STORM_VERSION}.tar.gz) diff --git a/bigtop-packages/src/common/storm/install_storm.sh b/bigtop-packages/src/common/storm/install_storm.sh new file mode 100755 index 0000000000..1917c62d34 --- /dev/null +++ b/bigtop-packages/src/common/storm/install_storm.sh @@ -0,0 +1,161 @@ +#!/bin/sh + +# 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. + +set -xe + +usage() { + echo " +usage: $0 + Required not-so-options: + --build-dir=DIR path to storm dist.dir + --prefix=PREFIX path to install into + + Optional options: + --doc-dir=DIR path to install docs into [/usr/share/doc/storm] + --lib-dir=DIR path to install storm home [/usr/lib/storm] + --installed-lib-dir=DIR path where lib-dir will end up on target system + --bin-dir=DIR path to install bins [/usr/bin] + --examples-dir=DIR path to install examples [doc-dir/examples] + ... [ see source for more similar options ] + " + exit 1 +} + +OPTS=$(getopt \ + -n $0 \ + -o '' \ + -l 'prefix:' \ + -l 'doc-dir:' \ + -l 'lib-dir:' \ + -l 'installed-lib-dir:' \ + -l 'bin-dir:' \ + -l 'examples-dir:' \ + -l 'conf-dir:' \ + -l 'build-dir:' -- "$@") + +if [ $? != 0 ] ; then + usage +fi + +eval set -- "$OPTS" +while true ; do + case "$1" in + --prefix) + PREFIX=$2 ; shift 2 + ;; + --build-dir) + BUILD_DIR=$2 ; shift 2 + ;; + --doc-dir) + DOC_DIR=$2 ; shift 2 + ;; + --lib-dir) + LIB_DIR=$2 ; shift 2 + ;; + --installed-lib-dir) + INSTALLED_LIB_DIR=$2 ; shift 2 + ;; + --bin-dir) + BIN_DIR=$2 ; shift 2 + ;; + --examples-dir) + EXAMPLES_DIR=$2 ; shift 2 + ;; + --conf-dir) + CONF_DIR=$2 ; shift 2 + ;; + --) + shift ; break + ;; + *) + echo "Unknown option: $1" + usage + exit 1 + ;; + esac +done + +for var in PREFIX BUILD_DIR; do + if [ -z "$(eval "echo \$$var")" ]; then + echo Missing param: $var + usage + fi +done + +MAN_DIR=${MAN_DIR:-/usr/share/man/man1} +DOC_DIR=${DOC_DIR:-/usr/share/doc/storm} +LIB_DIR=${LIB_DIR:-/usr/lib/storm} +BIN_DIR=${BIN_DIR:-/usr/lib/storm/bin} +ETC_DIR=${ETC_DIR:-/etc/storm} +CONF_DIR=${CONF_DIR:-${ETC_DIR}/conf.dist} + + +install -d -m 0755 ${PREFIX}/$LIB_DIR/ +install -d -m 0755 ${PREFIX}/$LIB_DIR/lib + +install -d -m 0755 ${PREFIX}/$LIB_DIR/contrib +install -d -m 0755 ${PREFIX}/$LIB_DIR/log4j2 +install -d -m 0755 ${PREFIX}/$LIB_DIR/public +install -d -m 0755 ${PREFIX}/$LIB_DIR/extlib +install -d -m 0755 ${PREFIX}/$LIB_DIR/extlib-daemon +install -d -m 0755 ${PREFIX}/$DOC_DIR +install -d -m 0755 ${PREFIX}/$BIN_DIR +install -d -m 0755 ${PREFIX}/$ETC_DIR +install -d -m 0755 ${PREFIX}/$MAN_DIR + +cp $BUILD_DIR/CHANGELOG.md ${PREFIX}/${LIB_DIR}/ +cp $BUILD_DIR/RELEASE ${PREFIX}/${LIB_DIR}/ +cp $BUILD_DIR/README.markdown ${PREFIX}/${LIB_DIR}/ +rm -f $BUILD_DIR/lib/zookeeper-*.jar +cp -ra $BUILD_DIR/lib/* ${PREFIX}/$LIB_DIR/lib/ +cp -ra $BUILD_DIR/log4j2/* ${PREFIX}/$LIB_DIR/log4j2/ +cp -ra $BUILD_DIR/public/* ${PREFIX}/$LIB_DIR/public/ +cp -ra $BUILD_DIR/bin/* ${PREFIX}/$BIN_DIR +ln -sf /usr/lib/zookeeper/zookeeper.jar ${PREFIX}/$LIB_DIR/lib/ + +if [ ! -e "${PREFIX}/${ETC_DIR}" ]; then + rm -f ${PREFIX}/${ETC_DIR} + mkdir -p ${PREFIX}/${ETC_DIR} +fi +cp -a $BUILD_DIR/conf ${PREFIX}/$CONF_DIR +ln -s /etc/storm/conf ${PREFIX}/$LIB_DIR/conf + + +# Copy in the /usr/bin/storm wrapper +mv ${PREFIX}/$BIN_DIR/storm ${PREFIX}/$BIN_DIR/storm.distro + +cat > ${PREFIX}/$BIN_DIR/storm < 1130 +%define suse_check \# Define an empty suse_check for compatibility with older sles +%endif + +# SLES is more strict anc check all symlinks point to valid path +# But we do point to a hadoop jar which is not there at build time +# (but would be at install time). +# Since our package build system does not handle dependencies, +# these symlink checks are deactivated +%define __os_install_post \ + %{suse_check} ; \ + /usr/lib/rpm/brp-compress ; \ + %{nil} + +%define doc_storm %{storm_name}/doc +%global initd_dir %{_sysconfdir}/rc.d/init.d +%define alternatives_cmd update-alternatives + +%else + +# CentOS 5 does not have any dist macro +# So I will suppose anything that is not Mageia or a SUSE will be a RHEL/CentOS/Fedora +%if %{!?mgaversion:1}0 + +# FIXME: brp-repack-jars uses unzip to expand jar files +# Unfortunately guice-2.0.jar pulled by ivy contains some files and directories without any read permission +# and make whole process to fail. +# So for now brp-repack-jars is being deactivated until this is fixed. +# See BIGTOP-294 +%define __os_install_post \ + /usr/lib/rpm/redhat/brp-compress ; \ + /usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} ; \ + /usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} ; \ + /usr/lib/rpm/brp-python-bytecompile ; \ + %{nil} +%endif + + +%define doc_storm %{_docdir}/%{storm_name} +%global initd_dir %{_sysconfdir}/rc.d/init.d +%define alternatives_cmd alternatives + +%endif + + +Name: storm +Version: %{storm_base_version} +Release: %{storm_release} +Summary: Storm is a distributed, fault-tolerant, and high-performance realtime computation system that provides strong guarantees on the processing of data. +URL: http://incubator.apache.org/storm/ +Group: Applications/Server +Buildroot: %{_topdir}/INSTALL/%{storm_name}-%{version} +License: Apache License, Version 2.0 +Source0: apache-%{storm_name}-%{storm_base_version}-src.tar.gz +Source1: do-component-build +Source2: install_storm.sh +Requires: zookeeper + + +%description +Storm is a distributed, fault-tolerant, and high-performance realtime computation system that provides strong guarantees on the processing of data. + +%prep +%setup -q -n apache-%{storm_name}-%{storm_base_version} + +%build +env STORM_VERSION=%{version} storm_base_version=%{storm_base_version} bash %{SOURCE1} + +%install +%__rm -rf $RPM_BUILD_ROOT +sh %{SOURCE2} \ + --build-dir=build \ + --prefix=$RPM_BUILD_ROOT + +%__install -d -m 0755 %{buildroot}/%{_localstatedir}/log/%{storm_name} +ln -s %{_localstatedir}/log/%{storm_name} %{buildroot}/%{logs_storm} + +%__install -d -m 0755 %{buildroot}/%{_localstatedir}/run/%{storm_name} +ln -s %{_localstatedir}/run/%{storm_name} %{buildroot}/%{pids_storm} +#ln -s %{conf_storm}/storm.yaml %{buildroot}%{_sysconfdir}/%{name}/storm.yaml + +%pre +getent group storm 2>&1 > /dev/null || /usr/sbin/groupadd -r storm +getent group hadoop 2>&1 > /dev/null || /usr/sbin/groupadd -r hadoop +getent passwd storm 2>&1 > /dev/null || /usr/sbin/useradd -c "STORM" -s /bin/bash -g storm -G storm, hadoop -r -m -d %{storm_user_home} storm 2> /dev/null || : + +%post +%{alternatives_cmd} --install %{etc_storm_conf} %{name}-conf %{etc_storm_conf_dist} 30 + + +####################### +#### FILES SECTION #### +####################### +%files +%defattr(-,root,root) +%{storm_home}/ +#%{_sysconfdir}/%{name}/storm.yaml +%config(noreplace) %{etc_storm_conf_dist} +%defattr(-,storm,storm) +%{logs_storm} +%{pids_storm} +%dir %{_localstatedir}/log/%{storm_name}/ +%dir %{_localstatedir}/run/%{storm_name}/ \ No newline at end of file diff --git a/bigtop.bom b/bigtop.bom index 9c72a11be5..aebe897c0c 100644 --- a/bigtop.bom +++ b/bigtop.bom @@ -488,5 +488,15 @@ bigtop { site = "${apache.APACHE_MIRROR}/${download_path}" archive = "${apache.APACHE_ARCHIVE}/${download_path}" } } + 'storm' { + name = 'storm' + relNotes = 'Apache Storm' + version { base = '1.1.1'; pkg = base; release = 1 } + tarball { destination = "apache-$name-${version.base}-src.tar.gz" + source = destination } + url { download_path = "/$name/$name-${version.base}/" + site = "${apache.APACHE_MIRROR}/${download_path}" + archive = "${apache.APACHE_ARCHIVE}/${download_path}" } + } } } From 3aa07fbd67c0b53587bc6a4d750e3509ca0d0274 Mon Sep 17 00:00:00 2001 From: xingweidong Date: Fri, 12 Jan 2018 10:51:46 +0800 Subject: [PATCH 2/2] Update do-component-build --- bigtop-packages/src/common/storm/do-component-build | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bigtop-packages/src/common/storm/do-component-build b/bigtop-packages/src/common/storm/do-component-build index b49cd23646..7fb652e92c 100755 --- a/bigtop-packages/src/common/storm/do-component-build +++ b/bigtop-packages/src/common/storm/do-component-build @@ -16,10 +16,6 @@ set -e -#base_path=`pwd` -#build_support_dir=`echo ${base_path%bigtop*}` - - . `dirname $0`/bigtop.bom mkdir build