2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-20 09:22:17 +00:00

Merge upstream/master into feat/selinux-netboot

Two conflicts, both from xcat-core/#7978 landing on master.

build-utils/lib/XCAT/BuildUtils.pm: both branches added a package_skip_reason,
#7978 with a general @PACKAGE_SKIPS table and this branch with its own
%EL_ONLY_PACKAGES and a second sub. git merges them as separate hunks because
they sit apart in the file, and Perl takes the LAST definition, so keeping both
silently deletes whichever rule came first. There is now one table and one sub.
A rule names either the target prefixes that do NOT build the package, or, with
`only`, the pattern of the targets that DO. The second form is what an EL-only
package needs: naming the families that are not EL means a family added later
tries to build it, which is how openSUSE reached xCAT-selinux and failed
xcat-core-build-opensuse #42 on a missing selinux-policy-devel.

buildrpms.pl: an empty build plan takes upstream's answer, a clean return rather
than this branch's die. That is the decision #7978 exists for -- the dep
pipeline asks for xCAT-genesis-base alone and no openSUSE target builds it -- so
reinstating the die would fail a build that has nothing to do.

selinux_el_only_scope.t is 37 of 37 and opensuse_no_legacy_genesis.t 22 of 22 on
the merged tree, and the whole unit suite passes: 301 files, 9801 tests.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-23 10:26:24 -03:00
4 changed files with 135 additions and 26 deletions
+46 -24
View File
@@ -49,6 +49,7 @@ our @EXPORT_OK = qw(
genesis_log_errors genesis_log_deny_rules deb_belongs_to_dist
genesis_dists genesis_dist_reason
fips_policy_artifacts fips_policy_plan sync_fips_policy
package_skip_reason
);
# Both builders echo the commands they run under --verbose. Set once, after
@@ -806,37 +807,58 @@ sub cancel_build {
sub DESTROY { shift->release }
}
# The packages that only the EL targets build, and why. xCAT-selinux is EL
# only: its policy module is compiled against the selinux-policy of the build
# target, and openEuler 20.03 and 22.03 carry selinux-policy 3.14.2, which
# defines none of unconfined_server_stream_connectto(), files_map_etc_files()
# or chronyd_manage_pid_files(). m4 leaves an undefined interface name in its
# output, and checkmodule stops on it. openEuler 24.03sp4 carries
# selinux-policy 40.7 and does compile the module, and is excluded too, so no
# openEuler release ships a package the other releases cannot build. openSUSE
# Leap ships no selinux-policy-devel at all.
my %EL_ONLY_PACKAGES = (
'xCAT-selinux' => 'SELinux support is EL only',
);
# The packages a target does not build, and why. A rule names either the target
# prefixes that do NOT build the package, or, with `only`, the pattern of the
# targets that DO.
#
# openSUSE ships no legacy Genesis. Operator decision, 2026-10-22. The payload manifest
# verify-genesis-payload checks is written for EL: on opensuse-leap-15.6-x86_64 it reports 566
# missing zoneinfo/posix paths, etc/redhat-release and 45 EL paths and tool names, so the package
# cannot be built there and under that decision does not need to be.
#
# xCAT-selinux is EL only: its policy module is compiled against the selinux-policy
# of the build target, and openEuler 20.03 and 22.03 carry selinux-policy 3.14.2,
# which defines none of unconfined_server_stream_connectto(), files_map_etc_files()
# or chronyd_manage_pid_files(). m4 leaves an undefined interface name in its output
# and checkmodule stops on it. openEuler 24.03sp4 carries selinux-policy 40.7 and
# does compile the module, and is excluded too, so no openEuler release ships a
# package the other releases cannot build. openSUSE Leap ships no
# selinux-policy-devel at all.
#
# It is named with `only` rather than by listing the families that are not EL,
# because naming them means a family added later TRIES to build it. openSUSE was
# added after the first version of this guard, matched neither arm of its
# /\Aopeneuler-/ test, and xcat-core-build-opensuse #42 spent three attempts on
# "No matching package to install: selinux-policy-devel" and failed the whole
# openSUSE family.
# The EL build targets, named positively: alma+epel-<N>-<arch> for the three EL
# releases, and the suffixed rocky target mock cross-builds riscv64 through.
my $EL_TARGET = qr/\A(?:alma|rocky|centos|rhel)(?:\+epel)?-/;
# Why $pkg is not built for $target, or undef when the pair is built. The test is
# on EL rather than on the families that are not EL, so a family added later
# skips an EL-only package instead of trying to build it. openSUSE was added
# after this guard and matched neither arm of a /\Aopeneuler-/ test, so
# xcat-core-build-opensuse #42 spent three attempts on "No matching package to
# install: selinux-policy-devel" and failed the whole openSUSE family.
my @PACKAGE_SKIPS = (
{ package => 'xCAT-genesis-base',
prefixes => ['opensuse-'],
reason => 'openSUSE ships no legacy Genesis',
},
{ package => 'xCAT-selinux',
only => $EL_TARGET,
reason => 'SELinux support is EL only',
},
);
# Why $pkg is not built for $target, or undef when the pair is built.
sub package_skip_reason {
my ($pkg, $target) = @_;
my $reason = $EL_ONLY_PACKAGES{ $pkg // '' } or return undef;
# No target names no platform. buildrpms.pl always has one; a caller that
# does not is asking about the package, not about a pair.
return undef unless defined($target) && length($target);
return undef if $target =~ $EL_TARGET;
return $reason;
return undef unless defined($pkg) && defined($target) && length($target);
for my $skip (@PACKAGE_SKIPS) {
next unless $pkg eq $skip->{package};
return $skip->{reason} if $skip->{only} && $target !~ $skip->{only};
return $skip->{reason}
if $skip->{prefixes}
&& grep { index($target, $_) == 0 } @{ $skip->{prefixes} };
}
return undef;
}
sub openeuler_build_target {
+7 -2
View File
@@ -1034,8 +1034,13 @@ sub main {
my $why = package_skip_reason($pair->@*);
$why ? print "Skipping $pair->[0] for $pair->[1]: $why\n" : push @rpms, $pair;
}
die "FATAL: every requested package is out of scope for the requested targets\n"
unless @rpms;
# An empty plan is the plan, not a failure. The dep pipeline asks for
# xCAT-genesis-base alone, and no openSUSE target builds it.
if (!@rpms) {
print "Nothing to build: every requested package is out of scope for the"
. " requested targets\n";
return;
}
my $pm = Parallel::ForkManager->new($opts{nproc});
# Track which mock chroot each live child is building so abort_builds can scrub it.
@@ -48,7 +48,14 @@ Source1: xCAT-genesis-scripts.tar.bz2
# so floor it at the 2.18.0 baseline: any 2.18.0-or-newer genesis-base snap satisfies it,
# and core version bumps no longer force a genesis-base re-publish. (RPM ignores release
# when the dependency omits it.)
#
# openSUSE is excluded. Operator decision, 2026-10-22: openSUSE ships no legacy Genesis, so
# no openSUSE target builds xCAT-genesis-base. No OpenEmbedded payload is published for the
# family either, so nothing an openSUSE management node reads can satisfy this name, and
# stating it stops zypper install xCAT.
%if ! 0%{?suse_version}
Requires: xCAT-genesis-base-%{tarch} >= 2:2.18.0
%endif
Buildroot: %{_localstatedir}/tmp/xCAT-genesis
Packager: IBM Corp.
@@ -0,0 +1,75 @@
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
use File::Slurper qw(read_lines);
use Test::More;
use lib "$FindBin::Bin/../../build-utils/lib";
use XCAT::BuildUtils ();
# openSUSE ships no legacy Genesis. Operator decision, 2026-10-22, the same decision taken for
# openEuler on 2026-10-01.
#
# Two artifacts carry it. The build plan decides the (package, target) pairs buildrpms.pl
# builds, and xCAT-genesis-scripts carries the payload requirement that makes an install fail
# when the payload is absent.
#
# Measured 2026-10-22: sles/devel/xcat-dep has no common/ tree (repomd.xml 404, against 200 for
# the EL one), so no OpenEmbedded payload is published for the family either. Nothing in the
# openSUSE graph can satisfy the payload name.
my @opensuse_targets = qw(
opensuse-leap-15.6-x86_64
opensuse-leap-42.3-x86_64
opensuse-leap-15.6-ppc64le
);
my @payload_targets = qw(
alma+epel-8-x86_64
alma+epel-9-x86_64
alma+epel-10-x86_64
alma+epel-10-ppc64le
openeuler-22.03sp4-x86_64
);
my $decides = XCAT::BuildUtils->can('package_skip_reason');
ok($decides, 'BuildUtils decides which packages a target builds');
SKIP: {
skip 'BuildUtils has no build-plan decision', 17 unless $decides;
foreach my $target (@opensuse_targets) {
ok($decides->('xCAT-genesis-base', $target),
"xCAT-genesis-base is not built for $target");
}
foreach my $target (@payload_targets) {
is($decides->('xCAT-genesis-base', $target), undef,
"xCAT-genesis-base is built for $target");
}
# The gate names one package. openSUSE keeps every other package, including the scripts
# half of Genesis: xCAT requires it, and dropping it would be a second decision.
foreach my $pkg (qw(perl-xCAT xCAT xCATsn xCAT-client xCAT-server xCAT-probe
xCAT-genesis-scripts xCAT-test xCAT-release)) {
is($decides->($pkg, 'opensuse-leap-15.6-x86_64'), undef,
"$pkg is built for openSUSE");
}
}
# zypper install xCAT reaches this requirement through xCAT-genesis-scripts. An openSUSE core
# that states it cannot install at all, because no repository the family reads carries the
# payload.
my $root = "$FindBin::Bin/../..";
my @lines = read_lines("$root/xCAT-genesis-scripts/xCAT-genesis-scripts.spec");
my ($index) = grep {
$lines[$_] =~ /^Requires:\s*xCAT-genesis-base-%\{tarch\}\s*>=\s*2:2\.18\.0\s*$/
} 0 .. $#lines;
ok(defined $index, 'xCAT-genesis-scripts requires the legacy Genesis payload');
my $if = defined $index ? $lines[$index - 1] : '';
like($if, qr/^%if\b/, '... behind a condition');
like($if, qr/\Q0%{?suse_version}\E/, '... that reads suse_version');
like($if, qr/^%if\s*!/, '... and excludes openSUSE rather than selecting it');
done_testing();