Standardizing Package names
: Enables standards compliant package naming for debian and rpm
Signed-off-by: Ashutosh Mishra <ashutosh.mishra@amd.com>
Change-Id: I177af15ec7a3f909d05135be30a0acc7b0b20745
[ROCm/ROCR-Runtime commit: aefc173da4]
This commit is contained in:
committed by
Ashutosh Mishra
parent
349fe6a583
commit
5026ed2f8a
@@ -114,3 +114,26 @@ function ( get_version DEFAULT_VERSION_STRING )
|
||||
set( VERSION_BUILD "${VERSION_BUILD}" PARENT_SCOPE )
|
||||
|
||||
endfunction()
|
||||
|
||||
#get the OS version
|
||||
function(get_os_info)
|
||||
if( EXISTS "/etc/os-release")
|
||||
file(STRINGS "/etc/os-release" DISTRO_ID REGEX "^ID=")
|
||||
file(STRINGS "/etc/os-release" DISTRO_RELEASE REGEX "^VERSION_ID=")
|
||||
string(REPLACE "ID=" "" DISTRO_ID "${DISTRO_ID}")
|
||||
string(REPLACE "VERSION_ID=" "" DISTRO_RELEASE "${DISTRO_RELEASE}")
|
||||
message(STATUS "Detected distribution: ${DISTRO_ID}:${DISTRO_RELEASE}")
|
||||
elseif(EXISTS "/etc/centos-release" )
|
||||
# Example: CentOS release 6.10 (Final)
|
||||
file(STRINGS "/etc/centos-release" DISTRO_FULL_STR REGEX "release")
|
||||
string(REGEX MATCH "^[a-zA-Z]+" DISTRO_ID "${DISTRO_FULL_STR}")
|
||||
string(TOLOWER "${DISTRO_ID}" DISTRO_ID)
|
||||
string(REGEX MATCH "[0-9]+" DISTRO_RELEASE "${DISTRO_FULL_STR}")
|
||||
message(STATUS "Detected distribution: ${DISTRO_ID}:${DISTRO_RELEASE}")
|
||||
else()
|
||||
message(STATUS "Not able to detect OS")
|
||||
endif()
|
||||
set(DISTRO_ID "${DISTRO_ID}" PARENT_SCOPE )
|
||||
set(DISTRO_RELEASE "${DISTRO_RELEASE}" PARENT_SCOPE )
|
||||
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user