2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2026-09-12 12:36:23 +00:00

refactor(genesis): follow perl style

This commit is contained in:
Vinícius Ferrão
2026-09-04 18:11:23 -03:00
parent 58060fd5a4
commit 86e2df00cb
3 changed files with 19 additions and 14 deletions
+13 -8
View File
@@ -3,7 +3,9 @@
use strict;
use warnings;
use Carp qw(croak);
use Cwd qw(abs_path);
use English qw(-no_match_vars);
use File::Basename qw(basename dirname);
use File::Copy qw(copy);
use File::Path qw(make_path);
@@ -75,14 +77,17 @@ if ($requested{s390x}) {
capture_command($architecture_reporter, '--list-architectures');
};
}
my $report_error = $@;
die "xcat-core source does not report supported Genesis architectures: $report_error"
if $report_error;
die "xcat-core source reported no supported Genesis architectures\n"
unless defined($supported_output) && length($supported_output);
my %supported_architecture = map { $_ => 1 } split(/\s+/, $supported_output);
die "xcat-core source does not support Genesis architecture s390x\n"
unless $supported_architecture{s390x};
my $report_error = $EVAL_ERROR;
if ($report_error) {
croak "xcat-core source does not report supported Genesis architectures: $report_error";
}
if (!defined($supported_output) || !length $supported_output) {
die "xcat-core source reported no supported Genesis architectures\n";
}
my %supported_architecture = map { $_ => 1 } split m{\s+}xms, $supported_output;
if (!$supported_architecture{s390x}) {
die "xcat-core source does not support Genesis architecture s390x\n";
}
}
die "xcat-core checkout is not clean\n"
if capture_command('git', '-C', $xcat_source, 'status', '--porcelain') ne '';
+3 -3
View File
@@ -378,7 +378,7 @@ if ($genesis_release ne '') {
die "Genesis release changed during verification\n"
unless hashes_equal($checksums_before, $checksums_after);
my %release_architecture = map { $_ => 1 }
split(/,/, $manifest->{architectures});
split m{,}xms, $manifest->{architectures};
my @omitted = grep { !$release_architecture{$_} } architectures();
die "Genesis release version $manifest->{version} omits currently supported architectures: @omitted\n"
if @omitted;
@@ -1129,9 +1129,9 @@ sub common_repository_requirements {
my @supported_names = map { rpm_package_name($_) } architectures();
my %supported = map { $_ => 1 } @supported_names;
my @manifest_missing = grep { !exists($common{$_}) } @supported_names;
my @manifest_missing = grep { !exists $common{$_} } @supported_names;
my @manifest_unknown = grep {
/^xCAT-genesis-openembedded-/ && !$supported{$_}
m{\AxCAT-genesis-openembedded-}xms && !$supported{$_}
} sort keys %common;
die "FATAL: [common] is missing supported packages: @manifest_missing\n"
if @manifest_missing;
+3 -3
View File
@@ -319,7 +319,7 @@ if ($genesis_release ne '') {
die "FATAL: Genesis release changed during verification\n"
unless XCAT::BuildUtils::hashes_equal($before, $after);
my %release_architecture = map { $_ => 1 }
split(/,/, $release_manifest->{architectures});
split m{,}xms, $release_manifest->{architectures};
my @omitted = grep {
!$release_architecture{$_}
} XCAT::GenesisRelease::architectures();
@@ -1065,9 +1065,9 @@ sub verify_shared_pool {
XCAT::GenesisRelease::deb_package_name($_)
} XCAT::GenesisRelease::architectures();
my %supported = map { $_ => 1 } @supported_names;
my @manifest_missing = grep { !exists($shared{$_}) } @supported_names;
my @manifest_missing = grep { !exists $shared{$_} } @supported_names;
my @manifest_unknown = grep {
/^xcat-genesis-openembedded-/ && !$supported{$_}
m{\Axcat-genesis-openembedded-}xms && !$supported{$_}
} sort keys %shared;
die "FATAL: [shared] is missing supported packages: @manifest_missing\n"
if @manifest_missing;