From a10f3ed86c57f8d0076a9058d91c5ce2d93ce46d Mon Sep 17 00:00:00 2001 From: Kiriti Gowda Date: Thu, 6 Jun 2024 10:24:15 -0700 Subject: [PATCH] CMakeLists & Setup - Updates (#363) * CMakeLists - Remove OBSOLETES * Setup - Updates * Setup - Cleanup [ROCm/rocdecode commit: 460a49a7287daacbd1b30bc10afab0742901c92e] --- projects/rocdecode/CMakeLists.txt | 4 --- projects/rocdecode/rocDecode-setup.py | 52 +++++++++++++++++---------- 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/projects/rocdecode/CMakeLists.txt b/projects/rocdecode/CMakeLists.txt index 2c6260468b..348a984661 100644 --- a/projects/rocdecode/CMakeLists.txt +++ b/projects/rocdecode/CMakeLists.txt @@ -246,22 +246,18 @@ if(HIP_FOUND AND Libva_FOUND) set(CPACK_RPM_RUNTIME_PACKAGE_NAME "${PROJECT_NAME}") set(CPACK_RPM_RUNTIME_PACKAGE_REQUIRES "rocm-core, ${rocDecode_RPM_PACKAGE_LIST}") set(CPACK_RPM_RUNTIME_PACKAGE_PROVIDES "${PROJECT_NAME}") - set(CPACK_RPM_RUNTIME_PACKAGE_OBSOLETES "${PROJECT_NAME}") set(CPACK_RPM_DEV_PACKAGE_NAME "${PROJECT_NAME}-devel") set(CPACK_RPM_DEV_PACKAGE_REQUIRES "rocm-core, ${PROJECT_NAME}, ${rocDecode_RPM_DEV_PACKAGE_LIST}") set(CPACK_RPM_DEV_PACKAGE_PROVIDES "${PROJECT_NAME}-devel") - set(CPACK_RPM_DEV_PACKAGE_OBSOLETES "${PROJECT_NAME}-devel") set(CPACK_RPM_PACKAGE_LICENSE "MIT" ) # RPM package specific variable for ASAN set(CPACK_RPM_ASAN_PACKAGE_NAME "${PROJECT_NAME}-asan" ) set(CPACK_RPM_ASAN_PACKAGE_REQUIRES "rocm-core-asan, ${rocDecode_RPM_PACKAGE_LIST}" ) set(CPACK_RPM_ASAN_PACKAGE_PROVIDES "${PROJECT_NAME}-asan") - set(CPACK_RPM_ASAN_PACKAGE_OBSOLETES "${PROJECT_NAME}-asan") # RPM package specific variable for Test set(CPACK_RPM_TEST_PACKAGE_NAME "${PROJECT_NAME}-test" ) set(CPACK_RPM_TEST_PACKAGE_REQUIRES "rocm-core, ${CPACK_RPM_DEV_PACKAGE_NAME}" ) set(CPACK_RPM_TEST_PACKAGE_PROVIDES "${PROJECT_NAME}-test") - set(CPACK_RPM_TEST_PACKAGE_OBSOLETES "${PROJECT_NAME}-test") if(NOT ROCM_DEP_ROCMCORE) string(REGEX REPLACE ",? ?rocm-core," "" CPACK_RPM_RUNTIME_PACKAGE_REQUIRES ${CPACK_RPM_RUNTIME_PACKAGE_REQUIRES}) diff --git a/projects/rocdecode/rocDecode-setup.py b/projects/rocdecode/rocDecode-setup.py index 2355c2687b..bd5339a500 100644 --- a/projects/rocdecode/rocDecode-setup.py +++ b/projects/rocdecode/rocDecode-setup.py @@ -87,36 +87,50 @@ else: if sudoLocation != '/usr/bin/sudo': status, userName = subprocess.getstatusoutput("whoami") +# check os version +os_info_data = 'NOT Supported' +if os.path.exists('/etc/os-release'): + with open('/etc/os-release', 'r') as os_file: + os_info_data = os_file.read().replace('\n', ' ') + os_info_data = os_info_data.replace('"', '') + # setup for Linux linuxSystemInstall = '' linuxCMake = 'cmake' linuxSystemInstall_check = '' linuxFlag = '' sudoValidateOption= '-v' -if "centos" in platfromInfo or "redhat" in platfromInfo or os.path.exists('/usr/bin/yum'): +if "centos" in os_info_data or "redhat" in os_info_data or os.path.exists('/usr/bin/yum'): linuxSystemInstall = 'yum -y' linuxSystemInstall_check = '--nogpgcheck' - if "centos-7" in platfromInfo or "redhat-7" in platfromInfo: - print("\nrocDecode Setup on "+platfromInfo+" is unsupported\n") - exit(-1) - if not "centos" in platfromInfo or not "redhat" in platfromInfo: - if "8" in platform.version(): - platfromInfo = platfromInfo+'-redhat-8' - if "9" in platform.version(): - platfromInfo = platfromInfo+'-redhat-9' -elif "Ubuntu" in platfromInfo or os.path.exists('/usr/bin/apt-get'): + if "VERSION_ID=7" in os_info_data: + linuxCMake = 'cmake3' + platfromInfo = platfromInfo+'-redhat-7' + elif "VERSION_ID=8" in os_info_data: + platfromInfo = platfromInfo+'-redhat-8' + elif "VERSION_ID=9" in os_info_data: + platfromInfo = platfromInfo+'-redhat-9' + else: + platfromInfo = platfromInfo+'-redhat-centos-undefined-version' +elif "Ubuntu" in os_info_data or os.path.exists('/usr/bin/apt-get'): linuxSystemInstall = 'apt-get -y' linuxSystemInstall_check = '--allow-unauthenticated' linuxFlag = '-S' - if not "Ubuntu" in platfromInfo: - platfromInfo = platfromInfo+'-Ubuntu' -elif os.path.exists('/usr/bin/zypper'): + if "VERSION_ID=20" in os_info_data: + platfromInfo = platfromInfo+'-Ubuntu-20' + elif "VERSION_ID=22" in os_info_data: + platfromInfo = platfromInfo+'-Ubuntu-22' + elif "VERSION_ID=24" in os_info_data: + platfromInfo = platfromInfo+'-Ubuntu-24' + else: + platfromInfo = platfromInfo+'-Ubuntu-undefined-version' +elif "SLES" in os_info_data or os.path.exists('/usr/bin/zypper'): linuxSystemInstall = 'zypper -n' linuxSystemInstall_check = '--no-gpg-checks' platfromInfo = platfromInfo+'-SLES' else: print("\nrocDecode Setup on "+platfromInfo+" is unsupported\n") - print("\nrocDecode Setup Supported on: Ubuntu 20/22, RedHat 8/9, & SLES 15 SP4\n") + print("\nrocDecode Setup Supported on: Ubuntu 20/22, RedHat 8/9, & SLES 15\n") exit(-1) # rocDecode Setup @@ -172,6 +186,9 @@ coreRPMPackages = [ 'libva-utils' ] +# update +ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall +' '+linuxSystemInstall_check+' update')) + # common packages ERROR_CHECK(os.system('sudo '+sudoValidateOption)) for i in range(len(commonPackages)): @@ -184,10 +201,9 @@ if "Ubuntu" in platfromInfo: for i in range(len(coreDebianPackages)): ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall + ' '+linuxSystemInstall_check+' install '+ coreDebianPackages[i])) - with open('/etc/os-release') as f: - if '22' in f.read(): - for i in range(len(coreDebianU22Packages)): - ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall + + if "VERSION_ID=22" in os_info_data: + for i in range(len(coreDebianU22Packages)): + ERROR_CHECK(os.system('sudo '+linuxFlag+' '+linuxSystemInstall + ' '+linuxSystemInstall_check+' install '+ coreDebianU22Packages[i])) else: for i in range(len(coreRPMPackages)):