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

okislal pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/madlib.git


The following commit(s) were added to refs/heads/master by this push:
     new 16e3e865 Support Photon OS in the build system.
16e3e865 is described below

commit 16e3e865509b9059e360f0215356f4393b2149dd
Author: Jianwen Dong <djian...@vmware.com>
AuthorDate: Tue Aug 16 11:39:56 2022 -0700

    Support Photon OS in the build system.
    
    JIRA: MADLIB-1510
    
    Previously the building system only support Centos and Debian OS.
    In order to run MADlib on Photon OS, we need the support to build it
    with cmake on Photon OS.
    
    Co-authored-by: Jianwen Dong <djian...@vmware.com>
    Co-authored-by: Gaurab Dey <gaur...@vmware.com>
---
 cmake/LinuxUtils.cmake    | 12 ++++++++++++
 deploy/CMakeLists.txt     |  9 +++++++++
 deploy/RPM/CMakeLists.txt |  5 ++++-
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/cmake/LinuxUtils.cmake b/cmake/LinuxUtils.cmake
index 0547ef4d..9c12f7eb 100644
--- a/cmake/LinuxUtils.cmake
+++ b/cmake/LinuxUtils.cmake
@@ -10,6 +10,18 @@ macro(rh_version OUT_VERSION)
     endif(EXISTS "/etc/redhat-release")
 endmacro(rh_version)
 
+# Get the Photon OS version
+macro(ph_version OUT_VERSION)
+    if(EXISTS "/etc/photon-release")
+        file(READ "/etc/photon-release" _PHOTON_RELEASE_CONTENT)
+        string(REGEX REPLACE "[^0-9.]*([0-9.]+)[^0-9.]*\$" "\\1" ${OUT_VERSION}
+            "${_PHOTON_RELEASE_CONTENT}"
+        )
+    else(EXISTS "/etc/photon-release")
+        set(${OUT_VERSION} "${OUT_VERSION}-NOTFOUND")
+    endif(EXISTS "/etc/photon-release")
+endmacro(ph_version)
+
 # Get the Debian version
 # DEB_OUT_VERSION will have a number if /etc/issue exists, with an entry for 
Debian.
 # DEB_OUT_VERSION will have 'DEB_OUT_VERSION-NOTFOUND' if /etc/issue does not 
exist.
diff --git a/deploy/CMakeLists.txt b/deploy/CMakeLists.txt
index e727e926..831985dc 100644
--- a/deploy/CMakeLists.txt
+++ b/deploy/CMakeLists.txt
@@ -18,12 +18,21 @@ elseif(UNIX)
     if(RH_VERSION AND NOT (RH_VERSION STREQUAL "RH_VERSION-NOTFOUND"))
       set(IS_REDHAT "True")
     endif()
+    ph_version(PH_VERSION)
+    if(PH_VERSION AND NOT (PH_VERSION STREQUAL "PH_VERSION-NOTFOUND"))
+      set(IS_PHOTON "True")
+    endif()
 
     if(IS_REDHAT)
         message(STATUS "Detected RH version ${RH_VERSION}")
         list(APPEND CPACK_GENERATOR
             RPM
         )
+    elseif(IS_PHOTON)
+        message(STATUS "Detected Photon version ${PH_VERSION}")
+        list(APPEND CPACK_GENERATOR
+            RPM
+        )
     elseif(IS_DEBIAN)
         message(STATUS "Detected Debian version ${DEB_VERSION}")
         # By default, the cmake flag -DCREATE_RPM_FOR_UBUNTU is not
diff --git a/deploy/RPM/CMakeLists.txt b/deploy/RPM/CMakeLists.txt
index da31da2c..88254c5a 100644
--- a/deploy/RPM/CMakeLists.txt
+++ b/deploy/RPM/CMakeLists.txt
@@ -8,6 +8,7 @@
 
 # Get information about the environment
 rh_version(RH_VERSION)
+ph_version(PH_VERSION)
 
 # -- Set RPM-specific variables 
------------------------------------------------
 
@@ -17,7 +18,9 @@ set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries" 
PARENT_SCOPE)
 set(CPACK_PACKAGING_INSTALL_PREFIX 
"/usr/local/madlib/Versions/${MADLIB_VERSION_STRING}" PARENT_SCOPE)
 
 set(_PACKAGE_REQUIRES "m4 >= 1.4")
-if(RH_VERSION AND RH_VERSION VERSION_LESS "6.0")
+if(PH_VERSION)
+    set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.6, ${_PACKAGE_REQUIRES}" 
PARENT_SCOPE)
+elseif(RH_VERSION AND RH_VERSION VERSION_LESS "6.0")
     # on RH/CentOS 5, there is no Python 2.6 or higher in the default
     # repositories.
     set(CPACK_RPM_PACKAGE_REQUIRES "python, ${_PACKAGE_REQUIRES}" PARENT_SCOPE)

Reply via email to