From e78a51605f30626b0179de51ee4383b4af3a52cd Mon Sep 17 00:00:00 2001 From: "Yang, Haonan" Date: Wed, 3 Jul 2024 14:56:56 +0800 Subject: [PATCH 1/3] Do not apply patches if repo is a not a git repo. --- cmake/modules/CMakeFunctions.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/modules/CMakeFunctions.cmake b/cmake/modules/CMakeFunctions.cmake index d8f35039..24805bbc 100644 --- a/cmake/modules/CMakeFunctions.cmake +++ b/cmake/modules/CMakeFunctions.cmake @@ -106,8 +106,10 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret) OUTPUT_QUIET ) if(patches_needed EQUAL 128) # not a git repo - set(ret_not_git_repo 1) - elseif(patches_needed) # The target branch doesn't exist + set(${ret} True PARENT_SCOPE) + message(STATUS "[OPENCL-CLANG] ${repo_dir} is not a git repository") + return() + elseif(patches_needed EQUAL 1) # The target branch doesn't exist list(SORT patches) is_valid_revision(${repo_dir} ${base_revision} exists_base_rev) @@ -147,7 +149,7 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret) endif() endif() endforeach(patch) - else() # The target branch already exists + elseif(patches_needed EQUAL 0) # The target branch already exists execute_process( # Check it out COMMAND ${GIT_EXECUTABLE} checkout ${target_branch} WORKING_DIRECTORY ${repo_dir} @@ -155,7 +157,7 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret) RESULT_VARIABLE ret_check_out ) endif() - if (NOT (ret_not_git_repo OR ret_check_out OR ret_apply_patch)) + if (NOT (ret_check_out OR ret_apply_patch)) set(${ret} True PARENT_SCOPE) else() message(FATAL_ERROR "[OPENCL-CLANG] Failed to apply patch!") From b32adffec690ff7b56f27329f72fdd1678387feb Mon Sep 17 00:00:00 2001 From: Haonan Yang Date: Wed, 3 Jul 2024 17:31:08 +0800 Subject: [PATCH 2/3] Update cmake/modules/CMakeFunctions.cmake Co-authored-by: Wenju He --- cmake/modules/CMakeFunctions.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/modules/CMakeFunctions.cmake b/cmake/modules/CMakeFunctions.cmake index 24805bbc..d668eeea 100644 --- a/cmake/modules/CMakeFunctions.cmake +++ b/cmake/modules/CMakeFunctions.cmake @@ -109,7 +109,8 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret) set(${ret} True PARENT_SCOPE) message(STATUS "[OPENCL-CLANG] ${repo_dir} is not a git repository") return() - elseif(patches_needed EQUAL 1) # The target branch doesn't exist + endif() + if(patches_needed EQUAL 1) # The target branch doesn't exist list(SORT patches) is_valid_revision(${repo_dir} ${base_revision} exists_base_rev) From 5835cf84288895df38a8fe4f16c9e790eebd1f60 Mon Sep 17 00:00:00 2001 From: Haonan Yang Date: Wed, 3 Jul 2024 17:40:42 +0800 Subject: [PATCH 3/3] Update cmake/modules/CMakeFunctions.cmake Co-authored-by: Wenju He --- cmake/modules/CMakeFunctions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/CMakeFunctions.cmake b/cmake/modules/CMakeFunctions.cmake index d668eeea..e4067bd8 100644 --- a/cmake/modules/CMakeFunctions.cmake +++ b/cmake/modules/CMakeFunctions.cmake @@ -107,7 +107,7 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret) ) if(patches_needed EQUAL 128) # not a git repo set(${ret} True PARENT_SCOPE) - message(STATUS "[OPENCL-CLANG] ${repo_dir} is not a git repository") + message(STATUS "[OPENCL-CLANG][Warning] ${repo_dir} is not a git repository, therefore, local patches are not applied") return() endif() if(patches_needed EQUAL 1) # The target branch doesn't exist