2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-22 18:32:13 +00:00

fix(xcat-core): xCAT-selinux is built for openSUSE, which has no selinux-policy-devel

xcat-core-build-opensuse #42 failed on three packages whose only error was
"No matching package to install: selinux-policy-devel", and took the whole
openSUSE family of xcat-ci #146 down with it. openSUSE Leap ships no
selinux-policy-devel, so the policy module has nothing to compile against.

package_skip_reason in build-utils/lib/XCAT/BuildUtils.pm tested the target
against /\Aopeneuler-/, because openEuler was the one non-EL family buildrpms.pl
targeted when the guard was written. openSUSE was enabled afterwards and matches
no arm of that test, so the EL-only package was selected for it.

The test is now 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.

selinux_el_only_scope.t gains the two openSUSE targets. Without this change its
two new assertions fail and the other 35 pass.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-23 08:45:54 -03:00
parent e9f27f139b
commit 87f9e886d9
2 changed files with 29 additions and 6 deletions
+16 -4
View File
@@ -813,17 +813,29 @@ sub cancel_build {
# 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.
# 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',
);
# Why $pkg is not built for $target, or undef when the pair is built. openEuler
# is the one non-EL family buildrpms.pl targets.
# 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.
sub package_skip_reason {
my ($pkg, $target) = @_;
my $reason = $EL_ONLY_PACKAGES{ $pkg // '' } or return undef;
return undef unless defined($target) && $target =~ /\Aopeneuler-/;
# 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;
}
+13 -2
View File
@@ -23,6 +23,15 @@ my @openeuler_targets = qw(
openeuler-24.03sp4-x86_64
openeuler-24.03-ppc64le
);
# openSUSE Leap ships no selinux-policy-devel at all, so the module has nothing
# to compile against. The guard this test was written with named openEuler, and
# openSUSE was enabled afterwards: xcat-core-build-opensuse #42 spent three
# attempts on "No matching package to install: selinux-policy-devel" and took
# the whole openSUSE family down with it.
my @opensuse_targets = qw(
opensuse-leap-15.6-x86_64
opensuse-leap-42.3-x86_64
);
my @el_targets = qw(
alma+epel-8-x86_64
alma+epel-9-x86_64
@@ -34,9 +43,9 @@ 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;
skip 'BuildUtils has no build-plan decision', 20 unless $decides;
foreach my $target (@openeuler_targets) {
foreach my $target (@openeuler_targets, @opensuse_targets) {
ok($decides->('xCAT-selinux', $target),
"xCAT-selinux is not built for $target");
}
@@ -51,6 +60,8 @@ SKIP: {
xCAT-genesis-scripts xCAT-test xCAT-release)) {
is($decides->($pkg, 'openeuler-22.03sp4-x86_64'), undef,
"$pkg is built for openEuler");
is($decides->($pkg, 'opensuse-leap-15.6-x86_64'), undef,
"$pkg is built for openSUSE");
}
}