Skip to content

Commit b4d0424

Browse files
committed
Enable use of architecture for config extension
In order to be able to deal with multiple architectures it's desirable to be able to specify the architecture for specific bazeldnf repositories instead of just assuming a default of x86_64.
1 parent 331000e commit b4d0424

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

bazeldnf/extensions.bzl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ update_lock_file(
8989
repofile = "{repofile}",
9090
nobest = {nobest},
9191
cache_dir = {cache_dir},
92+
architecture = "{architecture}",
9293
)
9394
"""
9495

@@ -119,6 +120,7 @@ def _alias_repository_impl(repository_ctx):
119120
excludes = ", ".join(["'{}'".format(x) for x in repository_ctx.attr.excludes]),
120121
repofile = repofile,
121122
nobest = "True" if repository_ctx.attr.nobest else "False",
123+
architecture = repository_ctx.attr.architecture,
122124
),
123125
)
124126
for rpm in repository_ctx.attr.rpms:
@@ -156,6 +158,7 @@ _alias_repository = repository_rule(
156158
"repository_prefix": attr.string(),
157159
"nobest": attr.bool(default = False),
158160
"cache_dir": attr.string(),
161+
"architecture": attr.string(values = ["i686", "x86_64", "aarch64", ""]),
159162
},
160163
)
161164

@@ -175,6 +178,7 @@ def _handle_lock_file(config, module_ctx, registered_rpms = {}):
175178
"repofile": config.repofile,
176179
"repository_prefix": config.rpm_repository_prefix,
177180
"nobest": config.nobest,
181+
"architecture": config.architecture,
178182
}
179183

180184
module_ctx.watch(config.lock_file)
@@ -388,6 +392,10 @@ The lock file content is as:
388392
doc = "Don't include dependencies in resulting repositories",
389393
default = False,
390394
),
395+
"architecture": attr.string(
396+
doc = "Architectures to enable in addition to noarch",
397+
values = ["i686", "x86_64", "aarch64", ""],
398+
),
391399
},
392400
)
393401

bazeldnf/private/lock-file-helpers.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ def _collect_lockfile_args(ctx):
2121
if ctx.attr.cache_dir:
2222
lockfile_args.extend(["--cache-dir", ctx.attr.cache_dir])
2323

24+
if ctx.attr.architecture:
25+
lockfile_args.extend(["--arch", ctx.attr.architecture])
26+
2427
lockfile_args.append("--ignore-missing")
2528

2629
return lockfile_args
@@ -67,6 +70,7 @@ update_lock_file = rule(
6770
"repofile": attr.string(),
6871
"nobest": attr.bool(default = False),
6972
"cache_dir": attr.string(),
73+
"architecture": attr.string(values = ["i686", "x86_64", "aarch64", ""]),
7074
"_runner": attr.label(allow_single_file = True, default = Label("//bazeldnf/private:update-lock-file.sh")),
7175
},
7276
toolchains = [

0 commit comments

Comments
 (0)