From b2e30b6ffa054c0881585772675202e8a9e31bb4 Mon Sep 17 00:00:00 2001 From: Ranjith Ramakrishnan Date: Wed, 14 Sep 2022 15:38:26 -0700 Subject: [PATCH] SWDEV-340761 - Limit the removal of opencl conf file to package removal and provide unique name to icd file While upgrading packaging in SLES/RHEL, the package to be upgraded is installed first, followed by cleanup of the older one During upgrade 10-rocm-opencl.conf and icd file is getting removed as part of clean up, since the file name and path is same in different package versions. Limit the removal of opencl conf file to uninstall/removal of package and not during upgrade. Used unique name for icd file Change-Id: Ib34a78ce53e6b7d95adb70ccfd56474a297b64ca [ROCm/clr commit: 3d350393d8e6253fcf4ecf834fc6fdf1fd5da386] --- projects/clr/opencl/CMakeLists.txt | 15 ++++++++++++++- .../clr/opencl/packaging/rocm-ocl-icd.rpm_postun | 8 ++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/projects/clr/opencl/CMakeLists.txt b/projects/clr/opencl/CMakeLists.txt index 30936283e6..212880fff5 100644 --- a/projects/clr/opencl/CMakeLists.txt +++ b/projects/clr/opencl/CMakeLists.txt @@ -60,7 +60,20 @@ endif() #set a name for icd file set(OPENCL_AMD_ICD_FILE "amdocl64.icd") if (DEFINED ROCM_PATCH_VERSION) - set(OPENCL_AMD_ICD_FILE "amdocl64_${ROCM_PATCH_VERSION}.icd") + # set unique name for ICD file for each jenkins build + # Use ENV variable CPACK_RPM_PACKAGE_RELEASE, which is having build number + set(PACKAGE_RELEASE_VERSION "") + if(DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE}) + set(PACKAGE_RELEASE_VERSION $ENV{CPACK_RPM_PACKAGE_RELEASE}) + endif() + if(PACKAGE_RELEASE_VERSION) + # Replace "." to "_" in package version string. So file name will have .icd as extension + string(REPLACE "." "_" PACKAGE_RELEASE_VERSION ${PACKAGE_RELEASE_VERSION}) + else() + # set a default value + set(PACKAGE_RELEASE_VERSION "9999") + endif() + set(OPENCL_AMD_ICD_FILE "amdocl64_${ROCM_PATCH_VERSION}_${PACKAGE_RELEASE_VERSION}.icd") endif() if(BUILD_ICD) diff --git a/projects/clr/opencl/packaging/rocm-ocl-icd.rpm_postun b/projects/clr/opencl/packaging/rocm-ocl-icd.rpm_postun index 6c29e74c1f..f3655dfe90 100644 --- a/projects/clr/opencl/packaging/rocm-ocl-icd.rpm_postun +++ b/projects/clr/opencl/packaging/rocm-ocl-icd.rpm_postun @@ -1,8 +1,8 @@ -if [ $1 -le 1 ]; then - # Below files will be removed during remove | upgrade operation - +if [ $1 -eq 0 ]; then + # Remove rocm-opencl.conf during remove/uninstall operation rm -f /@CMAKE_INSTALL_SYSCONFDIR@/ld.so.conf.d/10-rocm-opencl.conf && ldconfig - rm -f /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@ fi +# Remove icd file for uninstall and upgrade operation +rm -f /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@