Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIGTOP-3977: Support appending suffix to phoenix rpm package name #1159

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
BIGTOP-3977: Support appending suffix to phoenix rpm package name
  • Loading branch information
smallyao committed Aug 3, 2023
commit a6b00944eb5ca3738ad223827b74cd1f11f61023
8 changes: 7 additions & 1 deletion bigtop-packages/src/common/phoenix/install_phoenix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ usage: $0 <options>
--lib-dir=DIR path to install phoenix home [/usr/lib/phoenix]
--installed-lib-dir=DIR path where lib-dir will end up on target system
--bin-dir=DIR path to install bins [/usr/bin]
--var-lib-dir=DIR path to install phoenix contents [/var/lib/phoenix]
--examples-dir=DIR path to install examples [doc-dir/examples]
... [ see source for more similar options ]
"
Expand All @@ -45,6 +46,7 @@ OPTS=$(getopt \
-l 'bin-dir:' \
-l 'examples-dir:' \
-l 'conf-dir:' \
-l 'var-lib-dir:' \
-l 'build-dir:' -- "$@")

if [ $? != 0 ] ; then
Expand Down Expand Up @@ -78,6 +80,9 @@ while true ; do
--conf-dir)
CONF_DIR=$2 ; shift 2
;;
--var-lib-dir)
VAR_LIB_DIR=$2 ; shift 2
;;
--)
shift ; break
;;
Expand All @@ -102,6 +107,7 @@ LIB_DIR=${LIB_DIR:-/usr/lib/phoenix}
BIN_DIR=${BIN_DIR:-/usr/lib/phoenix/bin}
ETC_DIR=${ETC_DIR:-/etc/phoenix}
CONF_DIR=${CONF_DIR:-${ETC_DIR}/conf.dist}
VAR_LIB_DIR=${VAR_LIB_DIR:-/var/lib/phoenix}

install -d -m 0755 $PREFIX/$BIN_DIR
install -d -m 0755 $PREFIX/$LIB_DIR
Expand All @@ -110,7 +116,7 @@ install -d -m 0755 $PREFIX/$DOC_DIR
install -d -m 0755 $PREFIX/$MAN_DIR
install -d -m 0755 $PREFIX/$ETC_DIR
install -d -m 0755 $PREFIX/$CONF_DIR
install -d -m 0755 $PREFIX/var/lib/phoenix
install -d -m 0755 $PREFIX/$VAR_LIB_DIR
install -d -m 0755 $PREFIX/var/log/phoenix

cp $BUILD_DIR/*.jar $PREFIX/$LIB_DIR/
Expand Down
43 changes: 24 additions & 19 deletions bigtop-packages/src/rpm/phoenix/SPECS/phoenix.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@
# 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 phoenix_home /usr/lib/%{name}
%define phoenix_name phoenix
%define phoenix_pkg_name phoenix%{pkg_name_suffix}
%define phoenix_home %{parent_dir}/usr/lib/%{phoenix_name}
%define bin_phoenix %{phoenix_home}/bin
%define examples_phoenix %{phoenix_home}/examples
%define etc_phoenix_conf %{_sysconfdir}/%{name}/conf
%define etc_phoenix_conf %{_sysconfdir}/%{phoenix_name}/conf
%define etc_phoenix_conf_dist %{etc_phoenix_conf}.dist
%define var_lib_phoenix /var/lib/%{name}
%define var_log_phoenix /var/log/%{name}
%define var_lib_phoenix %{parent_dir}/var/lib/%{phoenix_name}
%define var_log_phoenix /var/log/%{phoenix_name}
%define man_dir %{_mandir}
%define zookeeper_home /usr/lib/zookeeper
%define hadoop_home /usr/lib/hadoop
%define hadoop_mapreduce_home /usr/lib/hadoop-mapreduce
%define hadoop_yarn_home /usr/lib/hadoop-yarn
%define hadoop_hdfs_home /usr/lib/hadoop-hdfs
%define hbase_home /usr/lib/hbase
%define zookeeper_home %{parent_dir}/usr/lib/zookeeper
%define hadoop_home %{parent_dir}/usr/lib/hadoop
%define hadoop_mapreduce_home %{parent_dir}/usr/lib/hadoop-mapreduce
%define hadoop_yarn_home %{parent_dir}/usr/lib/hadoop-yarn
%define hadoop_hdfs_home %{parent_dir}/usr/lib/hadoop-hdfs
%define hbase_home %{parent_dir}/usr/lib/hbase
#BIGTOP_PATCH_FILES

%if %{?suse_version:1}0
Expand All @@ -45,7 +47,7 @@
/usr/lib/rpm/brp-compress ; \
%{nil}

%define doc_phoenix %{_docdir}/%{name}
%define doc_phoenix %{_docdir}/%{phoenix_name}
%define alternatives_cmd update-alternatives

%else
Expand All @@ -67,20 +69,20 @@
%{nil}
%endif

%define doc_phoenix %{_docdir}/%{name}-%{phoenix_version}
%define doc_phoenix %{_docdir}/%{phoenix_name}-%{phoenix_version}
%define alternatives_cmd alternatives

%endif

Name: phoenix
Name: %{phoenix_pkg_name}
Version: %{phoenix_version}
Release: %{phoenix_release}
Summary: Phoenix is a SQL skin over HBase and client-embedded JDBC driver.
URL: http://phoenix.apache.org
Group: Development/Libraries
Buildroot: %{_topdir}/INSTALL/%{name}-%{version}
Buildroot: %{_topdir}/INSTALL/%{phoenix_name}-%{version}
License: ASL 2.0
Source0: %{name}-%{phoenix_base_version}-src.tar.gz
Source0: %{phoenix_name}-%{phoenix_base_version}-src.tar.gz
Source1: do-component-build
Source2: install_phoenix.sh
Source3: bigtop.bom
Expand Down Expand Up @@ -109,7 +111,7 @@ tens of millions of rows. Applications interact with Phoenix through a
standard JDBC interface; all the usual interfaces are supported.

%prep
%setup -n %{name}-%{phoenix_base_version}
%setup -n %{phoenix_name}-%{phoenix_base_version}
#BIGTOP_PATCH_COMMANDS

%build
Expand All @@ -120,14 +122,17 @@ bash %{SOURCE1}
bash %{SOURCE2} \
--build-dir=build \
--doc-dir=%{doc_phoenix} \
--prefix=$RPM_BUILD_ROOT
--prefix=$RPM_BUILD_ROOT \
--bin-dir=%{bin_phoenix} \
--lib-dir=%{phoenix_home} \
--var-lib-dir=%{var_lib_phoenix}

%pre
getent group phoenix >/dev/null || groupadd -r phoenix
getent passwd phoenix >/dev/null || useradd -c "Phoenix" -s /sbin/nologin -g phoenix -r -d %{var_lib_phoenix} phoenix 2> /dev/null || :

%post
%{alternatives_cmd} --install %{etc_phoenix_conf} %{name}-conf %{etc_phoenix_conf_dist} 30
%{alternatives_cmd} --install %{etc_phoenix_conf} %{phoenix_name}-conf %{etc_phoenix_conf_dist} 30

%if 0%{?rhel} >= 8
%{alternatives_cmd} --set python /usr/bin/python3
Expand All @@ -136,7 +141,7 @@ getent passwd phoenix >/dev/null || useradd -c "Phoenix" -s /sbin/nologin -g pho

%preun
if [ "$1" = 0 ]; then
%{alternatives_cmd} --remove %{name}-conf %{etc_phoenix_conf_dist} || :
%{alternatives_cmd} --remove %{phoenix_name}-conf %{etc_phoenix_conf_dist} || :
fi


Expand Down
1 change: 1 addition & 0 deletions bigtop.bom
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ bigtop {

'phoenix' {
name = 'phoenix'
rpm_pkg_suffix = "_" + bigtop.base_version.replace(".", "_")
relNotes = 'Apache Phoenix: A SQL skin over HBase'
version { base = "5.1.2"; pkg = base; release = 1 }
tarball { destination = "$name-${version.base}-src.tar.gz"
Expand Down