mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-12-03 23:57:06 +00:00
Merge pull request #7995 from VersatusHPC/fix/opensuse-mn-package-requires
fix(xcat-core): xCAT cannot be installed on an openSUSE management node
This commit is contained in:
@@ -16,6 +16,15 @@ BuildArch: noarch
|
||||
BuildRequires: perl perl-DBI perl-JSON
|
||||
# Do not need the SOAP rpm require, because rpm will generate it automatically if hpoa.pm is included
|
||||
#Requires: perl-SOAP-Lite
|
||||
# openSUSE has no perl-generators, so no perl(...) requirement is generated here and nothing
|
||||
# installs the modules this code loads. xcatd stays inactive without them: xCAT::Table dies
|
||||
# loading JSON. EL and openEuler generate these automatically and need no list.
|
||||
%if 0%{?suse_version}
|
||||
Requires: perl(Expect)
|
||||
Requires: perl(HTML::Form)
|
||||
Requires: perl(JSON)
|
||||
Requires: perl(SNMP)
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%description
|
||||
|
||||
@@ -31,6 +31,12 @@ BuildArch: noarch
|
||||
|
||||
Requires: perl-xCAT = 4:%{version}-%{release}
|
||||
Requires: cpio
|
||||
# openSUSE has no perl-generators, so no perl(...) requirement is generated here and nothing
|
||||
# installs the modules this code loads. xcatd stays inactive without them: xCAT::Table dies
|
||||
# loading JSON. EL and openEuler generate these automatically and need no list.
|
||||
%if 0%{?suse_version}
|
||||
Requires: perl(Expect)
|
||||
%endif
|
||||
|
||||
# fping or nmap is needed by pping (in case xCAT-client is installed by itself on a remote client)
|
||||
%ifos linux
|
||||
|
||||
@@ -52,19 +52,34 @@ Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser perl-Digest-SHA1 pe
|
||||
# Time::HiRes and Text::Balanced) are not pulled in transitively by perl-xCAT
|
||||
# either. List them here or the affected subcommands die at load time.
|
||||
Requires: perl-Net-Telnet perl-Net-DNS perl-Crypt-CBC perl-Crypt-Rijndael
|
||||
# openSUSE has no perl-generators, so no perl(...) requirement is generated here and nothing
|
||||
# installs the modules this code loads. xcatd stays inactive without them: xCAT::Table dies
|
||||
# loading JSON. EL and openEuler generate these automatically and need no list.
|
||||
%if 0%{?suse_version}
|
||||
Requires: perl(Date::Parse)
|
||||
Requires: perl(Expect)
|
||||
Requires: perl(JSON)
|
||||
Requires: perl(SNMP)
|
||||
%endif
|
||||
# DB_File is only used by the Confluent client (lib/xcat/Confluent/Client.pm). EL10
|
||||
# dropped libdb: EPEL still carries perl-DB_File for x86_64 and ppc64le, but riscv64 has
|
||||
# no EPEL at all, so on EL10 ask for the module weakly -- it is installed where it exists
|
||||
# and skipped where it cannot. The dependency generator still turns that "use DB_File"
|
||||
# into a hard perl(DB_File) requirement; drop it there too, appending to any filter the
|
||||
# build root already set. Every other platform keeps the hard requirement it has today.
|
||||
# openSUSE has no package of that name: Leap 15.6 calls it perl-core-DB_File and 42.3 has
|
||||
# neither, but both provide the capability, so ask for the capability there.
|
||||
%if 0%{?rhel} >= 10
|
||||
Recommends: perl-DB_File
|
||||
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(DB_File\\)$
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
Requires: perl(DB_File)
|
||||
%else
|
||||
Requires: perl-DB_File
|
||||
%endif
|
||||
%endif
|
||||
%endif
|
||||
Obsoletes: atftp-xcat
|
||||
%endif
|
||||
|
||||
|
||||
@@ -46,7 +46,8 @@ for my $platform (@platforms) {
|
||||
like($requires, qr/^perl\(Digest::SHA\)$/m, "$name server s390x=$s390 requires Digest::SHA");
|
||||
next if $s390;
|
||||
my $recommends = query('xCAT-server', 'x86_64', $macro, '--recommends');
|
||||
is(scalar(grep { $_ eq 'perl-DB_File' } split /\n/, $requires), $name eq 'EL10' ? 0 : 1,
|
||||
my $db_file = $name =~ /^SLES/ ? 'perl(DB_File)' : 'perl-DB_File';
|
||||
is(scalar(grep { $_ eq $db_file } split /\n/, $requires), $name eq 'EL10' ? 0 : 1,
|
||||
"$name server hard DB_File dependency");
|
||||
is(scalar(grep { $_ eq 'perl-DB_File' } split /\n/, $recommends), $name eq 'EL10' ? 1 : 0,
|
||||
"$name server weak DB_File dependency");
|
||||
|
||||
Executable
+125
@@ -0,0 +1,125 @@
|
||||
#!/usr/bin/env perl
|
||||
# xCAT cannot be installed on either openSUSE management node:
|
||||
#
|
||||
# leap15.6: nothing provides 'perl-DB_File' needed by xCAT-server
|
||||
# sles12: nothing provides (/usr/sbin/dhcpd if openEuler-release else
|
||||
# ((kea and kea-hooks) if (system-release >= 10) else /usr/sbin/dhcpd))
|
||||
# needed by xCAT
|
||||
#
|
||||
# Both requirements are written for EL and have no answer on openSUSE.
|
||||
#
|
||||
# perl-DB_File: no package of that name exists on Leap 15.6 or 42.3. Leap 15.6 calls it
|
||||
# perl-core-DB_File and 42.3 has no such package either, but BOTH provide the capability
|
||||
# perl(DB_File), so the capability is the portable name.
|
||||
#
|
||||
# The dhcpd expression: the sles12 cell is an openSUSE 42.3 management node whose rpm is 4.11,
|
||||
# which has no rich dependencies -- it reports the whole expression as a capability nothing
|
||||
# provides. Neither Leap release carries kea, and both carry chrony, ntp and ISC dhcpd, so the
|
||||
# plain names are what these expressions resolve to on openSUSE anyway.
|
||||
#
|
||||
# A spec is a packaging manifest: the text IS the contract, there is nothing to execute, and
|
||||
# these assertions are on package names in it. The build that proves the requirements resolve is
|
||||
# the openSUSE core build plus the install step on each management node.
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use FindBin qw($RealBin);
|
||||
use Test::More;
|
||||
use File::Slurper qw(read_text);
|
||||
|
||||
my $root = "$RealBin/../..";
|
||||
|
||||
# Each entry: the spec, and what its openSUSE branch must and must not ask for.
|
||||
my @cases = (
|
||||
{
|
||||
spec => 'xCAT/xCAT.spec',
|
||||
require => [ 'chrony', '/usr/sbin/dhcpd' ],
|
||||
},
|
||||
{
|
||||
spec => 'xCATsn/xCATsn.spec',
|
||||
require => [ '/usr/sbin/dhcpd' ],
|
||||
},
|
||||
{
|
||||
# openSUSE has no perl-generators, so no perl(...) requirement is auto-generated and the
|
||||
# modules each package loads must be named. Measured on xcat20-mn after a successful
|
||||
# install: xcatd stayed inactive because xCAT::Table dies loading JSON, and Date::Parse,
|
||||
# Expect, HTML::Form and SNMP were absent too. The other 80 modules the EL build
|
||||
# auto-requires were present. Each list below mirrors what EL's generator emits for that
|
||||
# package.
|
||||
spec => 'xCAT-server/xCAT-server.spec',
|
||||
require => [ 'perl(DB_File)',
|
||||
'perl(Date::Parse)', 'perl(Expect)', 'perl(JSON)', 'perl(SNMP)' ],
|
||||
},
|
||||
{
|
||||
spec => 'perl-xCAT/perl-xCAT.spec',
|
||||
require => [ 'perl(Expect)', 'perl(HTML::Form)', 'perl(JSON)', 'perl(SNMP)' ],
|
||||
},
|
||||
{
|
||||
spec => 'xCAT-client/xCAT-client.spec',
|
||||
require => [ 'perl(Expect)' ],
|
||||
},
|
||||
);
|
||||
|
||||
for my $c (@cases) {
|
||||
my $path = "$root/$c->{spec}";
|
||||
ok(-f $path, "$c->{spec} exists") or next;
|
||||
my $text = read_text($path);
|
||||
|
||||
# The openSUSE branch is the region guarded by %if 0%{?suse_version}. Collect those regions
|
||||
# so an assertion cannot be satisfied by a line that only EL ever sees.
|
||||
my @suse;
|
||||
my $depth = 0;
|
||||
for my $line (split /\n/, $text) {
|
||||
if ($line =~ /^\s*%if\s+0%\{\?suse_version\}/) { $depth = 1; next }
|
||||
if ($depth) {
|
||||
if ($line =~ /^\s*%(?:endif|else)/) { $depth = 0; next }
|
||||
push @suse, $line;
|
||||
}
|
||||
}
|
||||
my $suse = join "\n", @suse;
|
||||
|
||||
for my $want (@{ $c->{require} }) {
|
||||
# a Requires: line may name several capabilities, so match the token anywhere on it
|
||||
my $found = grep { /^\s*Requires:/ && /(?:^|\s)\Q$want\E(?:\s|$)/ } @suse;
|
||||
ok($found, "$c->{spec} asks openSUSE for $want");
|
||||
}
|
||||
}
|
||||
|
||||
subtest 'no rich dependency reaches an openSUSE build' => sub {
|
||||
# rpm 4.11 on the sles12 management node cannot evaluate one, and a single core build serves
|
||||
# both the sles15 and sles12 cells, so the openSUSE branch must carry none.
|
||||
for my $spec (qw(xCAT/xCAT.spec xCATsn/xCATsn.spec)) {
|
||||
my $path = "$root/$spec";
|
||||
my $text = read_text($path);
|
||||
my @suse;
|
||||
my $depth = 0;
|
||||
for my $line (split /\n/, $text) {
|
||||
if ($line =~ /^\s*%if\s+0%\{\?suse_version\}/) { $depth = 1; next }
|
||||
if ($depth) {
|
||||
if ($line =~ /^\s*%(?:endif|else)/) { $depth = 0; next }
|
||||
push @suse, $line;
|
||||
}
|
||||
}
|
||||
my @rich = grep { /^\s*Requires:\s*\(/ } @suse;
|
||||
is(scalar @rich, 0, "$spec gives openSUSE no rich dependency");
|
||||
diag("rich dependency in the openSUSE branch: $_") for @rich;
|
||||
}
|
||||
};
|
||||
|
||||
# The EL and openEuler expressions must survive: this is an addition for openSUSE, not a
|
||||
# replacement of the behaviour every other platform has today.
|
||||
subtest 'EL and openEuler keep the expressions they have' => sub {
|
||||
my $xcat = read_text("$root/xCAT/xCAT.spec");
|
||||
like($xcat, qr/\Qif openEuler-release else\E/,
|
||||
'xCAT.spec still carries the openEuler/EL10 dhcpd expression');
|
||||
like($xcat, qr/\Q(chrony or ntp)\E/,
|
||||
'xCAT.spec still offers EL the choice of chrony or ntp');
|
||||
my $sn = read_text("$root/xCATsn/xCATsn.spec");
|
||||
like($sn, qr/\Qif openEuler-release else\E/,
|
||||
'xCATsn.spec still carries the openEuler/EL10 dhcpd expression');
|
||||
my $srv = read_text("$root/xCAT-server/xCAT-server.spec");
|
||||
like($srv, qr/^\s*Recommends:\s*perl-DB_File\s*$/m,
|
||||
'xCAT-server.spec still asks EL10 weakly for perl-DB_File');
|
||||
};
|
||||
|
||||
done_testing();
|
||||
+10
-1
@@ -78,9 +78,18 @@ Requires: net-tools
|
||||
Requires: /usr/bin/killall
|
||||
# makentp/setupntp configure the MN as an NTP server for its compute nodes and support chronyd/ntpd
|
||||
# only. chrony is the default on EL7+/SLES15+ (and the only option on EL8+); ntp covers the rest.
|
||||
Requires: (chrony or ntp)
|
||||
# openEuler's system-release version does not identify an EL release.
|
||||
#
|
||||
# openSUSE takes plain names. The sles12 cell is an openSUSE 42.3 node whose rpm is 4.11, which
|
||||
# has no rich dependencies and reports the whole expression as an unprovided capability. Neither
|
||||
# Leap release carries kea, so these expressions resolve to chrony and ISC dhcpd there anyway.
|
||||
%if 0%{?suse_version}
|
||||
Requires: chrony
|
||||
Requires: /usr/sbin/dhcpd
|
||||
%else
|
||||
Requires: (chrony or ntp)
|
||||
Requires: (/usr/sbin/dhcpd if openEuler-release else ((kea and kea-hooks) if (system-release >= 10) else /usr/sbin/dhcpd))
|
||||
%endif
|
||||
# On RHEL this pulls in openssh-server, on SLES it pulls in openssh
|
||||
Requires: /usr/bin/ssh
|
||||
%if %nots390x
|
||||
|
||||
@@ -63,7 +63,14 @@ Requires: /usr/bin/killall
|
||||
# yaboot-xcat is pulled in so any SN can manage ppc nodes
|
||||
Requires: httpd nfs-utils nmap bind
|
||||
# openEuler's system-release version does not identify an EL release.
|
||||
#
|
||||
# openSUSE takes the plain name: rpm 4.11 on the sles12 node has no rich dependencies, and
|
||||
# neither Leap release carries kea, so the expression resolves to ISC dhcpd there anyway.
|
||||
%if 0%{?suse_version}
|
||||
Requires: /usr/sbin/dhcpd
|
||||
%else
|
||||
Requires: (/usr/sbin/dhcpd if openEuler-release else ((kea and kea-hooks) if (system-release >= 10) else /usr/sbin/dhcpd))
|
||||
%endif
|
||||
# On RHEL this pulls in openssh-server, on SLES it pulls in openssh
|
||||
Requires: /usr/bin/ssh
|
||||
%ifnarch s390x
|
||||
|
||||
Reference in New Issue
Block a user