2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-26 17:54:05 +00:00

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.
This commit is contained in:
Vinícius Ferrão
2026-08-20 18:53:54 -03:00
parent 428e5fa0f3
commit e7633d0dba
+9 -4
View File
@@ -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 <distro>-<release>-<arch>, 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