From 711f4b059bdcf0da874497dd309d9bd8cbba5213 Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Tue, 9 Jul 2024 12:49:22 -0700 Subject: [PATCH] Add override patches and test that patches are applied. --- .../cpm/cpm_find-patch-command/CMakeLists.txt | 22 +++++++++++++++---- .../cpm/cpm_find-patch-command/override.json | 18 +++++++++++++++ .../patches/0001-move-git-sha1.patch | 19 ++++++++++++++++ .../0002-move-git-sha1-a-second-time.patch | 19 ++++++++++++++++ 4 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 testing/cpm/cpm_find-patch-command/override.json create mode 100644 testing/cpm/cpm_find-patch-command/patches/0001-move-git-sha1.patch create mode 100644 testing/cpm/cpm_find-patch-command/patches/0002-move-git-sha1-a-second-time.patch diff --git a/testing/cpm/cpm_find-patch-command/CMakeLists.txt b/testing/cpm/cpm_find-patch-command/CMakeLists.txt index b99df9e6..041641a4 100644 --- a/testing/cpm/cpm_find-patch-command/CMakeLists.txt +++ b/testing/cpm/cpm_find-patch-command/CMakeLists.txt @@ -32,19 +32,33 @@ set(cccl_dir "${deps_dir}/cccl") list(APPEND CMAKE_PREFIX_PATH "${cccl_dir}") include(${rapids-cmake-dir}/cpm/init.cmake) -include(${rapids-cmake-dir}/cpm/cccl.cmake) rapids_cpm_init() + +include(${rapids-cmake-dir}/cpm/package_override.cmake) +rapids_cpm_package_override(${CMAKE_CURRENT_SOURCE_DIR}/override.json) + +include(${rapids-cmake-dir}/cpm/cccl.cmake) rapids_cpm_cccl() if(NOT "${CCCL_ADDED}") message(FATAL_ERROR "The found repo was used rather than downloading and patching a new version") endif() +# Verify that the two files that we inserted into the CCCL source tree exist +# Which proves the patches in the override are properly applied +if(NOT EXISTS "${CCCL_SOURCE_DIR}/git_file_1.txt") + message(FATAL_ERROR "failed to apply CCCL first patch") +endif() + +if(NOT EXISTS "${CCCL_SOURCE_DIR}/git_file_2.txt") + message(FATAL_ERROR "failed to apply CCCL second patch") +endif() + execute_process( - COMMAND ${GIT_EXECUTABLE} diff-files --quiet - RESULT_VARIABLE REPO_IS_DIRTY + COMMAND ${GIT_EXECUTABLE} diff --quiet ${tag} + RESULT_VARIABLE REPO_IS_PATCHED WORKING_DIRECTORY "${CCCL_SOURCE_DIR}") -if(NOT ${REPO_IS_DIRTY}) +if(NOT ${REPO_IS_PATCHED}) message(FATAL_ERROR "The repo was downloaded to ${CCCL_SOURCE_DIR} but not patched.") endif() diff --git a/testing/cpm/cpm_find-patch-command/override.json b/testing/cpm/cpm_find-patch-command/override.json new file mode 100644 index 00000000..fa73f144 --- /dev/null +++ b/testing/cpm/cpm_find-patch-command/override.json @@ -0,0 +1,18 @@ +{ + "packages": { + "CCCL": { + "patches": [ + { + "file": "${current_json_dir}/patches/0001-move-git-sha1.patch", + "issue": "Move git sha1", + "fixed_in": "" + }, + { + "file": "${current_json_dir}/patches/0002-move-git-sha1-a-second-time.patch", + "issue": "Move git sha1 a second time", + "fixed_in": "" + } + ] + } + } +} diff --git a/testing/cpm/cpm_find-patch-command/patches/0001-move-git-sha1.patch b/testing/cpm/cpm_find-patch-command/patches/0001-move-git-sha1.patch new file mode 100644 index 00000000..c721f937 --- /dev/null +++ b/testing/cpm/cpm_find-patch-command/patches/0001-move-git-sha1.patch @@ -0,0 +1,19 @@ +From deacd3fafd7fcfee954ae3044ae3ab60d36a9f3a Mon Sep 17 00:00:00 2001 +From: Robert Maynard +Date: Wed, 31 Jan 2024 15:00:47 -0500 +Subject: [PATCH 1/2] Move GIT SHA1 + +--- + git_file_1.txt | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 git_file_1.txt + +diff --git a/git_file_1.txt b/git_file_1.txt +new file mode 100644 +index 00000000..b242c360 +--- /dev/null ++++ b/git_file_1.txt +@@ -0,0 +1 @@ ++added file +-- +2.43.0 diff --git a/testing/cpm/cpm_find-patch-command/patches/0002-move-git-sha1-a-second-time.patch b/testing/cpm/cpm_find-patch-command/patches/0002-move-git-sha1-a-second-time.patch new file mode 100644 index 00000000..1986f6d5 --- /dev/null +++ b/testing/cpm/cpm_find-patch-command/patches/0002-move-git-sha1-a-second-time.patch @@ -0,0 +1,19 @@ +From 3588e151030a30661b310a876f7cc450d6ca9201 Mon Sep 17 00:00:00 2001 +From: Robert Maynard +Date: Wed, 31 Jan 2024 15:01:21 -0500 +Subject: [PATCH 2/2] Move GIT SHA1 a second time + +--- + git_file_2.txt | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 git_file_2.txt + +diff --git a/git_file_2.txt b/git_file_2.txt +new file mode 100644 +index 00000000..fa240558 +--- /dev/null ++++ b/git_file_2.txt +@@ -0,0 +1 @@ ++added another file +-- +2.43.0