From e7633d0dbadd864ebd9e77dc255156222a620f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Thu, 20 Aug 2026 18:53:54 -0300 Subject: [PATCH] build(buildrpms): derive the rpm arch from suffixed mock targets targetarch_from_target took the last dash-separated part of the mock target name as the architecture. The riscv64 forcearch configuration is named rocky-10-riscv64-xcat, so riscv64 builds looked for xCAT-genesis-scripts-xcat srpms and failed. Take the last part that names an architecture and only fall back to the last part when none does; stock targets are unaffected. --- buildrpms.pl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/buildrpms.pl b/buildrpms.pl index 153be05c8..8029c8def 100755 --- a/buildrpms.pl +++ b/buildrpms.pl @@ -297,10 +297,15 @@ sub genesis_tarch_from_targetarch { sub targetarch_from_target { my ($target) = @_; return $ARCH unless defined $target && length $target; - my @parts = split /-/, $target; - my $arch = $parts[-1]; - $arch =~ s/^\s+|\s+$//g; - return lc $arch; + # mock configs are named --, but a site config may carry a + # suffix (e.g. rocky-10-riscv64-xcat, the forcearch config for riscv64 builds on an + # x86_64 host), so take the last part that names an architecture and only fall back + # to the last part when none does. + my @parts = map { my $p = lc $_; $p =~ s/^\s+|\s+$//g; $p } split /-/, $target; + for my $part (reverse @parts) { + return $part if $part =~ /^(?:x86_64|i[3-6]86|ppc64le|ppc64|aarch64|riscv64|s390x|armv7hl)$/; + } + return $parts[-1]; } # product(\@A, \@B) returns the catersian product of \@A and \@B