@@ -43,9 +43,9 @@ endmacro(use_eh)
43
43
# This function assumes that each of files starts with (for example):
44
44
# From 1a400928bf8fc86fa0f062524c25d0985c94ac6f Mon Sep 17 00:00:00 2001
45
45
function (get_backport_patch_hash patch_path patch_hash )
46
- file (READ ${patch_path} first_line LIMIT 40 OFFSET 5 )
47
- string (STRIP ${first_line} first_line_strip )
48
- set (patch_hash ${first_line_strip} PARENT_SCOPE )
46
+ file (READ ${patch_path} first_line LIMIT 40 OFFSET 5 )
47
+ string (STRIP ${first_line} first_line_strip )
48
+ set (patch_hash ${first_line_strip} PARENT_SCOPE )
49
49
endfunction ()
50
50
51
51
# Checks if the the patch is present in current local branch
@@ -56,18 +56,18 @@ function(is_backport_patch_present patch_path repo_dir base_branch patch_in_bran
56
56
COMMAND ${GIT_EXECUTABLE} branch --contains ${patch_hash}
57
57
WORKING_DIRECTORY ${repo_dir}
58
58
OUTPUT_VARIABLE patch_in_branches
59
- ERROR_QUIET
59
+ ERROR_QUIET
60
60
)
61
- if (NOT patch_in_branches )
62
- set (patch_in_branch False PARENT_SCOPE ) # The patch is not present in local branch
63
- else ()
64
- string (FIND ${patch_in_branches} ${base_branch} match_branch )
61
+ if (NOT patch_in_branches )
62
+ set (patch_in_branch False PARENT_SCOPE ) # The patch is not present in local branch
63
+ else ()
64
+ string (FIND ${patch_in_branches} ${base_branch} match_branch )
65
65
if (${match_branch} EQUAL -1 )
66
- set (patch_in_branch False PARENT_SCOPE ) # The patch is not present in local branch
66
+ set (patch_in_branch False PARENT_SCOPE ) # The patch is not present in local branch
67
67
else ()
68
- set (patch_in_branch True PARENT_SCOPE ) # The patch is not present in local branch
69
- endif ()
70
- endif ()
68
+ set (patch_in_branch True PARENT_SCOPE ) # The patch is not present in local branch
69
+ endif ()
70
+ endif ()
71
71
endfunction ()
72
72
73
73
#
@@ -94,36 +94,36 @@ function(apply_patches repo_dir patches_dirs base_revision target_branch ret)
94
94
RESULT_VARIABLE patches_needed
95
95
)
96
96
if (patches_needed EQUAL 128 ) # not a git repo
97
- set (ret_not_git_repo 1 )
98
- message (STATUS "[OPENCL-CLANG] Is not a git repo" )
97
+ set (ret_not_git_repo 1 )
98
+ message (STATUS "[OPENCL-CLANG] Is not a git repo" )
99
99
elseif (patches_needed ) # The target branch doesn't exist
100
- list (SORT patches )
100
+ list (SORT patches )
101
101
execute_process ( # Create the target branch
102
102
COMMAND ${GIT_EXECUTABLE} branch
103
103
WORKING_DIRECTORY ${repo_dir}
104
104
OUTPUT_VARIABLE git_out_base_branch
105
105
)
106
- STRING (REGEX REPLACE "\\ * (.*)" "\\ 1" base_branch ${git_out_base_branch} )
107
- message (STATUS "[OPENCL-CLANG] Base branch : ${base_branch} " )
108
- execute_process ( # Create the target branch
106
+ STRING (REGEX REPLACE "\\ * (.*)" "\\ 1" base_branch ${git_out_base_branch} )
107
+ message (STATUS "[OPENCL-CLANG] Base branch : ${base_branch} " )
108
+ execute_process ( # Create the target branch
109
109
COMMAND ${GIT_EXECUTABLE} checkout -b ${target_branch} ${base_revision}
110
110
WORKING_DIRECTORY ${repo_dir}
111
111
RESULT_VARIABLE ret_check_out
112
- ERROR_VARIABLE checkout_log
112
+ ERROR_VARIABLE checkout_log
113
113
)
114
- message (STATUS "[OPENCL-CLANG] ${checkout_log} " )
115
- foreach (patch ${patches} )
116
- is_backport_patch_present (${patch} ${repo_dir} ${base_branch} patch_in_branch )
117
- if (${patch_in_branch} )
114
+ message (STATUS "[OPENCL-CLANG] ${checkout_log} " )
115
+ foreach (patch ${patches} )
116
+ is_backport_patch_present (${patch} ${repo_dir} ${base_branch} patch_in_branch )
117
+ if (${patch_in_branch} )
118
118
message (STATUS "[OPENCL-CLANG] Patch ${patch} is already in local branch - ignore patching" )
119
- else ()
119
+ else ()
120
120
execute_process ( # Apply the patch
121
- COMMAND ${GIT_EXECUTABLE} am --3way --ignore-whitespace ${patch}
122
- WORKING_DIRECTORY ${repo_dir}
123
- OUTPUT_VARIABLE patching_log
124
- )
125
- message (STATUS "[OPENCL-CLANG] Not present - ${patching_log} " )
126
- endif ()
121
+ COMMAND ${GIT_EXECUTABLE} am --3way --ignore-whitespace ${patch}
122
+ WORKING_DIRECTORY ${repo_dir}
123
+ OUTPUT_VARIABLE patching_log
124
+ )
125
+ message (STATUS "[OPENCL-CLANG] Not present - ${patching_log} " )
126
+ endif ()
127
127
endforeach (patch )
128
128
else () # The target branch already exists
129
129
execute_process ( # Check it out
0 commit comments