Skip to content

Commit e955051

Browse files
authored
Correctly handle riscv64 chroots (#1899)
* Add missing arch to allowed_archs_as_regex_str The `chroot_pattern` in `config.py` couldn't be filtered to remove `riscv64` chroots before this patch because it thought that is was an unknown architecture. * While riscv64 indeed IS a known architecutre now, we still don't want to build for it. When sanitizing the chroots to be used in the config we remove all riscv64 chroots.
1 parent cac9ce5 commit e955051

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

  • snapshot_manager/snapshot_manager

snapshot_manager/snapshot_manager/util.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ def allowed_archs() -> list[str]:
261261
Example:
262262
263263
>>> sorted(allowed_archs())
264-
['aarch64', 'i386', 'ppc64le', 's390x', 'x86_64']
264+
['aarch64', 'i386', 'ppc64le', 'riscv64', 's390x', 'x86_64']
265265
"""
266-
return ["aarch64", "i386", "ppc64le", "s390x", "x86_64"]
266+
return ["aarch64", "i386", "ppc64le", "s390x", "x86_64", "riscv64"]
267267

268268

269269
def allowed_archs_as_regex_str() -> str:
@@ -272,7 +272,7 @@ def allowed_archs_as_regex_str() -> str:
272272
Example:
273273
274274
>>> allowed_archs_as_regex_str()
275-
'(aarch64|i386|ppc64le|s390x|x86_64)'
275+
'(aarch64|i386|ppc64le|s390x|x86_64|riscv64)'
276276
"""
277277
return "(" + "|".join(allowed_archs()) + ")"
278278

@@ -305,6 +305,9 @@ def expect_chroot(chroot: str) -> str:
305305
>>> expect_chroot("centos-stream-10-x86_64")
306306
'centos-stream-10-x86_64'
307307
308+
>>> expect_chroot("fedora-42-riscv64")
309+
'fedora-42-riscv64'
310+
308311
>>> expect_chroot("fedora-rawhide-")
309312
Traceback (most recent call last):
310313
...
@@ -466,6 +469,10 @@ def chroot_arch(chroot: str) -> str:
466469
>>> chroot_arch(chroot="fedora-40-ppc64le")
467470
'ppc64le'
468471
472+
>>> chroot_arch(chroot="fedora-42-riscv64")
473+
'riscv64'
474+
475+
469476
>>> chroot_arch(chroot="fedora-rawhide-NEWARCH")
470477
Traceback (most recent call last):
471478
...
@@ -594,6 +601,8 @@ def latest_branched_fedora_version(
594601
def sanitize_chroots(chroots: list[str]) -> list[str]:
595602
"""Sanitizes chroots:
596603
604+
Removes all risc64 chroots.
605+
597606
Removes all s390x chroots but these:
598607
599608
fedora-rawhide-s390x
@@ -668,6 +677,16 @@ def sanitize_chroots(chroots: list[str]) -> list[str]:
668677
>>> actual = sanitize_chroots(chroots)
669678
>>> actual == expected
670679
True
680+
681+
Example to show that we keep no risc64 chroots
682+
683+
>>> chroots = [
684+
... "fedora-rawhide-riscv64",
685+
... "fedora-rawhide-x86_64"]
686+
>>> expected = [ "fedora-rawhide-x86_64" ]
687+
>>> actual = sanitize_chroots(chroots)
688+
>>> actual == expected
689+
True
671690
"""
672691

673692
# List of arches supported in the previous fedora version.
@@ -694,6 +713,9 @@ def sanitize_chroots(chroots: list[str]) -> list[str]:
694713
)
695714
]
696715

716+
# Filter out riscv64 chroots.
717+
res = [chroot for chroot in res if chroot_arch(chroot) != "riscv64"]
718+
697719
return res
698720

699721

0 commit comments

Comments
 (0)