This is an automated email from the ASF dual-hosted git repository.

guyuqi 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 28fd2761a BIGTOP-3925: Ranger  support (#1100)
28fd2761a is described below

commit 28fd2761a1cda103ade502fe60b96082cff37827
Author: jialiang <[email protected]>
AuthorDate: Fri May 19 14:41:05 2023 +0800

    BIGTOP-3925: Ranger  support (#1100)
---
 .../src/common/ranger/install_ranger.sh            |  68 +++++++--
 .../src/common/ranger/patch0-RANGER-3373.diff      |  33 -----
 .../src/common/ranger/patch0-RANGER-4201.diff      |  25 ++++
 .../src/common/ranger/patch1-RANGER-3818.diff      |  22 ---
 .../src/common/ranger/patch1-RANGER-4228.diff      |  26 ++++
 bigtop-packages/src/rpm/ranger/SPECS/ranger.spec   | 155 +++++++++++++++++++--
 bigtop.bom                                         |   3 +-
 7 files changed, 251 insertions(+), 81 deletions(-)

diff --git a/bigtop-packages/src/common/ranger/install_ranger.sh 
b/bigtop-packages/src/common/ranger/install_ranger.sh
index 89c22f002..23530fd37 100644
--- a/bigtop-packages/src/common/ranger/install_ranger.sh
+++ b/bigtop-packages/src/common/ranger/install_ranger.sh
@@ -39,6 +39,7 @@ OPTS=$(getopt \
   -l 'doc-dir:' \
   -l 'comp-dir:' \
   -l 'var-ranger:' \
+  -l 'etc-ranger:' \
   -l 'component:' \
   -- "$@")
 
@@ -67,6 +68,9 @@ while true ; do
         --var-ranger)
         VAR_RANGER=$2 ; shift 2
         ;;
+        --etc-ranger)
+        ETC_RANGER=$2 ; shift 2
+        ;;
         --)
         shift ; break
         ;;
@@ -78,7 +82,7 @@ while true ; do
     esac
 done
 
-for var in PREFIX BUILD_DIR COMPONENT ; do
+for var in PREFIX BUILD_DIR COMPONENT; do
   if [ -z "$(eval "echo \$$var")" ]; then
     echo Missing param: $var
     usage
@@ -87,6 +91,8 @@ done
 
 COMP_DIR=${COMP_DIR:-/usr/lib/ranger-${COMPONENT}}
 VAR_RANGER=${VAR_RANGER:-/var/lib/ranger}
+ETC_RANGER=${ETC_RANGER:-/etc/ranger}
+NP_ETC_RANGER=/etc/ranger
 # if [ "${COMP_DIR}" == "" ]
 # then
        # COMP_DIR=/usr/lib/ranger-${COMPONENT}
@@ -101,19 +107,53 @@ install -d -m 0755 ${PREFIX}/var/{log,run}/ranger
 # Copy artifacts to the appropriate Linux locations.
 cp -r ${BUILD_DIR}/ranger-*-${COMPONENT}/* ${PREFIX}/${COMP_DIR}/
 
-# For other Components
-if [[ "${COMPONENT}" = "hive-plugin" || "${COMPONENT}" = "hbase-plugin" || 
"${COMPONENT}" = "storm-plugin" || "${COMPONENT}" = "hdfs-plugin" || 
"${COMPONENT}" = "yarn-plugin" || "${COMPONENT}" = "kafka-plugin" || 
"${COMPONENT}" = "atlas-plugin" || "${COMPONENT}" = "knox-plugin" ]]
-then
+# Config
+if [[ "${COMPONENT}" =~ ^(admin|usersync|tagsync|kms)$ ]]; then
+  install -d -m 0755 ${PREFIX}/${NP_ETC_RANGER}-${COMPONENT}
+  install -d -m 0755 ${PREFIX}/${ETC_RANGER}-${COMPONENT}/conf.dist
+
+  if [[ "${COMPONENT}" = "admin" || "${COMPONENT}" = "kms" ]]; then
+    cp -a ${PREFIX}/${COMP_DIR}/ews/webapp/WEB-INF/classes/conf.dist/* 
${PREFIX}/${ETC_RANGER}-${COMPONENT}/conf.dist
+    ln -s ${NP_ETC_RANGER}-${COMPONENT}/conf ${PREFIX}/${COMP_DIR}/conf
+    ln -s ${NP_ETC_RANGER}-${COMPONENT}/conf 
${PREFIX}/$COMP_DIR/ews/webapp/WEB-INF/classes/conf
+  else
+    cp -a ${PREFIX}/${COMP_DIR}/conf.dist/* 
${PREFIX}/${ETC_RANGER}-${COMPONENT}/conf.dist
+    ln -s ${NP_ETC_RANGER}-${COMPONENT}/conf ${PREFIX}/${COMP_DIR}/conf
+  fi
+else
   RANGER_COMPONENT=${COMPONENT}
-  [[ "${COMPONENT}" = "hdfs-plugin" ]] && RANGER_COMPONENT="hadoop"
-  [[ "${COMPONENT}" = "yarn-plugin" ]] && RANGER_COMPONENT="hadoop"
-  [[ "${COMPONENT}" = "storm-plugin" ]] && RANGER_COMPONENT="storm"
-  [[ "${COMPONENT}" = "hbase-plugin" ]] && RANGER_COMPONENT="hbase"
-  [[ "${COMPONENT}" = "hive-plugin" ]] && RANGER_COMPONENT="hive"
-  [[ "${COMPONENT}" = "kafka-plugin" ]] && RANGER_COMPONENT="kafka"
-  [[ "${COMPONENT}" = "atlas-plugin" ]] && RANGER_COMPONENT="atlas"
-  [[ "${COMPONENT}" = "knox-plugin" ]] && RANGER_COMPONENT="knox"
+  if [[ "${COMPONENT}" = "hdfs-plugin" || "${COMPONENT}" = "yarn-plugin" 
]];then
+    RANGER_COMPONENT="hadoop"
+  else
+    RANGER_COMPONENT=$(echo $COMPONENT | cut -d '-' -f 1)
+  fi
   RANGER_COMPONENT_DIR=${COMP_DIR}/../${RANGER_COMPONENT}
-  install -d -m 0755 ${PREFIX}/${RANGER_COMPONENT_DIR}/lib
-  cp -r $BUILD_DIR/ranger-*-${COMPONENT}/lib/* 
${PREFIX}/${RANGER_COMPONENT_DIR}/lib/
+  COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/lib/
+
+  if [ "${RANGER_COMPONENT}" = "knox" ]; then
+    COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/ext
+  elif [ "${RANGER_COMPONENT}" = "solr" ]; then
+    
COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/server/solr-webapp/webapp/WEB-INF/lib/
+  elif [ "${RANGER_COMPONENT}" = "kafka" ]; then
+    COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/libs
+  elif [ "${RANGER_COMPONENT}" = "storm" ]; then
+    COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/extlib-daemon
+  elif [ "${RANGER_COMPONENT}" = "atlas" ]; then
+    COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/libext
+  elif [ "${RANGER_COMPONENT}" = "sqoop" ]; then
+    COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/server/lib
+  elif [ "${RANGER_COMPONENT}" = "kylin" ]; then
+    
COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/tomcat/webapps/kylin/WEB-INF/lib
+  elif [ "${RANGER_COMPONENT}" = "elasticsearch" ]; then
+    COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/plugins
+  elif [ "${RANGER_COMPONENT}" = "presto" ]; then
+    COMPONENT_LIB_DIR=${PREFIX}/${RANGER_COMPONENT_DIR}/plugin/ranger
+    if [ ! -d "${COMPONENT_LIB_DIR}" ]; then
+      echo "INFO: Creating ${COMPONENT_LIB_DIR}"
+      mkdir -p ${COMPONENT_LIB_DIR}
+    fi
+  fi
+
+  install -d -m 0755 ${COMPONENT_LIB_DIR}
+  cp -r $BUILD_DIR/ranger-*-${COMPONENT}/lib/* ${COMPONENT_LIB_DIR}
 fi
diff --git a/bigtop-packages/src/common/ranger/patch0-RANGER-3373.diff 
b/bigtop-packages/src/common/ranger/patch0-RANGER-3373.diff
deleted file mode 100644
index f649d430f..000000000
--- a/bigtop-packages/src/common/ranger/patch0-RANGER-3373.diff
+++ /dev/null
@@ -1,33 +0,0 @@
-diff --git 
a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java
 
b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java
-index 9be691485..bdbd711d1 100644
---- 
a/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java
-+++ 
b/hbase-agent/src/main/java/org/apache/ranger/authorization/hbase/RangerAuthorizationCoprocessor.java
-@@ -788,7 +788,7 @@ public void 
postStartMaster(ObserverContext<MasterCoprocessorEnvironment> ctx) t
-                       Throwable var3 = null;
- 
-                       try {
--                              
if(!admin.tableExists(AccessControlLists.ACL_TABLE_NAME)) {
-+                              
if(!admin.tableExists(PermissionStorage.ACL_TABLE_NAME)) {
-                                       createACLTable(admin);
-                               }
-                       } catch (Throwable var12) {
-@@ -812,8 +812,8 @@ public void 
postStartMaster(ObserverContext<MasterCoprocessorEnvironment> ctx) t
-       }
- 
-       private static void createACLTable(Admin admin) throws IOException {
--              ColumnFamilyDescriptor cfd = 
ColumnFamilyDescriptorBuilder.newBuilder(AccessControlLists.ACL_LIST_FAMILY).setMaxVersions(1).setInMemory(true).setBlockCacheEnabled(true).setBlocksize(8192).setBloomFilterType(BloomType.NONE).setScope(0).build();
--              TableDescriptor td = 
TableDescriptorBuilder.newBuilder(AccessControlLists.ACL_TABLE_NAME).addColumnFamily(cfd).build();
-+              ColumnFamilyDescriptor cfd = 
ColumnFamilyDescriptorBuilder.newBuilder(PermissionStorage.ACL_LIST_FAMILY).setMaxVersions(1).setInMemory(true).setBlockCacheEnabled(true).setBlocksize(8192).setBloomFilterType(BloomType.NONE).setScope(0).build();
-+              TableDescriptor td = 
TableDescriptorBuilder.newBuilder(PermissionStorage.ACL_TABLE_NAME).addColumnFamily(cfd).build();
-               admin.createTable(td);
-       }
- 
-@@ -1403,7 +1403,7 @@ public void getUserPermissions(RpcController controller, 
AccessControlProtos.Get
-                               });
-                               if (_userUtils.isSuperUser(user)) {
-                                       perms.add(new 
UserPermission(_userUtils.getUserAsString(user),
--                                                                   
Permission.newBuilder(AccessControlLists.ACL_TABLE_NAME).withActions(Action.values()).build()));
-+                                                                   
Permission.newBuilder(PermissionStorage.ACL_TABLE_NAME).withActions(Action.values()).build()));
-                               }
-                       }
-                       response = 
AccessControlUtil.buildGetUserPermissionsResponse(perms);
diff --git a/bigtop-packages/src/common/ranger/patch0-RANGER-4201.diff 
b/bigtop-packages/src/common/ranger/patch0-RANGER-4201.diff
new file mode 100644
index 000000000..09d810366
--- /dev/null
+++ b/bigtop-packages/src/common/ranger/patch0-RANGER-4201.diff
@@ -0,0 +1,25 @@
+From 883bb085e25d4a082740af10b9452fb3b198532e Mon Sep 17 00:00:00 2001
+From: jialiang <[email protected]>
+Date: Sun, 23 Apr 2023 17:56:08 +0800
+Subject: [PATCH] RANGER-4201: fix Hbase master can't start due to
+ ranger-hbase-plugin jersey jar class loading order
+
+---
+ distro/src/main/assembly/hbase-agent.xml | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/distro/src/main/assembly/hbase-agent.xml 
b/distro/src/main/assembly/hbase-agent.xml
+index ff53ca2c2..467f8e5d4 100644
+--- a/distro/src/main/assembly/hbase-agent.xml
++++ b/distro/src/main/assembly/hbase-agent.xml
+@@ -54,7 +54,6 @@
+         <fileMode>644</fileMode>
+         <includes>
+           
<include>com.sun.jersey:jersey-client:jar:${jersey-bundle.version}</include>
+-          
<include>com.sun.jersey:jersey-core:jar:${jersey-bundle.version}</include>
+           
<include>org.codehaus.jackson:jackson-jaxrs:jar:${codehaus.jackson.version}</include>
+           
<include>org.eclipse.jetty:jetty-client:jar:${jetty-client.version}</include>
+           
<include>org.apache.httpcomponents:httpmime:jar:${httpcomponents.httpmime.version}</include>
+-- 
+2.37.0
+
diff --git a/bigtop-packages/src/common/ranger/patch1-RANGER-3818.diff 
b/bigtop-packages/src/common/ranger/patch1-RANGER-3818.diff
deleted file mode 100644
index d5b21e41f..000000000
--- a/bigtop-packages/src/common/ranger/patch1-RANGER-3818.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git 
a/plugin-solr/src/main/java/org/apache/ranger/authorization/solr/authorizer/RangerSolrAuthorizer.java
 
b/plugin-solr/src/main/java/org/apache/ranger/authorization/solr/authorizer/RangerSolrAuthorizer.java
-index 200d03712..0147df423 100644
---- 
a/plugin-solr/src/main/java/org/apache/ranger/authorization/solr/authorizer/RangerSolrAuthorizer.java
-+++ 
b/plugin-solr/src/main/java/org/apache/ranger/authorization/solr/authorizer/RangerSolrAuthorizer.java
-@@ -428,7 +428,7 @@ public void prepare(ResponseBuilder rb) throws IOException 
{
-               if (httpServletRequest == null) {
-                       SolrCore solrCore = rb.req.getCore();
-                       StringBuilder builder = new StringBuilder("Unable to 
locate HttpServletRequest");
--                      if (solrCore != null && 
!solrCore.getSolrConfig().getBool("requestDispatcher/requestParsers/@addHttpRequestToContext",
 true)) {
-+                      if (solrCore != null && 
!solrCore.getSolrConfig().get("requestDispatcher/requestParsers/@addHttpRequestToContext").boolVal(true))
 {
-                               builder.append(", ensure 
requestDispatcher/requestParsers/@addHttpRequestToContext is set to true in 
solrconfig.xml");
-                       }
-                       throw new 
SolrException(SolrException.ErrorCode.UNAUTHORIZED, builder.toString());
-@@ -732,7 +732,7 @@ private final String getUserName(SolrQueryRequest req) {
-               HttpServletRequest httpServletRequest = (HttpServletRequest) 
req.getContext().get("httpRequest");
-               if (httpServletRequest == null) {
-                       StringBuilder builder = new StringBuilder("Unable to 
locate HttpServletRequest");
--                      if (solrCore != null && 
!solrCore.getSolrConfig().getBool("requestDispatcher/requestParsers/@addHttpRequestToContext",
 true)) {
-+                      if (solrCore != null && 
!solrCore.getSolrConfig().get("requestDispatcher/requestParsers/@addHttpRequestToContext").boolVal(true))
 {
-                               builder.append(", ensure 
requestDispatcher/requestParsers/@addHttpRequestToContext is set to true in 
solrconfig.xml");
-                       }
-                       throw new 
SolrException(SolrException.ErrorCode.UNAUTHORIZED, builder.toString());
diff --git a/bigtop-packages/src/common/ranger/patch1-RANGER-4228.diff 
b/bigtop-packages/src/common/ranger/patch1-RANGER-4228.diff
new file mode 100644
index 000000000..af563b26e
--- /dev/null
+++ b/bigtop-packages/src/common/ranger/patch1-RANGER-4228.diff
@@ -0,0 +1,26 @@
+From 094027b2f860a0632d135573cfa8656250de1819 Mon Sep 17 00:00:00 2001
+From: jialiang <[email protected]>
+Date: Mon, 8 May 2023 12:54:01 +0800
+Subject: [PATCH] RANGER-4228 fix kafka missing jar ANGER-4201:  fix  hbase
+ can't start
+
+---
+ distro/src/main/assembly/plugin-kafka.xml | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/distro/src/main/assembly/plugin-kafka.xml 
b/distro/src/main/assembly/plugin-kafka.xml
+index ed8ef6159..3c39aa4de 100644
+--- a/distro/src/main/assembly/plugin-kafka.xml
++++ b/distro/src/main/assembly/plugin-kafka.xml
+@@ -49,6 +49,8 @@
+                               <directoryMode>755</directoryMode>
+                               <fileMode>644</fileMode>
+                               <includes>
++                                      
<include>org.apache.hadoop.thirdparty:hadoop-shaded-guava</include>
++                                      
<include>org.apache.commons:commons-compress</include>
+                                       
<include>org.apache.commons:commons-configuration2:jar:${commons.configuration.version}</include>
+                                       
<include>org.apache.hadoop:hadoop-common:jar:${hadoop.version}</include>
+                                       
<include>org.apache.hadoop:hadoop-common-plus:jar:${hadoop.version}</include>
+-- 
+2.30.1 (Apple Git-130)
+
diff --git a/bigtop-packages/src/rpm/ranger/SPECS/ranger.spec 
b/bigtop-packages/src/rpm/ranger/SPECS/ranger.spec
index 4f3640e4b..988d3af29 100644
--- a/bigtop-packages/src/rpm/ranger/SPECS/ranger.spec
+++ b/bigtop-packages/src/rpm/ranger/SPECS/ranger.spec
@@ -14,9 +14,11 @@
 %undefine _missing_build_ids_terminate_build
 
 %define ranger_name ranger
-
+%define ranger_pkg_name ranger%{pkg_name_suffix}
 %define usr_lib_ranger %{parent_dir}/usr/lib/%{ranger_name}
 %define var_lib_ranger %{parent_dir}/var/lib/%{ranger_name}
+%define etc_ranger %{parent_dir}/etc/%{ranger_name}
+%define np_etc_ranger /etc/%{ranger_name}
 
 %define usr_lib_hadoop %{parent_dir}/usr/lib/hadoop
 %define usr_lib_hive %{parent_dir}/usr/lib/hive
@@ -25,6 +27,11 @@
 %define usr_lib_hbase %{parent_dir}/usr/lib/hbase
 %define usr_lib_kafka %{parent_dir}/usr/lib/kafka
 %define usr_lib_atlas %{parent_dir}/usr/lib/atlas
+%define usr_lib_solr %{parent_dir}/usr/lib/solr
+%define usr_lib_sqoop %{parent_dir}/usr/lib/sqoop
+%define usr_lib_kylin %{parent_dir}/usr/lib/kylin
+%define usr_lib_elasticsearch %{parent_dir}/usr/lib/elasticsearch
+%define usr_lib_presto %{parent_dir}/usr/lib/presto
 
 %define doc_dir %{parent_dir}/%{_docdir}
 
@@ -85,7 +92,7 @@
 # Disable debuginfo package
 %define debug_package %{nil}
 
-Name: %{ranger_name}
+Name: %{ranger_pkg_name}
 Version: %{ranger_base_version}
 Release: %{ranger_release}
 Summary: Ranger is a framework for securing Hadoop data
@@ -97,6 +104,7 @@ Source0: release-%{ranger_name}-%{ranger_base_version}.tar.gz
 Source1: do-component-build
 Source2: install_%{ranger_name}.sh
 #BIGTOP_PATCH_FILES
+Requires: bigtop-utils >= 0.7
 Requires: coreutils, /usr/sbin/useradd, /usr/sbin/usermod, /sbin/chkconfig, 
/sbin/service
 Requires: psmisc
 # Sadly, Sun/Oracle JDK in RPM form doesn't provide libjvm.so, which means we 
have
@@ -336,6 +344,67 @@ AutoReq: no
 %description atlas-plugin
 Ranger ATLAS plugin component runs within atlas to provide enterprise security 
using ranger framework
 
+%package solr-plugin
+Summary: ranger plugin for solr
+Group: System/Daemons
+# On Rocky 8, find-requires picks up /usr/bin/python, but it's not provided by 
any package.
+# So installing ranger-*-plugin fails with a "nothing provides 
/usr/bin/python" message,
+# even when python3 is installed and /usr/bin/python is created as a symlink 
to python3.
+# Therefore we disable find-requires for each plugins with the following 
option.
+AutoReq: no
+
+%description solr-plugin
+Ranger SOLR plugin component runs within solr to provide enterprise security 
using ranger framework
+
+%package sqoop-plugin
+Summary: ranger plugin for sqoop
+Group: System/Daemons
+# On Rocky 8, find-requires picks up /usr/bin/python, but it's not provided by 
any package.
+# So installing ranger-*-plugin fails with a "nothing provides 
/usr/bin/python" message,
+# even when python3 is installed and /usr/bin/python is created as a symlink 
to python3.
+# Therefore we disable find-requires for each plugins with the following 
option.
+AutoReq: no
+
+%description sqoop-plugin
+Ranger SQOOP plugin component runs within sqoop to provide enterprise security 
using ranger framework
+
+%package kylin-plugin
+Summary: ranger plugin for kylin
+Group: System/Daemons
+# On Rocky 8, find-requires picks up /usr/bin/python, but it's not provided by 
any package.
+# So installing ranger-*-plugin fails with a "nothing provides 
/usr/bin/python" message,
+# even when python3 is installed and /usr/bin/python is created as a symlink 
to python3.
+# Therefore we disable find-requires for each plugins with the following 
option.
+AutoReq: no
+
+%description kylin-plugin
+Ranger KYLIN plugin component runs within kylin to provide enterprise security 
using ranger framework
+
+%package elasticsearch-plugin
+Summary: ranger plugin for elasticsearch
+Group: System/Daemons
+# On Rocky 8, find-requires picks up /usr/bin/python, but it's not provided by 
any package.
+# So installing ranger-*-plugin fails with a "nothing provides 
/usr/bin/python" message,
+# even when python3 is installed and /usr/bin/python is created as a symlink 
to python3.
+# Therefore we disable find-requires for each plugins with the following 
option.
+AutoReq: no
+
+%description elasticsearch-plugin
+Ranger ELASTICSEARCH plugin component runs within elasticsearch to provide 
enterprise security using ranger framework
+
+%package presto-plugin
+Summary: ranger plugin for presto
+Group: System/Daemons
+# On Rocky 8, find-requires picks up /usr/bin/python, but it's not provided by 
any package.
+# So installing ranger-*-plugin fails with a "nothing provides 
/usr/bin/python" message,
+# even when python3 is installed and /usr/bin/python is created as a symlink 
to python3.
+# Therefore we disable find-requires for each plugins with the following 
option.
+AutoReq: no
+
+%description presto-plugin
+Ranger PRESTO plugin component runs within presto to provide enterprise 
security using ranger framework
+
+
 %prep
 %setup -q -n %{ranger_name}-release-%{ranger_name}-%{ranger_base_version}
 
@@ -352,7 +421,7 @@ bash %{SOURCE1}
 #########################
 %install
 %__rm -rf $RPM_BUILD_ROOT
-for comp in admin usersync kms tagsync hdfs-plugin yarn-plugin hive-plugin 
hbase-plugin knox-plugin storm-plugin kafka-plugin atlas-plugin
+for comp in admin usersync kms tagsync hdfs-plugin yarn-plugin hive-plugin 
hbase-plugin knox-plugin storm-plugin kafka-plugin atlas-plugin sqoop-plugin 
solr-plugin kylin-plugin elasticsearch-plugin presto-plugin
 do
        env RANGER_VERSION=%{ranger_base_version} /bin/bash %{SOURCE2} \
                --prefix=$RPM_BUILD_ROOT \
@@ -360,6 +429,7 @@ do
                --component=${comp} \
         --comp-dir=%{usr_lib_ranger}-${comp} \
         --var-ranger=%{var_lib_ranger} \
+        --etc-ranger=%{etc_ranger} \
                --doc-dir=$RPM_BUILD_ROOT/%{doc_ranger}
 done
 
@@ -369,22 +439,52 @@ done
 getent group ranger >/dev/null || groupadd -r ranger
 getent passwd ranger >/dev/null || useradd -c "Ranger" -s /bin/bash -g ranger 
-m -d %{var_lib_ranger} ranger 2> /dev/null || :
 
+%post admin
+%{alternatives_cmd} --install %{np_etc_ranger}-admin/conf ranger-admin-conf 
%{etc_ranger}-admin/conf.dist 30
+
+%preun admin
+if [ "$1" = 0 ]; then
+        %{alternatives_cmd} --remove ranger-admin-conf 
%{etc_ranger}-admin/conf.dist || :
+fi
+
 %pre usersync
 getent group ranger >/dev/null || groupadd -r ranger
 getent passwd ranger >/dev/null || useradd -c "Ranger" -s /bin/bash -g ranger 
-m -d %{var_lib_ranger}} ranger 2> /dev/null || :
 
+%post usersync
+%{alternatives_cmd} --install %{np_etc_ranger}-usersync/conf 
ranger-usersync-conf %{etc_ranger}-usersync/conf.dist 30
+if [ -f %{usr_lib_ranger}-usersync/native/credValidator.uexe ]; then
+    chmod u+s %{usr_lib_ranger}-usersync/native/credValidator.uexe
+fi
+
+%preun usersync
+if [ "$1" = 0 ]; then
+        %{alternatives_cmd} --remove ranger-usersync-conf 
%{etc_ranger}-usersync/conf.dist || :
+fi
+
 %pre kms
 getent group ranger >/dev/null || groupadd -r ranger
 getent passwd ranger >/dev/null || useradd -c "Ranger" -s /bin/bash -g ranger 
-m -d %{var_lib_ranger} ranger 2> /dev/null || :
 
+%post kms
+%{alternatives_cmd} --install %{np_etc_ranger}-kms/conf ranger-kms-conf 
%{etc_ranger}-kms/conf.dist 30
+
+%preun kms
+if [ "$1" = 0 ]; then
+        %{alternatives_cmd} --remove ranger-kms-conf 
%{etc_ranger}-kms/conf.dist || :
+fi
+
 %pre tagsync
 getent group ranger >/dev/null || groupadd -r ranger
 getent passwd ranger >/dev/null || useradd -c "Ranger" -s /bin/bash -g ranger 
-m -d %{var_lib_ranger} ranger 2> /dev/null || :
 
-%post usersync
-if [ -f %{usr_lib_ranger}-usersync/native/credValidator.uexe ]; then
-    chmod u+s %{usr_lib_ranger}-usersync/native/credValidator.uexe
-fi
+%post tagsync
+%{alternatives_cmd} --install %{np_etc_ranger}-tagsync/conf 
ranger-tagsync-conf %{etc_ranger}-tagsync/conf.dist 30
+
+%preun tagsync
+if [ "$1" = 0 ]; then
+        %{alternatives_cmd} --remove ranger-tagsync-conf 
%{etc_ranger}-tagsync/conf.dist || :
+
 
 %preun
 
@@ -397,20 +497,28 @@ fi
 %defattr(-,root,root,755)
 %attr(0775,ranger,ranger) %{var_lib_ranger}
 %attr(0775,ranger,ranger) %{np_var_run_ranger}
+%config(noreplace) %{etc_ranger}-admin/conf.dist
+%attr(0755,ranger,ranger) %{np_etc_ranger}-admin
 %{usr_lib_ranger}-admin
 
 %files usersync
 %defattr(-,root,root,755)
 %{usr_lib_ranger}-usersync
 %attr(750,root,ranger) %{usr_lib_ranger}-usersync/native/credValidator.uexe
+%config(noreplace) %{etc_ranger}-usersync/conf.dist
+%attr(0755,ranger,ranger) %{np_etc_ranger}-usersync
 
 %files kms
 %defattr(-,root,root,755)
 %{usr_lib_ranger}-kms
+%config(noreplace) %{etc_ranger}-kms/conf.dist
+%attr(0755,ranger,ranger) %{np_etc_ranger}-kms
 
 %files tagsync
 %defattr(-,root,root,755)
 %{usr_lib_ranger}-tagsync
+%config(noreplace) %{etc_ranger}-tagsync/conf.dist
+%attr(0755,ranger,ranger) %{np_etc_ranger}-tagsync
 
 %files hdfs-plugin
 %defattr(-,root,root,755)
@@ -435,19 +543,44 @@ fi
 %files knox-plugin
 %defattr(-,root,root,755)
 %{usr_lib_ranger}-knox-plugin
-%{usr_lib_knox}/lib
+%{usr_lib_knox}/ext
 
 %files storm-plugin
 %defattr(-,root,root,755)
 %{usr_lib_ranger}-storm-plugin
-%{usr_lib_storm}/lib
+%{usr_lib_storm}/extlib-daemon
 
 %files kafka-plugin
 %defattr(-,root,root,755)
 %{usr_lib_ranger}-kafka-plugin
-%{usr_lib_kafka}/lib
+%{usr_lib_kafka}/libs
 
 %files atlas-plugin
 %defattr(-,root,root,755)
 %{usr_lib_ranger}-atlas-plugin
-%{usr_lib_atlas}/lib
+%{usr_lib_atlas}/libext
+
+%files solr-plugin
+%defattr(-,root,root,755)
+%{usr_lib_ranger}-solr-plugin
+%{usr_lib_solr}/server/solr-webapp/webapp/WEB-INF/lib/
+
+%files sqoop-plugin
+%defattr(-,root,root,755)
+%{usr_lib_ranger}-sqoop-plugin
+%{usr_lib_sqoop}/server/lib
+
+%files kylin-plugin
+%defattr(-,root,root,755)
+%{usr_lib_ranger}-kylin-plugin
+%{usr_lib_kylin}/tomcat/webapps/kylin/WEB-INF/lib
+
+%files elasticsearch-plugin
+%defattr(-,root,root,755)
+%{usr_lib_ranger}-elasticsearch-plugin
+%{usr_lib_elasticsearch}/plugins
+
+%files presto-plugin
+%defattr(-,root,root,755)
+%{usr_lib_ranger}-presto-plugin
+%{usr_lib_presto}/plugin/ranger
diff --git a/bigtop.bom b/bigtop.bom
index be3e4cfe5..d4d2432a3 100644
--- a/bigtop.bom
+++ b/bigtop.bom
@@ -369,8 +369,9 @@ bigtop {
     }
     'ranger' {
       name    = 'ranger'
+      rpm_pkg_suffix = "_" + bigtop.base_version.replace(".", "_")
       relNotes = 'Apache Ranger'
-      version { base = '2.3.0'; pkg = base; release = 1 }
+      version { base = '2.4.0'; pkg = base; release = 1 }
       tarball { destination = "release-$name-${version.base}.tar.gz"
                 source      = destination }
       url     { site = "https://github.com/apache/ranger/archive/refs/tags";

Reply via email to