diff --git a/xCAT-server/debian/control b/xCAT-server/debian/control index 54f68c79fe..612ac4aa3f 100644 --- a/xCAT-server/debian/control +++ b/xCAT-server/debian/control @@ -8,7 +8,8 @@ Homepage: https://xcat.org/ Package: xcat-server Architecture: all -Depends: ${perl:Depends}, grub-common, libcgi-pm-perl, grub2-xcat (>= 2.02-0.76.el7.1.snap201905160255), perl-xcat (>= 2.13-snap000000000000), xcat-client (>= 2.13-snap000000000000), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, ucf, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl,libjson-perl, libnet-https-nb-perl, libhttp-async-perl, libio-socket-inet6-perl, libsocket6-perl +Depends: ${perl:Depends}, grub-common, libcgi-pm-perl, grub2-xcat (>= 2.02-0.76.el7.1.snap201905160255), perl-xcat (>= 2.13-snap000000000000), xcat-client (>= 2.13-snap000000000000), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, ucf, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl,libjson-perl, libnet-https-nb-perl, libhttp-async-perl +Recommends: libio-socket-inet6-perl, libsocket6-perl Description: Server and configuration utilities of xCAT xCAT-server provides the core server and configuration management components of xCAT. diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec index 4651fc6528..872ae76071 100644 --- a/xCAT-server/xCAT-server.spec +++ b/xCAT-server/xCAT-server.spec @@ -88,14 +88,19 @@ Requires: chkconfig # openssl is present on all EL; require it uniformly (not just el10) so a single # flat xcat-core build is correct everywhere. Excluded on SLES, where the package # name differs and it was never required before. -# -# IO::Socket::INET6 and Socket6 carry the AF_INET6 constants the dual-stack -# listener and the discovery callbacks need. They are not in core perl, so a -# management node without them falls back to IPv4 and an IPv6-only node cannot -# reach xcatd. %if !0%{?suse_version} Requires: openssl -Requires: perl-IO-Socket-INET6 perl-Socket6 +%endif + +# IO::Socket::INET6 and Socket6 carry the AF_INET6 constants the discovery +# callbacks use. Every caller loads them with an eval and keeps working on +# IPv4 when they are absent, so a hard Requires would state a dependency the +# code does not have. Recommends installs them by default and still lets xCAT +# install where they are missing. +# Both are in EL AppStream and in openEuler 24.03 everything. +%if !0%{?suse_version} +Recommends: perl-IO-Socket-INET6 +Recommends: perl-Socket6 %endif %if %fsm diff --git a/xCAT-test/unit/networkutils_ipv6_helpers.t b/xCAT-test/unit/networkutils_ipv6_helpers.t index 9230877f6b..cea9a22171 100644 --- a/xCAT-test/unit/networkutils_ipv6_helpers.t +++ b/xCAT-test/unit/networkutils_ipv6_helpers.t @@ -354,7 +354,10 @@ SKIP: { } SKIP: { - skip 'Socket6 is required for family-specific resolution', 6 unless $has_socket6; + # The family-specific cache keys are the same on both resolver paths, so + # any IPv6 resolver measures this block. It was guarded on Socket6 and + # skipped where the unit suite runs, which has no Socket6. + skip 'No IPv6 resolver is available', 6 unless $has_core_resolver || $has_socket6; local %::hostiphash; is( diff --git a/xCAT-test/unit/xcat_server_inet6_optional_dependency.t b/xCAT-test/unit/xcat_server_inet6_optional_dependency.t new file mode 100644 index 0000000000..54e81f5308 --- /dev/null +++ b/xCAT-test/unit/xcat_server_inet6_optional_dependency.t @@ -0,0 +1,32 @@ +#!/usr/bin/env perl +# Socket6 and IO::Socket::INET6 are loaded with an eval at every call site, and +# the caller keeps working on IPv4 when the load fails. A hard dependency in +# either packaging manifest would state a dependency the code does not have, +# and would stop xCAT installing where the modules are missing. +use strict; +use warnings; +use FindBin; +use lib "$FindBin::Bin/../lib"; +use Test::More; +use XCAT::Test::File qw(slurp_repo_file); + +my $control = slurp_repo_file('xCAT-server/debian/control'); +my ($server) = $control =~ /^Package: xcat-server\n(.*?)(?:\n\n|\z)/ms; +$server //= ''; + +foreach my $package (qw(libsocket6-perl libio-socket-inet6-perl)) { + like( $server, qr/^Recommends:.*\b\Q$package\E\b/m, + "the Debian server package recommends $package" ); + unlike( $server, qr/^Depends:.*\b\Q$package\E\b/m, + "the Debian server package does not require $package" ); +} + +my $spec = slurp_repo_file('xCAT-server/xCAT-server.spec'); +foreach my $package (qw(perl-Socket6 perl-IO-Socket-INET6)) { + like( $spec, qr/^Recommends:.*\b\Q$package\E\b/m, + "the RPM server package recommends $package" ); + unlike( $spec, qr/^Requires:.*\b\Q$package\E\b/m, + "the RPM server package does not require $package" ); +} + +done_testing();