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 cb24e6a1 BIGTOP-3847: Set bigtop-select to be consistent with
-PparentDir (#1038)
cb24e6a1 is described below
commit cb24e6a1e021e51fea1ee6b684a0b69b9cfc7192
Author: timyuer <[email protected]>
AuthorDate: Sat Oct 15 13:51:04 2022 +0800
BIGTOP-3847: Set bigtop-select to be consistent with -PparentDir (#1038)
---
.../src/common/bigtop-select/conf-select | 3 +-
.../src/common/bigtop-select/distro-select | 5 ++-
.../src/common/bigtop-select/install_select.sh | 45 +++++++++++++++++++---
.../src/rpm/bigtop-select/SPECS/bigtop-select.spec | 16 +++++---
packages.gradle | 11 +++++-
5 files changed, 66 insertions(+), 14 deletions(-)
diff --git a/bigtop-packages/src/common/bigtop-select/conf-select
b/bigtop-packages/src/common/bigtop-select/conf-select
index 52c4cc9f..d7186fb4 100644
--- a/bigtop-packages/src/common/bigtop-select/conf-select
+++ b/bigtop-packages/src/common/bigtop-select/conf-select
@@ -22,9 +22,10 @@ import os
import re
import sys
import errno
+from params import stack_root
# The global prefix and current directory
-root = "/usr/bigtop"
+root = stack_root
current = root + "/current"
vconfroot = 'etc'
lib_root = "usr/lib"
diff --git a/bigtop-packages/src/common/bigtop-select/distro-select
b/bigtop-packages/src/common/bigtop-select/distro-select
index a99b80a1..58c06f73 100644
--- a/bigtop-packages/src/common/bigtop-select/distro-select
+++ b/bigtop-packages/src/common/bigtop-select/distro-select
@@ -21,10 +21,11 @@ import copy
import os
import re
import sys
+from params import stack_root, stack_version
# The global prefix and current directory
-root = "/usr/bigtop"
-bigtop_version = "3.2.0"
+root = stack_root
+bigtop_version = stack_version
current = root + "/current"
lib_root = "/usr/lib"
bin_directory = "/usr/bin"
diff --git a/bigtop-packages/src/common/bigtop-select/install_select.sh
b/bigtop-packages/src/common/bigtop-select/install_select.sh
index 8101805d..b5b88c95 100644
--- a/bigtop-packages/src/common/bigtop-select/install_select.sh
+++ b/bigtop-packages/src/common/bigtop-select/install_select.sh
@@ -21,9 +21,11 @@ usage() {
echo "
usage: $0 <options>
Required not-so-options:
- --distro-dir=DIR path to distro specific files (debian/RPM)
- --build-dir=DIR path to build directory
- --prefix=PREFIX path to install into
+ --distro-dir=DIR path to distro specific
files (debian/RPM)
+ --build-dir=DIR path to build directory
+ --prefix=PREFIX path to install into
+ --parent-dir=PARENT_DIR path to install
stack-root/stack-version
+ --bigtop-base-version=BIGTOP_BASE_VERSION Bigtop Base Version
"
exit 1
}
@@ -33,6 +35,8 @@ OPTS=$(getopt \
-l 'prefix:' \
-l 'distro-dir:' \
-l 'build-dir:' \
+ -l 'parent-dir:' \
+ -l 'bigtop-base-version:' \
-- "$@")
if [ $? != 0 ] ; then
usage
@@ -40,6 +44,12 @@ fi
eval set -- "$OPTS"
while true ; do
case "$1" in
+ --parent-dir)
+ PARENT_DIR=$2 ; shift 2
+ ;;
+ --bigtop-base-version)
+ BIGTOP_BASE_VERSION=$2 ; shift 2
+ ;;
--prefix)
PREFIX=$2 ; shift 2
;;
@@ -67,12 +77,37 @@ LIB_DIR=${LIB_DIR:-/usr/lib/bigtop-select}
BIN_DIR=${BIN_DIR:-/usr/bin}
CONF_DIR=${CONF_DIR:-/etc/bigtop-select/conf.dist}
-STACK_ROOT_DIR=/usr/bigtop
+STACK_ROOT_DIR=$(echo ${PARENT_DIR} | sed -e "s/\/${BIGTOP_BASE_VERSION}$//")
STACK_SELECTOR=distro-select
CONF_SELECTOR=conf-select
# Install packages
install -d -p -m 755 $PREFIX${LIB_DIR}/
-install -d -p -m 755 $PREFIX${STACK_ROOT_DIR}/
+install -d -p -m 755 $PREFIX${PARENT_DIR}/
install -p -m 755 ${DISTRO_DIR}/${STACK_SELECTOR} $PREFIX${LIB_DIR}/
install -p -m 755 ${DISTRO_DIR}/${CONF_SELECTOR} $PREFIX${LIB_DIR}/
+cat > $PREFIX${LIB_DIR}/params.py <<EOF
+#!/usr/bin/env python2
+#
+# 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.
+#
+
+stack_root = '${STACK_ROOT_DIR}'
+stack_version = '${BIGTOP_BASE_VERSION}'
+
+EOF
+chmod 755 $PREFIX${LIB_DIR}/params.py
\ No newline at end of file
diff --git a/bigtop-packages/src/rpm/bigtop-select/SPECS/bigtop-select.spec
b/bigtop-packages/src/rpm/bigtop-select/SPECS/bigtop-select.spec
index 1d748836..e62abdc2 100644
--- a/bigtop-packages/src/rpm/bigtop-select/SPECS/bigtop-select.spec
+++ b/bigtop-packages/src/rpm/bigtop-select/SPECS/bigtop-select.spec
@@ -13,9 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-%define lib_dir /usr/lib/bigtop-select
-%define bin_dir /usr/bin
-%define stack_root_dir /usr/bigtop
+%define lib_dir /usr/lib/bigtop-select
+%define bin_dir /usr/bin
+%define default_parent_dir /usr/bigtop/%{bigtop_base_version}
+%if "%{parent_dir}" != ""
+%define default_parent_dir %{parent_dir}
+%endif
Name: bigtop-select
Version: %{bigtop_select_version}
@@ -52,6 +55,7 @@ install -p -m 755 %{SOURCE1} .
install -p -m 755 %{SOURCE2} .
install -p -m 755 %{SOURCE3} .
+
%build
@@ -59,7 +63,9 @@ install -p -m 755 %{SOURCE3} .
bash %{SOURCE0} \
--distro-dir=${RPM_SOURCE_DIR} \
--build-dir=${PWD} \
- --prefix=${RPM_BUILD_ROOT}
+ --prefix=${RPM_BUILD_ROOT} \
+ --parent-dir=%{default_parent_dir} \
+ --bigtop-base-version=%{bigtop_base_version}
%clean
rm -rf $RPM_BUILD_ROOT
@@ -70,7 +76,7 @@ rm -rf $RPM_BUILD_ROOT
%doc LICENSE
%{lib_dir}
-%{stack_root_dir}
+%{default_parent_dir}
%changelog
diff --git a/packages.gradle b/packages.gradle
index ed51e647..34ad3a11 100644
--- a/packages.gradle
+++ b/packages.gradle
@@ -490,6 +490,14 @@ def genTasks = { target ->
def final MAVEN_REPO_URI = project.hasProperty('mavenRepoUri') ?
project.property('mavenRepoUri') : null
def final PARENT_DIR = project.hasProperty("parentDir") ?
project.property('parentDir') : "%{nil}"
+ def final mpackVersionRegex = /^(?<version>[0-9]+\.[0-9]+\.[0-9]+)-.*/
+ def FULL_PARENT_DIR = "${PARENT_DIR}"
+ def matcher = "${config.bigtop.version}" =~ mpackVersionRegex
+ matcher.matches()
+ def BIGTOP_BASE_VERSION = matcher.group("version")
+ if (PARENT_DIR != "%{nil}") {
+ FULL_PARENT_DIR = "${PARENT_DIR}/${BIGTOP_BASE_VERSION}"
+ }
def command = [
'--define', "_topdir $PKG_BUILD_DIR/rpm/",
@@ -500,7 +508,8 @@ def genTasks = { target ->
'--rebuild', SRCRPM,
'--define', "do_maven_deploy ${DO_MAVEN_DEPLOY}",
'--define', "maven_deploy_source ${MAVEN_DEPLOY_SOURCE}",
- "--define", "parent_dir ${PARENT_DIR}"
+ "--define", "parent_dir ${FULL_PARENT_DIR}",
+ "--define", "bigtop_base_version ${BIGTOP_BASE_VERSION}"
]
if (MAVEN_REPO_URI != null) {