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
Este commit está contenido en:
Ranjith Ramakrishnan
2022-09-14 15:38:26 -07:00
padre fe8acef64e
commit 3d350393d8
Se han modificado 2 ficheros con 18 adiciones y 5 borrados
+14 -1
Ver fichero
@@ -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)
+4 -4
Ver fichero
@@ -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@