You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by se...@apache.org on 2022/09/13 05:57:41 UTC
[bigtop] branch master updated: BIGTOP-3799: Support parent directory configuration for Hive rpm build script (#998)
This is an automated email from the ASF dual-hosted git repository.
sekikn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bigtop.git
The following commit(s) were added to refs/heads/master by this push:
new c8c4e88f BIGTOP-3799: Support parent directory configuration for Hive rpm build script (#998)
c8c4e88f is described below
commit c8c4e88f5b2d1ac6b4b00bb59ceff4dfd7131b7c
Author: Zhiguo Wu <wu...@apache.org>
AuthorDate: Tue Sep 13 13:57:37 2022 +0800
BIGTOP-3799: Support parent directory configuration for Hive rpm build script (#998)
* BIGTOP-3799: Support parent directory configuration for Hive rpm build script
* remove docdir prefix on deb build script
---
bigtop-packages/src/common/hive/install_hive.sh | 200 +++++++++++++-----------
bigtop-packages/src/deb/hive/rules | 2 +-
bigtop-packages/src/rpm/hive/SPECS/hive.spec | 105 ++++++++-----
3 files changed, 175 insertions(+), 132 deletions(-)
diff --git a/bigtop-packages/src/common/hive/install_hive.sh b/bigtop-packages/src/common/hive/install_hive.sh
index 8d54180c..8d86498b 100755
--- a/bigtop-packages/src/common/hive/install_hive.sh
+++ b/bigtop-packages/src/common/hive/install_hive.sh
@@ -24,12 +24,15 @@ usage: $0 <options>
Optional options:
--doc-dir=DIR path to install docs into [/usr/share/doc/hive]
- --hive-dir=DIR path to install hive home [/usr/lib/hive]
- --installed-hive-dir=DIR path where hive-dir will end up on target system
--bin-dir=DIR path to install bins [/usr/bin]
+ --man-dir=DIR path to install mans [/usr/share/man]
+ --etc-default=DIR path to bigtop default dir [/etc/default]
+ --hive-dir=DIR path to install hive home [/usr/lib/hive]
+ --var-hive-dir=DIR path to install hive contents [/var/lib/hive]
+ --hcatalog-dir=DIR path to install hcatalog home [/usr/lib/hcatalog]
+ --var-hcatalog-dir=DIR path to install hcatalog contents [/var/lib/hcatalog]
+ --etc-hive=DIR path to install hive conf [/etc/hive]
--examples-dir=DIR path to install examples [doc-dir/examples]
- --hcatalog-dir=DIR path to install hcatalog [/usr/lib/hcatalog]
- --installed-hcatalog-dir=DIR path where hcatalog-dir will end up on target system
... [ see source for more similar options ]
"
exit 1
@@ -40,13 +43,16 @@ OPTS=$(getopt \
-o '' \
-l 'prefix:' \
-l 'doc-dir:' \
- -l 'hive-dir:' \
- -l 'installed-hive-dir:' \
-l 'bin-dir:' \
+ -l 'man-dir:' \
+ -l 'etc-default:' \
+ -l 'hive-dir:' \
+ -l 'var-hive-dir:' \
+ -l 'hcatalog-dir:' \
+ -l 'var-hcatalog-dir:' \
+ -l 'etc-hive:' \
-l 'examples-dir:' \
-l 'python-dir:' \
- -l 'hcatalog-dir:' \
- -l 'installed-hcatalog-dir:' \
-l 'build-dir:' \
-l 'hive-version:' -- "$@")
@@ -66,14 +72,29 @@ while true ; do
--doc-dir)
DOC_DIR=$2 ; shift 2
;;
+ --bin-dir)
+ BIN_DIR=$2 ; shift 2
+ ;;
+ --man-dir)
+ MAN_DIR=$2 ; shift 2
+ ;;
+ --etc-default)
+ ETC_DEFAULT=$2 ; shift 2
+ ;;
--hive-dir)
HIVE_DIR=$2 ; shift 2
;;
- --installed-hive-dir)
- INSTALLED_HIVE_DIR=$2 ; shift 2
+ --var-hive-dir)
+ VAR_HIVE_DIR=$2 ; shift 2
;;
- --bin-dir)
- BIN_DIR=$2 ; shift 2
+ --hcatalog-dir)
+ HCATALOG_DIR=$2 ; shift 2
+ ;;
+ --var-hcatalog-dir)
+ VAR_HCATALOG_DIR=$2 ; shift 2
+ ;;
+ --etc-hive)
+ ETC_HIVE=$2 ; shift 2
;;
--examples-dir)
EXAMPLES_DIR=$2 ; shift 2
@@ -81,12 +102,6 @@ while true ; do
--python-dir)
PYTHON_DIR=$2 ; shift 2
;;
- --hcatalog-dir)
- HCATALOG_DIR=$2 ; shift 2
- ;;
- --installed-hcatalog-dir)
- INSTALLED_HCATALOG_DIR=$2 ; shift 2
- ;;
--hive-version)
HIVE_VERSION=$2 ; shift 2
;;
@@ -108,37 +123,40 @@ for var in PREFIX BUILD_DIR ; do
fi
done
-MAN_DIR=$PREFIX/usr/share/man/man1
-DOC_DIR=${DOC_DIR:-$PREFIX/usr/share/doc/hive}
-HIVE_DIR=${HIVE_DIR:-$PREFIX/usr/lib/hive}
-INSTALLED_HIVE_DIR=${INSTALLED_HIVE_DIR:-/usr/lib/hive}
+MAN_DIR=${MAN_DIR:-/usr/share/man}/man1
+DOC_DIR=${DOC_DIR:-/usr/share/doc/hive}
+BIN_DIR=${BIN_DIR:-/usr/bin}
+ETC_DEFAULT=${ETC_DEFAULT:-/etc/default}
+HIVE_DIR=${HIVE_DIR:-/usr/lib/hive}
+VAR_HIVE_DIR=${VAR_HIVE_DIR:-/var/lib/hive}
+HCATALOG_DIR=${HCATALOG_DIR:-/usr/lib/hive-hcatalog}
+VAR_HCATALOG_DIR=${VAR_HCATALOG_DIR:-/var/lib/hive-hcatalog}
+HCATALOG_SHARE_DIR=${HCATALOG_DIR}/share/hcatalog
EXAMPLES_DIR=${EXAMPLES_DIR:-$DOC_DIR/examples}
-BIN_DIR=${BIN_DIR:-$PREFIX/usr/bin}
PYTHON_DIR=${PYTHON_DIR:-$HIVE_DIR/lib/py}
-HCATALOG_DIR=${HCATALOG_DIR:-$PREFIX/usr/lib/hive-hcatalog}
-HCATALOG_SHARE_DIR=${HCATALOG_DIR}/share/hcatalog
-INSTALLED_HCATALOG_DIR=${INSTALLED_HCATALOG_DIR:-/usr/lib/hive-hcatalog}
-CONF_DIR=/etc/hive
-CONF_DIST_DIR=/etc/hive/conf.dist
+
+ETC_HIVE=${ETC_HIVE:-/etc/hive}
+# No prefix
+NP_ETC_HIVE=/etc/hive
# First we'll move everything into lib
-install -d -m 0755 ${HIVE_DIR}
-(cd ${BUILD_DIR} && tar -cf - .)|(cd ${HIVE_DIR} && tar -xf -)
-rm -f ${HIVE_DIR}/lib/hive-shims-0.2*.jar
-for jar in `ls ${HIVE_DIR}/lib/hive-*.jar | grep -v 'standalone.jar'`; do
+install -d -m 0755 $PREFIX/$HIVE_DIR
+(cd ${BUILD_DIR} && tar -cf - .)|(cd $PREFIX/$HIVE_DIR && tar -xf -)
+rm -f $PREFIX/$HIVE_DIR/lib/hive-shims-0.2*.jar
+for jar in `ls $PREFIX/$HIVE_DIR/lib/hive-*.jar | grep -v 'standalone.jar'`; do
base=`basename $jar`
- (cd ${HIVE_DIR}/lib && ln -s $base ${base/-[0-9].*/.jar})
+ (cd $PREFIX/$HIVE_DIR/lib && ln -s $base ${base/-[0-9].*/.jar})
done
for thing in conf README.txt examples lib/py;
do
- rm -rf ${HIVE_DIR}/$thing
+ rm -rf $PREFIX/$HIVE_DIR/$thing
done
-install -d -m 0755 ${BIN_DIR}
+install -d -m 0755 $PREFIX/$BIN_DIR
for file in hive beeline hiveserver2
do
- wrapper=$BIN_DIR/$file
+ wrapper=$PREFIX/$BIN_DIR/$file
cat >>$wrapper <<EOF
#!/bin/bash
@@ -147,78 +165,80 @@ if [ -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}
+BIGTOP_DEFAULTS_DIR=\${BIGTOP_DEFAULTS_DIR-$ETC_DEFAULT}
[ -n "\${BIGTOP_DEFAULTS_DIR}" -a -r \${BIGTOP_DEFAULTS_DIR}/hbase ] && . \${BIGTOP_DEFAULTS_DIR}/hbase
-export HIVE_HOME=$INSTALLED_HIVE_DIR
-exec $INSTALLED_HIVE_DIR/bin/$file "\$@"
+export HIVE_HOME=$HIVE_DIR
+exec $HIVE_DIR/bin/$file "\$@"
EOF
chmod 755 $wrapper
done
# Config
-install -d -m 0755 ${PREFIX}${CONF_DIST_DIR}
-(cd ${BUILD_DIR}/conf && tar -cf - .)|(cd ${PREFIX}${CONF_DIST_DIR} && tar -xf -)
+install -d -m 0755 $PREFIX/$NP_ETC_HIVE
+install -d -m 0755 $PREFIX/$ETC_HIVE/conf.dist
+(cd ${BUILD_DIR}/conf && tar -cf - .)|(cd $PREFIX/$ETC_HIVE/conf.dist && tar -xf -)
for template in hive-exec-log4j2.properties hive-log4j2.properties
do
- mv ${PREFIX}${CONF_DIST_DIR}/${template}.template ${PREFIX}${CONF_DIST_DIR}/${template}
+ mv $PREFIX/$ETC_HIVE/conf.dist/${template}.template $PREFIX/$ETC_HIVE/conf.dist/${template}
done
-cp hive-site.xml ${PREFIX}${CONF_DIST_DIR}
-sed -i -e "s|@VERSION@|${HIVE_VERSION}|" ${PREFIX}${CONF_DIST_DIR}/hive-site.xml
+cp hive-site.xml $PREFIX/$ETC_HIVE/conf.dist
+sed -i -e "s|@VERSION@|${HIVE_VERSION}|" $PREFIX/$ETC_HIVE/conf.dist/hive-site.xml
-ln -s ${CONF_DIR}/conf $HIVE_DIR/conf
+ln -s $NP_ETC_HIVE/conf $PREFIX/$HIVE_DIR/conf
-install -d -m 0755 $MAN_DIR
-gzip -c hive.1 > $MAN_DIR/hive.1.gz
+install -d -m 0755 $PREFIX/$MAN_DIR
+gzip -c hive.1 > $PREFIX/$MAN_DIR/hive.1.gz
# Docs
-install -d -m 0755 ${DOC_DIR}
-cp ${BUILD_DIR}/README.txt ${DOC_DIR}
-mv ${HIVE_DIR}/NOTICE ${DOC_DIR}
-mv ${HIVE_DIR}/LICENSE ${DOC_DIR}
-mv ${HIVE_DIR}/RELEASE_NOTES.txt ${DOC_DIR}
+install -d -m 0755 $PREFIX/$DOC_DIR
+mv $PREFIX/$HIVE_DIR/NOTICE $PREFIX/$DOC_DIR
+mv $PREFIX/$HIVE_DIR/LICENSE $PREFIX/$DOC_DIR
+mv $PREFIX/$HIVE_DIR/RELEASE_NOTES.txt $PREFIX/$DOC_DIR
# Examples
-install -d -m 0755 ${EXAMPLES_DIR}
-cp -a ${BUILD_DIR}/examples/* ${EXAMPLES_DIR}
+install -d -m 0755 $PREFIX/$EXAMPLES_DIR
+cp -a ${BUILD_DIR}/examples/* $PREFIX/$EXAMPLES_DIR
# Python libs
-install -d -m 0755 ${PYTHON_DIR}
-(cd $BUILD_DIR/lib/py && tar cf - .) | (cd ${PYTHON_DIR} && tar xf -)
-chmod 755 ${PYTHON_DIR}/hive_metastore/*-remote
+install -d -m 0755 $PREFIX/$PYTHON_DIR
+(cd $BUILD_DIR/lib/py && tar cf - .) | (cd $PREFIX/$PYTHON_DIR && tar xf -)
+chmod 755 $PREFIX/$PYTHON_DIR/hive_metastore/*-remote
# Dir for Metastore DB
-install -d -m 1777 $PREFIX/var/lib/hive/metastore/
+install -d -m 1777 $PREFIX/$VAR_HIVE_DIR/metastore/
# We need to remove the .war files. No longer supported.
-rm -f ${HIVE_DIR}/lib/hive-hwi*.war
+rm -f $PREFIX/$HIVE_DIR/lib/hive-hwi*.war
# Remove some source which gets installed
-rm -rf ${HIVE_DIR}/lib/php/ext
+rm -rf $PREFIX/$HIVE_DIR/lib/php/ext
-install -d -m 0755 ${HCATALOG_DIR}
-mv ${HIVE_DIR}/hcatalog/* ${HCATALOG_DIR}
-rm -rf ${HIVE_DIR}/hcatalog
+install -d -m 0755 $PREFIX/$HCATALOG_DIR
+mv $PREFIX/$HIVE_DIR/hcatalog/* $PREFIX/$HCATALOG_DIR
+rm -rf $PREFIX/$HIVE_DIR/hcatalog
# Workaround for HIVE-5534
-find ${HCATALOG_DIR} -name *.sh | xargs chmod 755
-chmod 755 ${HCATALOG_DIR}/bin/hcat
-
-install -d -m 0755 ${PREFIX}/etc/default
-for conf in `cd ${HCATALOG_DIR}/etc ; ls -d *` ; do
- install -d -m 0755 ${PREFIX}/etc/hive-$conf
- mv ${HCATALOG_DIR}/etc/$conf ${PREFIX}/etc/hive-$conf/conf.dist
- ln -s /etc/hive-$conf/conf ${HCATALOG_DIR}/etc/$conf
- touch ${PREFIX}/etc/default/hive-$conf-server
+find $PREFIX/$HCATALOG_DIR -name *.sh | xargs chmod 755
+chmod 755 $PREFIX/$HCATALOG_DIR/bin/hcat
+
+install -d -m 0755 $PREFIX/$ETC_DEFAULT
+for conf in `cd $PREFIX/$HCATALOG_DIR/etc ; ls -d *` ; do
+ install -d -m 0755 ${PREFIX}/$NP_ETC_HIVE-$conf
+ install -d -m 0755 ${PREFIX}/$ETC_HIVE-$conf
+ mv $PREFIX/$HCATALOG_DIR/etc/$conf ${PREFIX}/$ETC_HIVE-$conf/conf.dist
+ ln -s $NP_ETC_HIVE-$conf/conf $PREFIX/$HCATALOG_DIR/etc/$conf
+ touch $PREFIX/$ETC_DEFAULT/hive-$conf-server
done
-wrapper=$BIN_DIR/hcat
+wrapper=$PREFIX/$BIN_DIR/hcat
cat >>$wrapper <<EOF
#!/bin/sh
-BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
-[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hadoop ] && . ${BIGTOP_DEFAULTS_DIR}/hadoop
+
+BIGTOP_DEFAULTS_DIR=\${BIGTOP_DEFAULTS_DIR-$ETC_DEFAULT}
+[ -n "\${BIGTOP_DEFAULTS_DIR}" -a -r \${BIGTOP_DEFAULTS_DIR}/hadoop ] && . \${BIGTOP_DEFAULTS_DIR}/hadoop
# Autodetect JAVA_HOME if not defined
if [ -e /usr/lib/bigtop-utils/bigtop-detect-javahome ]; then
@@ -226,30 +246,30 @@ if [ -e /usr/lib/bigtop-utils/bigtop-detect-javahome ]; then
fi
# FIXME: HCATALOG-636 (and also HIVE-2757)
-export HIVE_HOME=/usr/lib/hive
-export HIVE_CONF_DIR=/etc/hive/conf
-export HCAT_HOME=$INSTALLED_HCATALOG_DIR
+export HIVE_HOME=$HIVE_DIR
+export HIVE_CONF_DIR=$NP_ETC_HIVE/conf
+export HCAT_HOME=$HCATALOG_DIR
-export HCATALOG_HOME=$INSTALLED_HCATALOG_DIR
-exec $INSTALLED_HCATALOG_DIR/bin/hcat "\$@"
+export HCATALOG_HOME=$HCATALOG_DIR
+exec $HCATALOG_DIR/bin/hcat "\$@"
EOF
chmod 755 $wrapper
# Install the docs
-install -d -m 0755 ${DOC_DIR}
-mv $HCATALOG_DIR/share/doc/hcatalog/* ${DOC_DIR}
+install -d -m 0755 $PREFIX/$DOC_DIR
+mv $PREFIX/$HCATALOG_DIR/share/doc/hcatalog/* $PREFIX/$DOC_DIR
# Might as delete the directory since it's empty now
-rm -rf $HCATALOG_DIR/share/doc
-install -d -m 0755 $MAN_DIR
-gzip -c hive-hcatalog.1 > $MAN_DIR/hive-hcatalog.1.gz
+rm -rf $PREFIX/$HCATALOG_DIR/share/doc
+install -d -m 0755 $PREFIX/$MAN_DIR
+gzip -c hive-hcatalog.1 > $PREFIX/$MAN_DIR/hive-hcatalog.1.gz
# Provide the runtime dirs
-install -d -m 0755 $PREFIX/var/lib/hive
+install -d -m 0755 $PREFIX/$VAR_HIVE_DIR
install -d -m 0755 $PREFIX/var/log/hive
-install -d -m 0755 $PREFIX/var/lib/hive-hcatalog
+install -d -m 0755 $PREFIX/$VAR_HCATALOG_DIR
install -d -m 0755 $PREFIX/var/log/hive-hcatalog
-for DIR in ${HCATALOG_SHARE_DIR} ; do
+for DIR in $PREFIX/$HCATALOG_SHARE_DIR ; do
(cd $DIR &&
for j in hive-hcatalog-*.jar; do
if [[ $j =~ hive-hcatalog-(.*)-${HIVE_VERSION}.jar ]]; then
@@ -260,5 +280,5 @@ for DIR in ${HCATALOG_SHARE_DIR} ; do
done
# Remove Windows files
-find ${HIVE_DIR}/bin -name '*.cmd' | xargs rm -f
-find ${HCATALOG_DIR}/bin -name '*.cmd' | xargs rm -f
+find $PREFIX/$HIVE_DIR/bin -name '*.cmd' | xargs rm -f
+find $PREFIX/$HCATALOG_DIR/bin -name '*.cmd' | xargs rm -f
diff --git a/bigtop-packages/src/deb/hive/rules b/bigtop-packages/src/deb/hive/rules
index 72a020dc..47e057eb 100755
--- a/bigtop-packages/src/deb/hive/rules
+++ b/bigtop-packages/src/deb/hive/rules
@@ -54,7 +54,7 @@ override_dh_auto_install: server2 metastore hcatalog-server webhcat-server
bash debian/install_hive.sh \
--prefix=debian/tmp \
--build-dir=build/dist \
- --doc-dir=debian/tmp/usr/share/doc/${hive_pkg_name}
+ --doc-dir=/usr/share/doc/${hive_pkg_name}
# We need to get rid of jars that happen to be shipped in other CDH packages
rm -f debian/tmp/usr/lib/hive/lib/hbase-*.jar debian/tmp/usr/lib/hive/lib/zookeeper-*.jar
ln -s /usr/lib/hbase/hbase-common.jar /usr/lib/hbase/hbase-client.jar /usr/lib/hbase/hbase-hadoop-compat.jar /usr/lib/hbase/hbase-hadoop2-compat.jar debian/tmp/usr/lib/hive/lib
diff --git a/bigtop-packages/src/rpm/hive/SPECS/hive.spec b/bigtop-packages/src/rpm/hive/SPECS/hive.spec
index 8e886325..99fce1d9 100644
--- a/bigtop-packages/src/rpm/hive/SPECS/hive.spec
+++ b/bigtop-packages/src/rpm/hive/SPECS/hive.spec
@@ -12,38 +12,50 @@
# 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 hadoop_username hadoop
-%define etc_hive /etc/%{name}
-%define config_hive %{etc_hive}/conf
-%define conf_hcatalog %{_sysconfdir}/hive-hcatalog/conf
-%define conf_webhcat %{_sysconfdir}/hive-webhcat/conf
-%define usr_lib_hive /usr/lib/%{name}
-%define usr_lib_hcatalog /usr/lib/hive-hcatalog
-%define var_lib_hive /var/lib/%{name}
-%define var_lib_hcatalog /var/lib/%{name}-hcatalog
-%define var_log_hcatalog /var/log/%{name}-hcatalog
-%define usr_bin /usr/bin
+
+%define etc_default %{parent_dir}/etc/default
+
+%define usr_lib_hive %{parent_dir}/usr/lib/%{name}
+%define usr_lib_hcatalog %{parent_dir}/usr/lib/%{name}-hcatalog
+%define var_lib_hive %{parent_dir}/var/lib/%{name}
+%define var_lib_hcatalog %{parent_dir}/var/lib/%{name}-hcatalog
+%define etc_hive %{parent_dir}/etc/%{name}
+
+%define usr_lib_zookeeper %{parent_dir}/usr/lib/zookeeper
+%define usr_lib_hbase %{parent_dir}/usr/lib/hbase
+
+%define bin_dir %{parent_dir}/%{_bindir}
+%define man_dir %{parent_dir}/%{_mandir}
+%define doc_dir %{parent_dir}/%{_docdir}
+
+# No prefix directory
+%define np_var_log_hive /var/log/%{name}
+%define np_var_run_hive /var/run/%{name}
+%define np_var_log_hcatalog /var/log/%{name}-hcatalog
+%define np_etc_hive /etc/%{name}
+
%define hive_config_virtual hive_active_configuration
-%define man_dir %{_mandir}
%define hive_services hive-metastore hive-server2 hive-hcatalog-server hive-webhcat-server
# After we run "ant package" we'll find the distribution here
%define hive_dist build/dist
%if %{!?suse_version:1}0
-%define doc_hive %{_docdir}/%{name}-%{hive_version}
+%define doc_hive %{doc_dir}/%{name}-%{hive_version}
%define alternatives_cmd alternatives
%global initd_dir %{_sysconfdir}/rc.d/init.d
%else
-# Only tested on openSUSE 11.4. le'ts update it for previous release when confirmed
+# Only tested on openSUSE 11.4. let's 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
-%define doc_hive %{_docdir}/%{name}
+%define doc_hive %{doc_dir}/%{name}
%define alternatives_cmd update-alternatives
%global initd_dir %{_sysconfdir}/rc.d
@@ -250,26 +262,34 @@ cp $RPM_SOURCE_DIR/hive.1 .
cp $RPM_SOURCE_DIR/hive-hcatalog.1 .
cp $RPM_SOURCE_DIR/hive-site.xml .
/bin/bash %{SOURCE2} \
- --prefix=$RPM_BUILD_ROOT \
--build-dir=%{hive_dist} \
- --doc-dir=$RPM_BUILD_ROOT/%{doc_hive} \
+ --prefix=$RPM_BUILD_ROOT \
+ --doc-dir=%{doc_hive} \
+ --bin-dir=%{bin_dir} \
+ --man-dir=%{man_dir} \
+ --etc-default=%{etc_default} \
+ --hive-dir=%{usr_lib_hive} \
+ --var-hive-dir=%{var_lib_hive} \
+ --hcatalog-dir=%{usr_lib_hcatalog} \
+ --var-hcatalog-dir=%{var_lib_hcatalog} \
+ --etc-hive=%{etc_hive} \
--hive-version=%{hive_base_version}
%__install -d -m 0755 $RPM_BUILD_ROOT/%{initd_dir}/
-%__install -d -m 0755 $RPM_BUILD_ROOT/etc/default/
-%__install -m 0644 $RPM_SOURCE_DIR/hive-metastore.default $RPM_BUILD_ROOT/etc/default/%{name}-metastore
-%__install -m 0644 $RPM_SOURCE_DIR/hive-server2.default $RPM_BUILD_ROOT/etc/default/%{name}-server2
-%__install -m 0644 $RPM_SOURCE_DIR/hive-hcatalog-server.default $RPM_BUILD_ROOT/etc/default/%{name}-hcatalog-server
-%__install -m 0644 $RPM_SOURCE_DIR/hive-webhcat-server.default $RPM_BUILD_ROOT/etc/default/%{name}-webhcat-server
+%__install -d -m 0755 $RPM_BUILD_ROOT/%{etc_default}/
+%__install -m 0644 $RPM_SOURCE_DIR/hive-metastore.default $RPM_BUILD_ROOT/%{etc_default}/%{name}-metastore
+%__install -m 0644 $RPM_SOURCE_DIR/hive-server2.default $RPM_BUILD_ROOT/%{etc_default}/%{name}-server2
+%__install -m 0644 $RPM_SOURCE_DIR/hive-hcatalog-server.default $RPM_BUILD_ROOT/%{etc_default}/%{name}-hcatalog-server
+%__install -m 0644 $RPM_SOURCE_DIR/hive-webhcat-server.default $RPM_BUILD_ROOT/%{etc_default}/%{name}-webhcat-server
-%__install -d -m 0755 $RPM_BUILD_ROOT/%{_localstatedir}/log/%{name}
-%__install -d -m 0755 $RPM_BUILD_ROOT/%{_localstatedir}/run/%{name}
+%__install -d -m 0755 $RPM_BUILD_ROOT/%{np_var_log_hive}
+%__install -d -m 0755 $RPM_BUILD_ROOT/%{np_var_run_hive}
# We need to get rid of jars that happen to be shipped in other Bigtop packages
%__rm -f $RPM_BUILD_ROOT/%{usr_lib_hive}/lib/hbase-*.jar $RPM_BUILD_ROOT/%{usr_lib_hive}/lib/zookeeper-*.jar
-%__ln_s /usr/lib/zookeeper/zookeeper.jar $RPM_BUILD_ROOT/%{usr_lib_hive}/lib/
-%__ln_s /usr/lib/hbase/hbase-common.jar /usr/lib/hbase/hbase-client.jar /usr/lib/hbase/hbase-hadoop-compat.jar /usr/lib/hbase/hbase-hadoop2-compat.jar $RPM_BUILD_ROOT/%{usr_lib_hive}/lib/
-%__ln_s /usr/lib/hbase/hbase-procedure.jar /usr/lib/hbase/hbase-protocol.jar /usr/lib/hbase/hbase-server.jar $RPM_BUILD_ROOT/%{usr_lib_hive}/lib/
+%__ln_s %{usr_lib_zookeeper}/zookeeper.jar $RPM_BUILD_ROOT/%{usr_lib_hive}/lib/
+%__ln_s %{usr_lib_hbase}/hbase-common.jar %{usr_lib_hbase}/hbase-client.jar %{usr_lib_hbase}/hbase-hadoop-compat.jar %{usr_lib_hbase}/hbase-hadoop2-compat.jar $RPM_BUILD_ROOT/%{usr_lib_hive}/lib/
+%__ln_s %{usr_lib_hbase}/hbase-procedure.jar %{usr_lib_hbase}/hbase-protocol.jar %{usr_lib_hbase}/hbase-server.jar $RPM_BUILD_ROOT/%{usr_lib_hive}/lib/
# Workaround for BIGTOP-583
%__rm -f $RPM_BUILD_ROOT/%{usr_lib_hive}/lib/slf4j-log4j12-*.jar
@@ -289,7 +309,7 @@ getent passwd hive >/dev/null || useradd -c "Hive" -s /sbin/nologin -g hive -r -
%post
# Install config alternatives
-%{alternatives_cmd} --install %{config_hive} %{name}-conf %{etc_hive}/conf.dist 30
+%{alternatives_cmd} --install %{np_etc_hive}/conf %{name}-conf %{etc_hive}/conf.dist 30
# Upgrade
@@ -308,19 +328,19 @@ fi
%post hcatalog
-%{alternatives_cmd} --install %{conf_hcatalog} hive-hcatalog-conf %{conf_hcatalog}.dist 30
+%{alternatives_cmd} --install %{np_etc_hive}-hcatalog/conf hive-hcatalog-conf %{etc_hive}-hcatalog/conf.dist 30
%preun hcatalog
if [ "$1" = 0 ]; then
- %{alternatives_cmd} --remove hive-hcatalog-conf %{conf_hcatalog}.dist || :
+ %{alternatives_cmd} --remove hive-hcatalog-conf %{etc_hive}-hcatalog/conf.dist || :
fi
%post webhcat
-%{alternatives_cmd} --install %{conf_webhcat} hive-webhcat-conf %{conf_webhcat}.dist 30
+%{alternatives_cmd} --install %{np_etc_hive}-webhcat/conf hive-webhcat-conf %{etc_hive}-webhcat/conf.dist 30
%preun webhcat
if [ "$1" = 0 ]; then
- %{alternatives_cmd} --remove hive-webhcat-conf %{conf_webhcat}.dist || :
+ %{alternatives_cmd} --remove hive-webhcat-conf %{etc_hive}-webhcat/conf.dist || :
fi
#######################
@@ -330,13 +350,14 @@ fi
%attr(1777,hive,hive) %dir %{var_lib_hive}/metastore
%defattr(-,root,root,755)
%config(noreplace) %{etc_hive}/conf.dist
+%attr(0755,hive,hive) %{np_etc_hive}
%{usr_lib_hive}
-%{usr_bin}/hive
-%{usr_bin}/beeline
-%{usr_bin}/hiveserver2
+%{bin_dir}/hive
+%{bin_dir}/beeline
+%{bin_dir}/hiveserver2
%attr(0755,hive,hive) %dir %{var_lib_hive}
-%attr(0755,hive,hive) %dir %{_localstatedir}/log/%{name}
-%attr(0755,hive,hive) %dir %{_localstatedir}/run/%{name}
+%attr(0755,hive,hive) %dir %{np_var_log_hive}
+%attr(0755,hive,hive) %dir %{np_var_run_hive}
%doc %{doc_hive}
%{man_dir}/man1/hive.1.*
%exclude %dir %{usr_lib_hive}
@@ -356,9 +377,10 @@ fi
%files hcatalog
%defattr(-,root,root,755)
-%config(noreplace) %attr(755,root,root) %{conf_hcatalog}.dist
+%config(noreplace) %attr(755,root,root) %{etc_hive}-hcatalog/conf.dist
+%attr(0775,hive,hive) %{np_etc_hive}-hcatalog
%attr(0775,hive,hive) %{var_lib_hcatalog}
-%attr(0775,hive,hive) %{var_log_hcatalog}
+%attr(0775,hive,hive) %{np_var_log_hcatalog}
%dir %{usr_lib_hcatalog}
%{usr_lib_hcatalog}/bin
%{usr_lib_hcatalog}/etc/hcatalog
@@ -366,12 +388,13 @@ fi
%{usr_lib_hcatalog}/share/hcatalog
%{usr_lib_hcatalog}/sbin/update-hcatalog-env.sh
%{usr_lib_hcatalog}/sbin/hcat*
-%{usr_bin}/hcat
+%{bin_dir}/hcat
%{man_dir}/man1/hive-hcatalog.1.*
%files webhcat
%defattr(-,root,root,755)
-%config(noreplace) %attr(755,root,root) %{conf_webhcat}.dist
+%config(noreplace) %attr(755,root,root) %{etc_hive}-webhcat/conf.dist
+%attr(0775,hive,hive) %{np_etc_hive}-webhcat
%{usr_lib_hcatalog}/share/webhcat
%{usr_lib_hcatalog}/etc/webhcat
%{usr_lib_hcatalog}/sbin/webhcat*
@@ -379,7 +402,7 @@ fi
%define service_macro() \
%files %1 \
%attr(0755,root,root)/%{initd_dir}/%{name}-%1 \
-%config(noreplace) /etc/default/%{name}-%1 \
+%config(noreplace) %{etc_default}/%{name}-%1 \
%post %1 \
chkconfig --add %{name}-%1 \
\