@@ -59,6 +59,28 @@ def _update_repo(self, config):
59
59
kernelci .build .update_repo (config , self ._kdir )
60
60
self .log .info ("Repo updated" )
61
61
62
+ def _find_patchwork_patches (self , node ):
63
+ node_data = node .get ('data' )
64
+ if not node_data :
65
+ return []
66
+
67
+ if patchwork_data := node_data .get ('patchwork' ):
68
+ config_version = patchwork_data ["version" ]
69
+ if config_version == 1 :
70
+ return [patch_metadata ['mbox' ] for patch_metadata in patchwork_data ['payload' ]['patches' ]]
71
+ else :
72
+ self .log .error (f"Unsupported patchwork config version { config_version } " )
73
+
74
+ return []
75
+
76
+ def _apply_patches (self , patch_mbox_urls ):
77
+ # Appling patches in the reverse order
78
+ for patch_mbox_url in patch_mbox_urls [::- 1 ]:
79
+ self .log .info (
80
+ f"Applying patch to the repo, patch mbox url: { patch_mbox_url } "
81
+ )
82
+ kernelci .build .apply_patch_mbox (self ._kdir , patch_mbox_url )
83
+
62
84
def _make_tarball (self , config , describe ):
63
85
name = '-' .join (['linux' , config .tree .name , config .branch , describe ])
64
86
tarball = f"{ name } .tar.gz"
@@ -134,6 +156,11 @@ def _run(self, sub_id):
134
156
continue
135
157
136
158
self ._update_repo (build_config )
159
+
160
+ patches = self ._find_patchwork_patches (checkout_node )
161
+ if patches :
162
+ self ._apply_patches (patches )
163
+
137
164
describe = kernelci .build .git_describe (
138
165
build_config .tree .name , self ._kdir
139
166
)
0 commit comments