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
commit 4087cfc576bceec8db552e432a5250c779509a14 Author: MacChen01 <[email protected]> AuthorDate: Tue Sep 12 10:06:58 2023 +0800 BIGTOP-3882: add support for ambari (#1147) (cherry picked from commit 5599a710530fbf0c97c626084c41782521f2f634) --- .../src/common/ambari/do-component-build | 7 ++ .../common/ambari/patch14-support-openeuler.diff | 97 ++++++++++++++++++++++ bigtop-packages/src/rpm/ambari/SPECS/ambari.spec | 8 ++ 3 files changed, 112 insertions(+) diff --git a/bigtop-packages/src/common/ambari/do-component-build b/bigtop-packages/src/common/ambari/do-component-build index 393e89687..d552af299 100644 --- a/bigtop-packages/src/common/ambari/do-component-build +++ b/bigtop-packages/src/common/ambari/do-component-build @@ -24,6 +24,13 @@ OS="$ID" ARCH=`uname -m` RPM_DIR=../../../../../output/ambari +if [ "${OS}" = "openEuler" ]; then + for i in `grep -rn "/usr/bin/env python"|awk -F ":" '{print $1}'`; + do + sed -i "s|/usr/bin/env python|/usr/bin/env python2|g" $i; + done +fi + mvn clean package -DskipTests -Drat.skip # BIGTOP-3800: diff --git a/bigtop-packages/src/common/ambari/patch14-support-openeuler.diff b/bigtop-packages/src/common/ambari/patch14-support-openeuler.diff new file mode 100644 index 000000000..7d393fb1c --- /dev/null +++ b/bigtop-packages/src/common/ambari/patch14-support-openeuler.diff @@ -0,0 +1,97 @@ +diff -Naur apache-ambari-2.7.5-src/ambari-common/src/main/python/ambari_commons/os_check.py apache-ambari-2.7.5-src-openEuler/ambari-common/src/main/python/ambari_commons/os_check.py +--- apache-ambari-2.7.5-src/ambari-common/src/main/python/ambari_commons/os_check.py 2019-12-13 10:48:37.000000000 +0000 ++++ apache-ambari-2.7.5-src-openEuler/ambari-common/src/main/python/ambari_commons/os_check.py 2023-08-04 08:41:06.538247662 +0000 +@@ -77,6 +77,7 @@ + # Linux specific releases, caching them since they are execution invariants + _IS_ORACLE_LINUX = os.path.exists('/etc/oracle-release') + _IS_REDHAT_LINUX = os.path.exists('/etc/redhat-release') ++_IS_OPENEULER_LINUX = os.path.exists('/etc/openEuler-release') + + OS_RELEASE_FILE = "/etc/os-release" + +@@ -89,6 +90,9 @@ + def _is_powerpc(): + return platform.processor() == 'powerpc' or platform.machine().startswith('ppc') + ++def _is_openEuler_linux(): ++ return _IS_OPENEULER_LINUX ++ + def advanced_check(distribution): + distribution = list(distribution) + if os.path.exists(OS_RELEASE_FILE): +@@ -201,6 +205,8 @@ + distribution = platform.dist() + elif _is_redhat_linux(): + distribution = platform.dist() ++ elif _is_openEuler_linux(): ++ distribution = platform.dist('openEuler','22.03','') + else: + distribution = platform.linux_distribution() + +@@ -258,6 +264,8 @@ + operatingSystem = 'sles' + elif operatingSystem.startswith('red hat enterprise linux'): + operatingSystem = 'redhat' ++ elif operatingSystem.startswith('openEuler release 22.03 LTS'): ++ operatingSystem = 'openEuler' + elif operatingSystem.startswith('darwin'): + operatingSystem = 'mac' + +@@ -367,6 +375,15 @@ + This is safe check for redhat family, doesn't generate exception + """ + return OSCheck.is_in_family(OSCheck.get_os_family(), OSConst.REDHAT_FAMILY) ++ ++ @staticmethod ++ def is_openeuler_family(): ++ """ ++ Return true if it is so or false if not ++ ++ This is safe check for openeuler family, doesn't generate exception ++ """ ++ return OSCheck.is_in_family(OSCheck.get_os_family(), OSConst.OPENEULER_FAMILY) + + @staticmethod + def is_in_family(current_family, family): +diff -Naur apache-ambari-2.7.5-src/ambari-common/src/main/python/ambari_commons/os_utils.py apache-ambari-2.7.5-src-openEuler/ambari-common/src/main/python/ambari_commons/os_utils.py +--- apache-ambari-2.7.5-src/ambari-common/src/main/python/ambari_commons/os_utils.py 2019-12-13 10:48:37.000000000 +0000 ++++ apache-ambari-2.7.5-src-openEuler/ambari-common/src/main/python/ambari_commons/os_utils.py 2023-08-04 08:41:06.538247662 +0000 +@@ -164,6 +164,8 @@ + ambari_repo_file = "/etc/yum.repos.d/ambari.repo" + elif OSCheck.is_suse_family(): + ambari_repo_file = "/etc/zypp/repos.d/ambari.repo" ++ elif OSCheck.is_openeuler_family(): ++ ambari_repo_file = "/etc/yum.repos.d/ambari.repo" + elif OSCheck.is_windows_family(): + ambari_repo_file = os.path.join(os.environ[ChocolateyConsts.CHOCOLATEY_INSTALL_VAR_NAME], + ChocolateyConsts.CHOCOLATEY_CONFIG_DIR, ChocolateyConsts.CHOCOLATEY_CONFIG_FILENAME) +diff -Naur apache-ambari-2.7.5-src/ambari-common/src/main/python/ambari_commons/resources/os_family.json apache-ambari-2.7.5-src-openEuler/ambari-common/src/main/python/ambari_commons/resources/os_family.json +--- apache-ambari-2.7.5-src/ambari-common/src/main/python/ambari_commons/resources/os_family.json 2023-08-04 07:39:22.186599350 +0000 ++++ apache-ambari-2.7.5-src-openEuler/ambari-common/src/main/python/ambari_commons/resources/os_family.json 2023-08-04 08:43:25.035635479 +0000 +@@ -97,6 +97,14 @@ + 12 + ] + }, ++ "openeuler": { ++ "distro": [ ++ "openeuler" ++ ], ++ "versions": [ ++ 22 ++ ] ++ }, + "winsrv": { + "distro": [ + "win2008server", +diff -Naur apache-ambari-2.7.5-src/ambari-server/src/main/python/ambari_server/utils.py apache-ambari-2.7.5-src-openEuler/ambari-server/src/main/python/ambari_server/utils.py +--- apache-ambari-2.7.5-src/ambari-server/src/main/python/ambari_server/utils.py 2019-12-13 10:52:14.000000000 +0000 ++++ apache-ambari-2.7.5-src-openEuler/ambari-server/src/main/python/ambari_server/utils.py 2023-08-04 08:41:06.538247662 +0000 +@@ -57,6 +57,8 @@ + return '/etc/rc.d/init.d/postgresql' + elif OSCheck.is_suse_family(): + return '/etc/init.d/postgresql' ++ elif OSCheck.is_openeuler_family(): ++ return '/etc/pam.d/postgresql' + else: + raise Exception("Unsupported OS family '{0}'".format(OSCheck.get_os_family())) + diff --git a/bigtop-packages/src/rpm/ambari/SPECS/ambari.spec b/bigtop-packages/src/rpm/ambari/SPECS/ambari.spec index a9238cdb0..0edf5c415 100644 --- a/bigtop-packages/src/rpm/ambari/SPECS/ambari.spec +++ b/bigtop-packages/src/rpm/ambari/SPECS/ambari.spec @@ -71,7 +71,11 @@ AMBARI_VERSION=%{ambari_version} bash $RPM_SOURCE_DIR/install_ambari.sh \ Summary: Ambari Server Group: Development/Libraries # BIGTOP-3139: install initscripts to workaround service command not available issue +%if 0%{?openEuler} +Requires: openssl, postgresql-server >= 8.1, curl, initscripts +%else Requires: openssl, postgresql-server >= 8.1, python2 >= 2.6, curl, initscripts +%endif AutoProv: no AutoReqProv: no %description server @@ -265,7 +269,11 @@ exit 0 %package agent Summary: Ambari Agent Group: Development/Libraries +%if 0%{?openEuler} +Requires: openssl, zlib, initscripts +%else Requires: openssl, zlib, python2 >= 2.6, initscripts +%endif AutoProv: no AutoReqProv: no %description agent
