@@ -75,7 +75,8 @@ def cloud_archive_download(
75
75
strip_prefix = "" ,
76
76
build_file = "" ,
77
77
build_file_contents = "" ,
78
- profile = "" ):
78
+ profile = "" ,
79
+ patch_cmds = []):
79
80
""" Securely downloads and unpacks an archive from Minio, then places a
80
81
BUILD file inside. """
81
82
filename = repo_ctx .path (file_path ).basename
@@ -148,6 +149,11 @@ def cloud_archive_download(
148
149
if result .return_code != 0 :
149
150
fail ("Patch {} failed to apply." .format (patch ))
150
151
152
+ # apply patch_cmds one by one after all patches have been applied
153
+ bash_path = repo_ctx .os .environ .get ("BAZEL_SH" , "bash" )
154
+ for cmd in patch_cmds :
155
+ repo_ctx .execute ([bash_path , "-c" , cmd ])
156
+
151
157
def _cloud_archive_impl (ctx ):
152
158
cloud_archive_download (
153
159
ctx ,
@@ -156,6 +162,7 @@ def _cloud_archive_impl(ctx):
156
162
provider = ctx .attr ._provider ,
157
163
patches = ctx .attr .patches ,
158
164
patch_args = ctx .attr .patch_args ,
165
+ patch_cmds = ctx .attr .patch_cmds ,
159
166
strip_prefix = ctx .attr .strip_prefix ,
160
167
build_file = ctx .attr .build_file ,
161
168
build_file_contents = ctx .attr .build_file_contents ,
@@ -178,6 +185,7 @@ minio_archive = repository_rule(
178
185
"build_file_contents" : attr .string (doc = "The contents of the build file for the target" ),
179
186
"patches" : attr .label_list (doc = "Patches to apply, if any." , allow_files = True ),
180
187
"patch_args" : attr .string_list (doc = "Arguments to use when applying patches." ),
188
+ "patch_cmds" : attr .string_list (doc = "Sequence of Bash commands to be applied after patches are applied." ),
181
189
"strip_prefix" : attr .string (doc = "Prefix to strip when archive is unpacked" ),
182
190
"_provider" : attr .string (default = "minio" ),
183
191
},
@@ -200,6 +208,7 @@ s3_archive = repository_rule(
200
208
"build_file_contents" : attr .string (doc = "The contents of the build file for the target" ),
201
209
"patches" : attr .label_list (doc = "Patches to apply, if any." , allow_files = True ),
202
210
"patch_args" : attr .string_list (doc = "Arguments to use when applying patches." ),
211
+ "patch_cmds" : attr .string_list (doc = "Sequence of Bash commands to be applied after patches are applied." ),
203
212
"strip_prefix" : attr .string (doc = "Prefix to strip when archive is unpacked" ),
204
213
"_provider" : attr .string (default = "s3" ),
205
214
},
@@ -221,6 +230,7 @@ gs_archive = repository_rule(
221
230
"build_file_contents" : attr .string (doc = "The contents of the build file for the target" ),
222
231
"patches" : attr .label_list (doc = "Patches to apply, if any." , allow_files = True ),
223
232
"patch_args" : attr .string_list (doc = "Arguments to use when applying patches." ),
233
+ "patch_cmds" : attr .string_list (doc = "Sequence of Bash commands to be applied after patches are applied." ),
224
234
"strip_prefix" : attr .string (doc = "Prefix to strip when archive is unpacked" ),
225
235
"_provider" : attr .string (default = "google" ),
226
236
},
@@ -242,6 +252,7 @@ b2_archive = repository_rule(
242
252
"build_file_contents" : attr .string (doc = "The contents of the build file for the target" ),
243
253
"patches" : attr .label_list (doc = "Patches to apply, if any." , allow_files = True ),
244
254
"patch_args" : attr .string_list (doc = "Arguments to use when applying patches." ),
255
+ "patch_cmds" : attr .string_list (doc = "Sequence of Bash commands to be applied after patches are applied." ),
245
256
"strip_prefix" : attr .string (doc = "Prefix to strip when archive is unpacked" ),
246
257
"_provider" : attr .string (default = "backblaze" ),
247
258
},
0 commit comments