From daa2c4262721fcf4335e7f05868bacbbb36cbdf1 Mon Sep 17 00:00:00 2001 From: "Galantsev, Dmitrii" Date: Fri, 15 Sep 2023 03:04:50 -0500 Subject: [PATCH] PACKAGE - Remove __pycache__ on uninstall After running the amd-smi tool, the following directories get created: - /opt/rocm/libexec/amdsmi_cli/__pycache__ - /opt/rocm/share/amd_smi/amdsmi/__pycache__ Those need to be removed so rocm can be cleanly uninstalled. Change-Id: I1738aed444ef9427179e99f6e25ad1beab3d8fab Signed-off-by: Galantsev, Dmitrii --- DEBIAN/prerm.in | 5 +++-- RPM/preun.in | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/DEBIAN/prerm.in b/DEBIAN/prerm.in index e2d6e1443e..307ce4146d 100755 --- a/DEBIAN/prerm.in +++ b/DEBIAN/prerm.in @@ -34,8 +34,9 @@ rm_ldconfig() { } rm_pyc() { - # remove pyc file generated by python - rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/amd_smi/__pycache__ + # remove pyc files generated by python + rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/amdsmi_cli/__pycache__ + rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi/__pycache__ } diff --git a/RPM/preun.in b/RPM/preun.in index 521c420be9..d813219a08 100755 --- a/RPM/preun.in +++ b/RPM/preun.in @@ -27,10 +27,15 @@ return_logrotateToOrigConfig() { fi } +rm_pyc() { + # remove pyc files generated by python + rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/amdsmi_cli/__pycache__ + rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi/__pycache__ +} + if [ $1 -le 1 ]; then # perform the below actions for rpm remove($1=0) or upgrade($1=1) operations - # remove pyc file generated by python - rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/amd_smi/__pycache__ + rm_pyc rm_logFolder return_logrotateToOrigConfig fi