Skip to content

Commit 10d6e89

Browse files
committed
mock: simplify forcearch code
1 parent a889e55 commit 10d6e89

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

mock/py/mock.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -572,18 +572,8 @@ def check_arch_combination(target_arch, config_opts):
572572
# Check below that we can do cross-architecture builds.
573573

574574
option = f"--forcearch={config_opts['forcearch']}"
575-
binary_pattern = config_opts["qemu_user_static_mapping"].get(config_opts["forcearch"])
576-
if not binary_pattern:
577-
# Probably a missing configuration.
578-
log.warning(
579-
"Mock will likely fail, %s is enabled "
580-
"while Mock is unable to detect the corresponding "
581-
"/usr/bin/qemu-*-static binary",
582-
option,
583-
)
584-
time.sleep(5)
585-
return
586-
575+
binary_pattern = config_opts["qemu_user_static_mapping"].get(config_opts["forcearch"],
576+
config_opts["forcearch"])
587577
binary = f'/usr/bin/qemu-{binary_pattern}-static'
588578
if os.path.exists(binary):
589579
return

mock/py/mockbuild/config.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -421,15 +421,8 @@ def setup_default_config_opts():
421421

422422
# mapping from target_arch (or forcearch) to arch in /usr/bin/qemu-*-static
423423
config_opts["qemu_user_static_mapping"] = {
424-
'aarch64': 'aarch64',
425424
'armv7hl': 'arm',
426-
'i386': 'i386',
427425
'i686': 'i386',
428-
'loongarch64': 'loongarch64',
429-
'ppc64': 'ppc64',
430-
'ppc64le': 'ppc64le',
431-
's390x': 's390x',
432-
'x86_64': 'x86_64',
433426
}
434427

435428
config_opts["recursion_limit"] = 5000
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Mock now automatically maps the target build architecture directly to the
2+
appropriate QEMU user-static binary variant for `forcearch` builds. For
3+
example, a build for `riscv64` (for `fedora-43-riscv64` target) is mapped to
4+
`/usr/bin/qemu-riscv64-static` (see the architecture string matches). Mock
5+
config contributors no longer need to modify Mock code to add support for new
6+
architectures (if these architecture specifiers match).

0 commit comments

Comments
 (0)