Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Slowroll:Base:2
intel-graphics-compiler
0001-Use-patch-instead-of-git-to-apply-opencl-c...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Use-patch-instead-of-git-to-apply-opencl-clang-patch.patch of Package intel-graphics-compiler
From 361738d16246949f4a8c2bb77c23ff9ba5a3d46f Mon Sep 17 00:00:00 2001 From: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Date: Tue, 28 Mar 2023 10:34:25 +0200 Subject: [PATCH] Use patch instead of git to apply opencl-clang patches Signed-off-by: Patrik Jakobsson <pjakobsson@suse.de> --- cmake/modules/CMakeFunctions.cmake | 71 +++++++----------------------- 1 file changed, 15 insertions(+), 56 deletions(-) diff --git a/cmake/modules/CMakeFunctions.cmake b/cmake/modules/CMakeFunctions.cmake index d8f3503..1cd9f1e 100644 --- a/cmake/modules/CMakeFunctions.cmake +++ b/cmake/modules/CMakeFunctions.cmake @@ -98,64 +98,23 @@ function(apply_patches repo_dir patches_dir base_revision target_branch ret) endif() message(STATUS "[OPENCL-CLANG] Patching repository ${repo_dir}") - # Check if the target branch already exists - execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse --verify --no-revs -q ${target_branch} - WORKING_DIRECTORY ${repo_dir} - RESULT_VARIABLE patches_needed - 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 - list(SORT patches) - is_valid_revision(${repo_dir} ${base_revision} exists_base_rev) + list(SORT patches) + foreach(patch ${patches}) + execute_process( # Apply the patch + COMMAND patch -p1 -i ${patch} + WORKING_DIRECTORY ${repo_dir} + OUTPUT_VARIABLE patching_log + RESULT_VARIABLE ret_apply_patch + ) - if(NOT ${exists_base_rev}) - execute_process( # take SHA1 from HEAD - COMMAND ${GIT_EXECUTABLE} rev-parse HEAD - WORKING_DIRECTORY ${repo_dir} - OUTPUT_VARIABLE repo_head - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - message(STATUS "[OPENCL-CLANG] ref ${base_revision} not exists in repository, using current HEAD:${repo_head}") - set(base_revision ${repo_head}) + if (ret_apply_patch) + message(STATUS "[OPENCL-CLANG] Failed to apply patch ${patch}") + break() endif() - execute_process( # Create the target branch - COMMAND ${GIT_EXECUTABLE} checkout -b ${target_branch} ${base_revision} - WORKING_DIRECTORY ${repo_dir} - RESULT_VARIABLE ret_check_out - ERROR_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE checkout_log - OUTPUT_QUIET - ) - message(STATUS "[OPENCL-CLANG] ${checkout_log} which starts from ref : ${base_revision}") - foreach(patch ${patches}) - is_backport_patch_present(${patch} ${repo_dir} patch_in_branch) - if(${patch_in_branch}) - message(STATUS "[OPENCL-CLANG] Patch ${patch} is already in local branch - ignore patching") - else() - execute_process( # Apply the patch - COMMAND ${GIT_EXECUTABLE} am --3way --ignore-whitespace -C0 ${patch} - WORKING_DIRECTORY ${repo_dir} - OUTPUT_VARIABLE patching_log - RESULT_VARIABLE ret_apply_patch - ) - message(STATUS "[OPENCL-CLANG] Not present - ${patching_log}") - if (ret_apply_patch) - break() - endif() - endif() - endforeach(patch) - else() # The target branch already exists - execute_process( # Check it out - COMMAND ${GIT_EXECUTABLE} checkout ${target_branch} - WORKING_DIRECTORY ${repo_dir} - OUTPUT_QUIET - RESULT_VARIABLE ret_check_out - ) - endif() - if (NOT (ret_not_git_repo OR ret_check_out OR ret_apply_patch)) + message(STATUS "[OPENCL-CLANG] Applied patch ${patch}") + endforeach(patch) + + if (NOT (ret_apply_patch)) set(${ret} True PARENT_SCOPE) else() message(FATAL_ERROR "[OPENCL-CLANG] Failed to apply patch!") -- 2.41.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor