From 65231c485cd6dafe61a6ad15f07612e1a85d2159 Mon Sep 17 00:00:00 2001 From: "Jonathan R. Madsen" Date: Fri, 26 Jan 2024 18:47:13 -0600 Subject: [PATCH] Fix DEB and RPM dependency spec + test building docs in CI (#426) * Update cmake/rocprofiler_config_packaging.cmake - rocprofiler_set_package_depends which ensure CPACK_DEBIAN_PACKAGE_DEPENDS, CPACK_RPM_PACKAGE_REQUIRES, and component variants are properly formatted * Update continuous_integration.yml - Set ROCPROFILER_DEP_ROCMCORE to ON (test multiple dependencies) - Set ROCPROFILER_BUILD_DOCS to ON (test building/packaging docs) * Update docs/CMakeLists.txt - remove '--' after cmake -E env [ROCm/rocprofiler-sdk commit: 14cd132b89095280a7eeb9f7d8637c7916c0b88a] --- .../workflows/continuous_integration.yml | 2 ++ .../cmake/rocprofiler_config_packaging.cmake | 22 +++++++++++++------ .../source/docs/CMakeLists.txt | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/projects/rocprofiler-sdk/.github/workflows/continuous_integration.yml b/projects/rocprofiler-sdk/.github/workflows/continuous_integration.yml index cd2cdefc23..948a5eb1ab 100644 --- a/projects/rocprofiler-sdk/.github/workflows/continuous_integration.yml +++ b/projects/rocprofiler-sdk/.github/workflows/continuous_integration.yml @@ -116,6 +116,8 @@ jobs: --gpu-targets ${{ env.GPU_LIST }} ${{ matrix.ci-flags }} -- + -DROCPROFILER_DEP_ROCMCORE=ON + -DROCPROFILER_BUILD_DOCS=ON -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} -DCMAKE_INSTALL_PREFIX=/opt/rocprofiler/v2 -DCPACK_GENERATOR='DEB;RPM;TGZ' diff --git a/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake b/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake index 145dc9c93f..ea19ddf83f 100644 --- a/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake +++ b/projects/rocprofiler-sdk/cmake/rocprofiler_config_packaging.cmake @@ -2,6 +2,14 @@ # configure packaging settings # +function(rocprofiler_set_package_depends _VARIABLE _VALUE _INFO) + string(REPLACE ";" ", " _DEPENDS "${_VALUE}") + set(${_VARIABLE} + "${_DEPENDS}" + CACHE STRING "${_INFO} package dependencies" FORCE) + rocprofiler_add_feature(${_VARIABLE} "${_INFO} package dependencies") +endfunction() + # Add packaging directives set(CPACK_PACKAGE_NAME ${PROJECT_NAME}-sdk) set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.") @@ -102,9 +110,12 @@ foreach(COMPONENT_GROUP ${ROCPROFILER_COMPONENT_GROUPS}) string(TOUPPER "${COMPONENT_GROUP}" UCOMPONENT) set(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_NAME "${_NAME}") - set(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_DEPENDS "${_DEP}") set(CPACK_RPM_${UCOMPONENT}_PACKAGE_NAME "${_NAME}") - set(CPACK_RPM_${UCOMPONENT}_PACKAGE_REQUIRES "${_DEP}") + + rocprofiler_set_package_depends(CPACK_DEBIAN_${UCOMPONENT}_PACKAGE_DEPENDS "${_DEP}" + "Debian") + rocprofiler_set_package_depends(CPACK_RPM_${UCOMPONENT}_PACKAGE_REQUIRES "${_DEP}" + "RedHat") foreach(COMPONENT ${COMPONENT_GROUP_${COMPONENT_GROUP}_COMPONENTS}) cpack_add_component(${COMPONENT} REQUIRED GROUP "${COMPONENT_GROUP}") @@ -143,11 +154,8 @@ if(rocm_version_FOUND) set(_ROCM_SMI_SUFFIX " (>= ${rocm_version_MAJOR_VERSION}.0.0.${rocm_version_NUMERIC_VERSION})") endif() -string(REPLACE ";" ", " _DEBIAN_PACKAGE_DEPENDS "${_DEBIAN_PACKAGE_DEPENDS}") -set(CPACK_DEBIAN_PACKAGE_DEPENDS - "${_DEBIAN_PACKAGE_DEPENDS}" - CACHE STRING "Debian package dependencies" FORCE) -rocprofiler_add_feature(CPACK_DEBIAN_PACKAGE_DEPENDS "Debian package dependencies") +rocprofiler_set_package_depends(CPACK_DEBIAN_PACKAGE_DEPENDS "${_DEBIAN_PACKAGE_DEPENDS}" + "Debian") set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT") # -------------------------------------------------------------------------------------- # diff --git a/projects/rocprofiler-sdk/source/docs/CMakeLists.txt b/projects/rocprofiler-sdk/source/docs/CMakeLists.txt index b2f62fc0c8..b4cd4deccc 100644 --- a/projects/rocprofiler-sdk/source/docs/CMakeLists.txt +++ b/projects/rocprofiler-sdk/source/docs/CMakeLists.txt @@ -44,7 +44,7 @@ function(DOCS_EXECUTE_PROCESS) message(STATUS "[rocprofiler][docs] Executing: ${_MSG}") execute_process( - COMMAND ${CMAKE_COMMAND} -E env HOME=${DOCS_WD} -- ${ARGN} + COMMAND ${CMAKE_COMMAND} -E env HOME=${DOCS_WD} ${ARGN} RESULT_VARIABLE _RET OUTPUT_VARIABLE _OUT ERROR_VARIABLE _ERR