Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions bigtop-packages/src/common/storm/do-component-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/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

. `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)
161 changes: 161 additions & 0 deletions bigtop-packages/src/common/storm/install_storm.sh
Original file line number Diff line number Diff line change
@@ -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 <options>
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 <<EOF
#!/bin/bash
. /etc/default/hadoop

# Autodetect JAVA_HOME if not defined
if [ -e /usr/libexec/bigtop-detect-javahome ]; then
. /usr/libexec/bigtop-detect-javahome
elif [ -e /usr/lib/bigtop-utils/bigtop-detect-javahome ]; then
. /usr/lib/bigtop-utils/bigtop-detect-javahome
fi

BIGTOP_DEFAULTS_DIR=\${BIGTOP_DEFAULTS_DIR-/etc/default}
[ -n "\${BIGTOP_DEFAULTS_DIR}" -a -r \${BIGTOP_DEFAULTS_DIR}/storm ] && . \${BIGTOP_DEFAULTS_DIR}/storm

exec /usr/lib/storm/bin/storm.distro "\$@"
EOF

chmod 755 ${PREFIX}/${BIN_DIR}/storm

cp -ra $BUILD_DIR/external/* ${PREFIX}/$LIB_DIR/contrib/
cp -ra $BUILD_DIR/examples/* ${PREFIX}/$LIB_DIR/contrib/
137 changes: 137 additions & 0 deletions bigtop-packages/src/rpm/storm/SPECS/storm.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# 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.

%define storm_name storm
%define etc_storm_conf /etc/%{storm_name}/conf
%define conf_dir_shipped %{_sysconfdir}/%{storm_name}/
%define etc_storm_conf_dist %{etc_storm_conf}.dist

%define storm_home /usr/lib/%{storm_name}
%define storm_user_home /var/lib/%{storm_name}
%define bin_storm %{storm_home}/bin
%define lib_storm %{storm_home}
%define conf_storm %{storm_home}/conf
%define logs_storm %{storm_home}/logs
%define pids_storm %{storm_home}/pids
%define man_dir %{storm_home}/man
%define storm_username storm
#fix BUG-26074
%global debug_package %{nil}
%if %{?suse_version:1}0

# Only tested on openSUSE 11.4. le'ts update it for previous release when confirmed
%if 0%{suse_version} > 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}/
10 changes: 10 additions & 0 deletions bigtop.bom
Original file line number Diff line number Diff line change
Expand Up @@ -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}" }
}
}
}