From 17d4142d9c223504db5b4e5f831e61a97d466363 Mon Sep 17 00:00:00 2001 From: Youngwoo Kim Date: Mon, 16 Feb 2015 20:39:41 +0900 Subject: [PATCH] BIGTOP-1561. Add Presto as a component --- .../src/common/presto/do-component-build | 37 ++++ .../src/common/presto/install_presto.sh | 205 ++++++++++++++++++ .../src/common/presto/presto-server.svc | 70 ++++++ bigtop-packages/src/deb/presto/changelog | 1 + bigtop-packages/src/deb/presto/compat | 1 + bigtop-packages/src/deb/presto/control | 54 +++++ bigtop-packages/src/deb/presto/copyright | 15 ++ .../src/deb/presto/presto-cli.install | 3 + .../src/deb/presto/presto-doc.install | 1 + .../src/deb/presto/presto-jdbc.install | 1 + bigtop-packages/src/deb/presto/presto.install | 9 + .../src/deb/presto/presto.postinst | 35 +++ bigtop-packages/src/deb/presto/presto.preinst | 62 ++++++ bigtop-packages/src/deb/presto/presto.prerm | 38 ++++ bigtop-packages/src/deb/presto/rules | 43 ++++ bigtop-packages/src/deb/presto/source/format | 1 + .../src/rpm/presto/BUILD/.gitignore | 0 .../src/rpm/presto/RPMS/.gitignore | 0 .../src/rpm/presto/SOURCES/.gitignore | 0 .../src/rpm/presto/SPECS/presto.spec | 193 +++++++++++++++++ .../src/rpm/presto/SRPMS/.gitignore | 0 bigtop.bom | 10 +- 22 files changed, 778 insertions(+), 1 deletion(-) create mode 100644 bigtop-packages/src/common/presto/do-component-build create mode 100644 bigtop-packages/src/common/presto/install_presto.sh create mode 100644 bigtop-packages/src/common/presto/presto-server.svc create mode 100644 bigtop-packages/src/deb/presto/changelog create mode 100644 bigtop-packages/src/deb/presto/compat create mode 100644 bigtop-packages/src/deb/presto/control create mode 100644 bigtop-packages/src/deb/presto/copyright create mode 100644 bigtop-packages/src/deb/presto/presto-cli.install create mode 100644 bigtop-packages/src/deb/presto/presto-doc.install create mode 100644 bigtop-packages/src/deb/presto/presto-jdbc.install create mode 100644 bigtop-packages/src/deb/presto/presto.install create mode 100644 bigtop-packages/src/deb/presto/presto.postinst create mode 100644 bigtop-packages/src/deb/presto/presto.preinst create mode 100644 bigtop-packages/src/deb/presto/presto.prerm create mode 100644 bigtop-packages/src/deb/presto/rules create mode 100644 bigtop-packages/src/deb/presto/source/format create mode 100644 bigtop-packages/src/rpm/presto/BUILD/.gitignore create mode 100644 bigtop-packages/src/rpm/presto/RPMS/.gitignore create mode 100644 bigtop-packages/src/rpm/presto/SOURCES/.gitignore create mode 100644 bigtop-packages/src/rpm/presto/SPECS/presto.spec create mode 100644 bigtop-packages/src/rpm/presto/SRPMS/.gitignore diff --git a/bigtop-packages/src/common/presto/do-component-build b/bigtop-packages/src/common/presto/do-component-build new file mode 100644 index 0000000000..c1cce08c2b --- /dev/null +++ b/bigtop-packages/src/common/presto/do-component-build @@ -0,0 +1,37 @@ +#!/bin/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. + +set -ex + +. `dirname $0`/bigtop.bom + +mvn clean install -DskipTests + +mkdir -p build/presto-${PRESTO_VERSION} +mkdir -p build/presto-${PRESTO_VERSION}/docs + +# Server +tar -C build/presto-${PRESTO_VERSION} --strip-components=1 -xzf presto-server/target/presto-server-${PRESTO_VERSION}.tar.gz +# CLI +cp -ra presto-cli/target/presto-cli-${PRESTO_VERSION}-executable.jar build/presto-${PRESTO_VERSION}/bin/presto +# Docs +cp -ra presto-docs/target/html/* build/presto-${PRESTO_VERSION}/docs/ +# JDBC +cp -ra presto-jdbc/target/presto-jdbc-${PRESTO_VERSION}.jar build/presto-${PRESTO_VERSION}/lib/ +# Verifier +cp -ra presto-verifier/target/presto-verifier-${PRESTO_VERSION}-executable.jar build/presto-${PRESTO_VERSION}/bin/verifier +# Benchmark Driver +cp -ra presto-benchmark-driver/target/presto-benchmark-driver-${PRESTO_VERSION}-executable.jar build/presto-${PRESTO_VERSION}/bin/presto-benchmark-driver diff --git a/bigtop-packages/src/common/presto/install_presto.sh b/bigtop-packages/src/common/presto/install_presto.sh new file mode 100644 index 0000000000..5c4fc77cfb --- /dev/null +++ b/bigtop-packages/src/common/presto/install_presto.sh @@ -0,0 +1,205 @@ +#!/bin/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. + +set -e + +usage() { + echo " +usage: $0 + Required not-so-options: + --build-dir=DIR path to dist.dir + --source-dir=DIR path to package shared files dir + --prefix=PREFIX path to install into + + Optional options: + --doc-dir=DIR path to install docs into [/usr/share/doc/presto] + --lib-dir=DIR path to install Presto home [/usr/lib/presto] + --installed-lib-dir=DIR path where lib-dir will end up on target system + --bin-dir=DIR path to install bins [/usr/bin] + ... [ 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 'source-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 + ;; + --source-dir) + SOURCE_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 + ;; + --) + shift ; break + ;; + *) + echo "Unknown option: $1" + usage + exit 1 + ;; + esac +done + +for var in PREFIX BUILD_DIR SOURCE_DIR; do + if [ -z "$(eval "echo \$$var")" ]; then + echo Missing param: $var + usage + fi +done + +if [ -f "$SOURCE_DIR/bigtop.bom" ]; then + . $SOURCE_DIR/bigtop.bom +fi + +MAN_DIR=${MAN_DIR:-/usr/share/man/man1} +DOC_DIR=${DOC_DIR:-/usr/share/doc/presto} +LIB_DIR=${LIB_DIR:-/usr/lib/presto} +VAR_DIR=${VAR_DIR:-/var/lib/presto} +LOG_DIR=${LOG_DIR:-/var/log/presto} +RUN_DIR=${RUN_DIR:-/var/run/presto} +INSTALLED_LIB_DIR=${INSTALLED_LIB_DIR:-/usr/lib/presto} +BIN_DIR=${BIN_DIR:-/usr/bin} +CONF_DIR=${CONF_DIR:-/etc/presto} +CONF_DIST_DIR=${CONF_DIST_DIR:-/etc/presto.dist} +DEFAULT_DIR=${DEFAULT_DIR:-/etc/default} + +install -d -m 0755 $PREFIX/$CONF_DIST_DIR +install -d -m 0755 $PREFIX/$LIB_DIR +install -d -m 0755 $PREFIX/$LIB_DIR/lib +install -d -m 0755 $PREFIX/$LIB_DIR/bin +install -d -m 0755 $PREFIX/$LIB_DIR/var +install -d -m 0755 $PREFIX/$LIB_DIR/plugin +install -d -m 0755 $PREFIX/$DOC_DIR +install -d -m 0755 $PREFIX/$VAR_DIR +install -d -m 0755 $PREFIX/$LOG_DIR +install -d -m 0755 $PREFIX/$RUN_DIR +install -d -m 0755 $PREFIX/$DEFAULT_DIR + +cp -ra ${BUILD_DIR}/* $PREFIX/$LIB_DIR/ +mv $PREFIX/$LIB_DIR/docs/* $PREFIX/$DOC_DIR/ + +chmod +x $PREFIX/$LIB_DIR/bin/{presto,verifier,presto-benchmark-driver} + +install -d -m 0755 $PREFIX/$CONF_DIST_DIR +install -d -m 0755 $PREFIX/$CONF_DIST_DIR/catalog + +cat > $PREFIX/$CONF_DIST_DIR/node.properties < $PREFIX/$CONF_DIST_DIR/jvm.config < $PREFIX/$CONF_DIST_DIR/config.properties < $PREFIX/$CONF_DIST_DIR/log.properties < $PREFIX/$CONF_DIST_DIR/catalog/tpch.properties < $PREFIX/$CONF_DIST_DIR/catalog/jmx.properties < $PREFIX/$BIN_DIR/`basename $wrap` < +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 +Homepage: https://prestodb.io/ + +Package: presto +Architecture: any +Depends: adduser, bigtop-utils (>= 0.7) +Description: https://prestodb.io/ + Presto is an open source distributed SQL query engine for running + interactive analytic queries against data sources of all sizes ranging + from gigabytes to petabytes. + +Package: presto-server +Architecture: all +Depends: presto (= ${source:Version}) +Description: Server for Presto + Server for Presto + +Package: presto-cli +Architecture: all +Depends: presto (= ${source:Version}) +Description: Presto CLI + Presto CLI + +Package: presto-jdbc +Architecture: all +Depends: presto (= ${source:Version}) +Description: Presto JDBC Driver + JDBC Driver for Presto + +Package: presto-doc +Architecture: all +Depends: +Description: Presto Documentation + Presto Documentation diff --git a/bigtop-packages/src/deb/presto/copyright b/bigtop-packages/src/deb/presto/copyright new file mode 100644 index 0000000000..5326d2b2c0 --- /dev/null +++ b/bigtop-packages/src/deb/presto/copyright @@ -0,0 +1,15 @@ +Format: http://dep.debian.net/deps/dep5 +Source: https://prestodb.io/ +Upstream-Name: Presto + +Files: * +Copyright: 2013, Facebook +License: Apache-2.0 + +Files debian/* +Copyright: 2011, The Apache Software Foundation +License: Apache-2.0 + +License: Apache-2.0 + On Debian systems, the complete text of the Apache 2.0 license + can be found in "/usr/share/common-licenses/Apache-2.0". diff --git a/bigtop-packages/src/deb/presto/presto-cli.install b/bigtop-packages/src/deb/presto/presto-cli.install new file mode 100644 index 0000000000..cc808302ec --- /dev/null +++ b/bigtop-packages/src/deb/presto/presto-cli.install @@ -0,0 +1,3 @@ +/usr/bin/presto +/usr/lib/presto/bin/presto + diff --git a/bigtop-packages/src/deb/presto/presto-doc.install b/bigtop-packages/src/deb/presto/presto-doc.install new file mode 100644 index 0000000000..3ea4ac7b97 --- /dev/null +++ b/bigtop-packages/src/deb/presto/presto-doc.install @@ -0,0 +1 @@ +/usr/share/doc/presto diff --git a/bigtop-packages/src/deb/presto/presto-jdbc.install b/bigtop-packages/src/deb/presto/presto-jdbc.install new file mode 100644 index 0000000000..8abf646562 --- /dev/null +++ b/bigtop-packages/src/deb/presto/presto-jdbc.install @@ -0,0 +1 @@ +/usr/lib/presto/lib/presto-jdbc*.jar diff --git a/bigtop-packages/src/deb/presto/presto.install b/bigtop-packages/src/deb/presto/presto.install new file mode 100644 index 0000000000..5a4d3e117c --- /dev/null +++ b/bigtop-packages/src/deb/presto/presto.install @@ -0,0 +1,9 @@ +/etc/presto.dist +/usr/lib/presto/README.txt +/usr/lib/presto/NOTICE +/usr/lib/presto/bin +/usr/lib/presto/lib +/usr/lib/presto/plugin +/var/lib/presto +/var/log/presto +/var/run/presto diff --git a/bigtop-packages/src/deb/presto/presto.postinst b/bigtop-packages/src/deb/presto/presto.postinst new file mode 100644 index 0000000000..cee70a6926 --- /dev/null +++ b/bigtop-packages/src/deb/presto/presto.postinst @@ -0,0 +1,35 @@ +#!/bin/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. + +set -e + +case "$1" in + configure) + # Install config alternatives + update-alternatives --install /etc/presto/etc presto-etc /etc/presto/etc.dist 30 + chown -R presto:presto /var/log/presto /var/lib/presto /var/run/presto + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/bigtop-packages/src/deb/presto/presto.preinst b/bigtop-packages/src/deb/presto/presto.preinst new file mode 100644 index 0000000000..a7df814968 --- /dev/null +++ b/bigtop-packages/src/deb/presto/presto.preinst @@ -0,0 +1,62 @@ +#!/bin/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. + +# preinst script for presto +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + if ! getent passwd presto >/dev/null; then + # Adding system user: presto . + adduser \ + --system \ + --group \ + --home /var/lib/presto \ + --gecos "Presto" \ + --shell /bin/false \ + presto >/dev/null + fi + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + diff --git a/bigtop-packages/src/deb/presto/presto.prerm b/bigtop-packages/src/deb/presto/presto.prerm new file mode 100644 index 0000000000..0c521717d8 --- /dev/null +++ b/bigtop-packages/src/deb/presto/presto.prerm @@ -0,0 +1,38 @@ +#!/bin/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. + +set -e + +case "$1" in + remove|upgrade|deconfigure) + update-alternatives --remove presto-etc /etc/presto/etc.dist || : + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/bigtop-packages/src/deb/presto/rules b/bigtop-packages/src/deb/presto/rules new file mode 100644 index 0000000000..6eadd2ac0c --- /dev/null +++ b/bigtop-packages/src/deb/presto/rules @@ -0,0 +1,43 @@ +#!/usr/bin/make -f + +# 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. +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +# This has to be exported to make some magic below work. +export DH_OPTIONS + +%: + dh $@ + +override_dh_auto_build: + bash debian/do-component-build + +svcs=presto-server + +$(svcs): debian/init.d.tmpl + bash $< debian/$@.svc deb debian/$@.init + touch $@ + +override_dh_auto_install: $(svcs) + bash -x debian/install_presto.sh \ + --build-dir=build/presto-${PRESTO_VERSION} \ + --doc-dir=/usr/share/doc/presto \ + --source-dir=debian \ + --prefix=debian/tmp + diff --git a/bigtop-packages/src/deb/presto/source/format b/bigtop-packages/src/deb/presto/source/format new file mode 100644 index 0000000000..163aaf8d82 --- /dev/null +++ b/bigtop-packages/src/deb/presto/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/bigtop-packages/src/rpm/presto/BUILD/.gitignore b/bigtop-packages/src/rpm/presto/BUILD/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bigtop-packages/src/rpm/presto/RPMS/.gitignore b/bigtop-packages/src/rpm/presto/RPMS/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bigtop-packages/src/rpm/presto/SOURCES/.gitignore b/bigtop-packages/src/rpm/presto/SOURCES/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bigtop-packages/src/rpm/presto/SPECS/presto.spec b/bigtop-packages/src/rpm/presto/SPECS/presto.spec new file mode 100644 index 0000000000..1e7e30ff7c --- /dev/null +++ b/bigtop-packages/src/rpm/presto/SPECS/presto.spec @@ -0,0 +1,193 @@ +# 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 presto_name presto +%define lib_presto /usr/lib/%{presto_name} +%define var_lib_presto /var/lib/%{presto_name} +%define var_run_presto /var/run/%{presto_name} +%define var_log_presto /var/log/%{presto_name} +%define bin_presto /usr/lib/%{presto_name}/bin +%define config_presto /etc/%{presto_name} +%define bin /usr/bin +%define man_dir /usr/share/man +%define presto_services server + +%if %{?suse_version:1}0 +%define doc_presto %{_docdir}/presto +%define alternatives_cmd update-alternatives +%else +%define doc_presto %{_docdir}/presto-%{presto_version} +%define alternatives_cmd alternatives +%endif + +# disable repacking jars +%define __os_install_post %{nil} + +Name: presto +Version: %{presto_version} +Release: %{presto_release} +Summary: Distributed SQL Query Engine for Big Data +URL: https://prestodb.io/ +Group: Development/Libraries +BuildArch: x86_64 +Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +License: ASL 2.0 +Source0: %{presto_name}-%{presto_base_version}-src.tar.gz +Source1: do-component-build +Source2: install_%{presto_name}.sh +Source4: presto-server.svc +Source5: init.d.tmpl +Source6: bigtop.bom +Requires: bigtop-utils >= 0.7 +Requires(preun): /sbin/service + +%global initd_dir %{_sysconfdir}/init.d + +%if %{?suse_version:1}0 +# Required for init scripts +Requires: insserv +%global initd_dir %{_sysconfdir}/rc.d + +%else +# Required for init scripts +Requires: /lib/lsb/init-functions + +%global initd_dir %{_sysconfdir}/rc.d/init.d + +%endif + +%description +Presto is an open source distributed SQL query engine for running +interactive analytic queries against data sources of all sizes ranging +from gigabytes to petabytes. + +%package -n presto-server +Summary: Presto Server +Group: Development/Libraries +BuildArch: noarch +Requires: presto = %{version}-%{release} + +%description -n presto-server +Server for Presto + +%package -n presto-cli +Summary: Presto CLI +Group: Development/Libraries +BuildArch: noarch +Requires: presto = %{version}-%{release} + +%description -n presto-cli +CLI for Presto + +%package -n presto-jdbc +Summary: Presto JDBC Driver +Group: Development/Libraries +BuildArch: noarch + +%description -n presto-jdbc +JDBC Driver for Presto + +%package -n presto-doc +Summary: Presto Documentation +Group: Development/Libraries +BuildArch: noarch + +%description -n presto-doc +Presto Documentation + +%prep +%setup -n %{presto_name}-%{presto_base_version} + +%build +bash $RPM_SOURCE_DIR/do-component-build + +%install +%__rm -rf $RPM_BUILD_ROOT +%__install -d -m 0755 $RPM_BUILD_ROOT/%{initd_dir}/ + +bash $RPM_SOURCE_DIR/install_presto.sh \ + --build-dir=build/%{presto_name}-%{presto_version} \ + --source-dir=$RPM_SOURCE_DIR \ + --prefix=$RPM_BUILD_ROOT \ + --doc-dir=%{doc_presto} + +for service in %{presto_services} +do + # Install init script + init_file=$RPM_BUILD_ROOT/%{initd_dir}/%{presto_name}-${service} + bash $RPM_SOURCE_DIR/init.d.tmpl $RPM_SOURCE_DIR/presto-${service}.svc rpm $init_file +done + +%pre +getent group presto >/dev/null || groupadd -r presto +getent passwd presto >/dev/null || useradd -c "Presto" -s /sbin/nologin -g presto -r -d %{var_lib_presto} presto 2> /dev/null || : + +%post +%{alternatives_cmd} --install /etc/presto %{presto_name}-conf /etc/presto.dist 30 + +%preun +if [ "$1" = 0 ]; then + %{alternatives_cmd} --remove %{presto_name}-conf /etc/presto.dist || : +fi + +for service in %{presto_services}; do + /sbin/service %{presto_name}-${service} status > /dev/null 2>&1 + if [ $? -eq 0 ]; then + /sbin/service %{presto_name}-${service} stop > /dev/null 2>&1 + fi +done + +%files +%defattr(-,root,root,755) +%config(noreplace) %{config_presto}.dist +%{bin}/verifier +%{lib_presto}/README.txt +%{lib_presto}/NOTICE +%{lib_presto}/bin +%{lib_presto}/lib +%{lib_presto}/plugin +%{lib_presto}/log +%{lib_presto}/etc +%attr(0755,presto,presto) %{var_lib_presto} +%attr(0755,presto,presto) %{var_log_presto} +%attr(0755,presto,presto) %{var_run_presto} +%exclude %{lib_presto}/bin/presto + +%files -n presto-cli +%{bin_presto}/presto +%{bin}/presto + +%files -n presto-doc +%doc %{doc_presto} + +%files -n presto-jdbc +%{lib_presto}/lib/presto-jdbc*.jar + +%define service_macro() \ +%files -n %1 \ +%attr(0755,root,root)/%{initd_dir}/%1 \ +%post -n %1 \ +chkconfig --add %1 \ +\ +%preun -n %1 \ +if [ $1 = 0 ] ; then \ + service %1 stop > /dev/null 2>&1 \ + chkconfig --del %1 \ +fi \ +%postun -n %1 \ +if [ $1 -ge 1 ]; then \ + service %1 condrestart >/dev/null 2>&1 \ +fi +%service_macro presto-server diff --git a/bigtop-packages/src/rpm/presto/SRPMS/.gitignore b/bigtop-packages/src/rpm/presto/SRPMS/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/bigtop.bom b/bigtop.bom index 1874d19083..7e06bcd0ac 100644 --- a/bigtop.bom +++ b/bigtop.bom @@ -456,7 +456,15 @@ bigtop { version { base = '1.1.4'; pkg = base; release = 1 } tarball { destination = "$name-${version.base}.tar.gz" source = "${version.base}.tar.gz" } - url { site = "https://github.com/quantcast/qfs/archive" + url { site = "https://github.com/quantcast/qfs/archive" } + } + 'presto' { + name = 'presto' + relNotes = 'Presto is an open source distributed SQL query engine' + version { base = '0.167'; pkg = base; release = 1 } + tarball { destination = "$name-${version.base}-src.tar.gz" + source = "${version.base}.tar.gz" } + url { site = "https://github.com/prestodb/presto/archive" archive = site } } 'gpdb' {