2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-04 12:07:56 +00:00
Files
xcat-core/build-utils/lib/XCAT/BuildUtils.pm
T
2026-09-01 10:50:23 -03:00

28 lines
572 B
Perl

package XCAT::BuildUtils;
use strict;
use warnings;
use Exporter qw(import);
our @EXPORT_OK = qw(targetarch_from_target);
sub targetarch_from_target {
my ( $target, $default_arch ) = @_;
return $default_arch unless defined($target) && length($target);
my @parts = map {
my $part = lc($_);
$part =~ s/^\s+|\s+$//g;
$part;
} 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];
}
1;