mirror of
https://github.com/xcat2/xcat-dep.git
synced 2026-11-26 04:12:21 +00:00
fix(xcat-dep): goconserver cannot fetch its modules in a Leap chroot
With the toolchain dependency resolved, the Leap 42.3 build reaches the Go compile and every module fetch fails: x509: certificate signed by unknown authority openSUSE splits its CA trust. 'ca-certificates' is the tooling and carries no root certificate; the roots are in 'ca-certificates-mozilla'. The pinned-Go path asks for the tooling alone, which is worse than asking for nothing: installing it hands the trust store to a package that does not fill it. Measured in a Leap 42.3 chroot, Go's system pool holds 146 roots before 'ca-certificates' is installed, 0 after it, and 201 once 'ca-certificates-mozilla' is added. The middle reading is the build failure. EL and openEuler keep their roots in 'ca-certificates' itself, which is why only openSUSE needs a second package. goconserver_pinned_go_buildrequires() now names what a pinned-Go chroot needs, and adds the roots package on openSUSE. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
+20
-1
@@ -30,7 +30,7 @@ our @EXPORT_OK = qw(
|
||||
make_traversable_path epel_target_profile epel_cell_path cell_lock_path
|
||||
native_owner_command NATIVE_BUILD_GID
|
||||
openeuler_build_target openeuler_repo_subdir
|
||||
goconserver_needs_pinned_go
|
||||
goconserver_needs_pinned_go goconserver_pinned_go_buildrequires
|
||||
recover_common_repository
|
||||
);
|
||||
|
||||
@@ -100,6 +100,25 @@ sub goconserver_needs_pinned_go {
|
||||
return 0;
|
||||
}
|
||||
|
||||
# goconserver_pinned_go_buildrequires($target): what a pinned-Go build needs IN the chroot,
|
||||
# beyond the toolchain archive it brings itself. undef when the chroot supplies Go.
|
||||
#
|
||||
# go build fetches the pinned modules over HTTPS, so the chroot must hold CA roots. openSUSE
|
||||
# splits them: 'ca-certificates' is the tooling and carries no root, and the roots are in
|
||||
# 'ca-certificates-mozilla'. Asking for the tooling alone is worse than asking for nothing.
|
||||
# Measured in a Leap 42.3 chroot, Go's system pool holds 146 roots before 'ca-certificates' is
|
||||
# installed and 0 after it, because the package takes the trust store over without filling it;
|
||||
# go build then fails every module fetch with "x509: certificate signed by unknown authority".
|
||||
# With 'ca-certificates-mozilla' the pool holds 201. EL and openEuler keep the roots in
|
||||
# 'ca-certificates' itself and need no second package.
|
||||
sub goconserver_pinned_go_buildrequires {
|
||||
my ($target) = @_;
|
||||
return undef unless goconserver_needs_pinned_go($target);
|
||||
my @req = qw(coreutils tar gzip ca-certificates);
|
||||
push @req, 'ca-certificates-mozilla' if $target =~ /\Aopensuse-/;
|
||||
return join(' ', @req);
|
||||
}
|
||||
|
||||
# missing_perl_modules(@modules): those that cannot be loaded, in order. The point of --install-deps
|
||||
# is that the run AFTER it cannot die on a missing module, so the modules are proven by loading
|
||||
# them, not by trusting the package manager's exit code.
|
||||
|
||||
@@ -11,7 +11,7 @@ use POSIX qw(strftime);
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin/..", "$FindBin::Bin/../lib";
|
||||
use MockBuildUtils qw(openeuler_build_target openeuler_repo_subdir
|
||||
goconserver_needs_pinned_go);
|
||||
goconserver_needs_pinned_go goconserver_pinned_go_buildrequires);
|
||||
use XCAT::BuildUtils qw(digest_file read_lines);
|
||||
|
||||
my $script_dir = abs_path(dirname(__FILE__));
|
||||
@@ -240,7 +240,7 @@ if ($pinned_go) {
|
||||
run("wget --https-only --tries=3 --timeout=60 -q -O " . sh_quote($go_archive) . " " . sh_quote($go_url));
|
||||
die "Go toolchain checksum mismatch: $go_file\n" unless digest_file($go_archive) eq $go_hash;
|
||||
$go_source = "Source3: $go_url\n";
|
||||
$go_requires = 'coreutils tar gzip ca-certificates';
|
||||
$go_requires = goconserver_pinned_go_buildrequires($mock_cfg);
|
||||
$go_prep = "echo '$go_hash %{SOURCE3}' | sha256sum -c -\ntar -C %{_builddir} -xzf %{SOURCE3}\n";
|
||||
$go_environment = 'export PATH=%{_builddir}/go/bin:$PATH' . "\ngo version\n";
|
||||
}
|
||||
|
||||
@@ -54,4 +54,29 @@ for my $target (sort keys %pinned) {
|
||||
is($needs->(undef) ? 1 : 0, 0, 'an undefined target does not ask for the toolchain archive');
|
||||
is($needs->('') ? 1 : 0, 0, 'an empty target does not ask for the toolchain archive');
|
||||
|
||||
# go build fetches modules over HTTPS, so a pinned-Go chroot needs CA roots. openSUSE keeps the
|
||||
# roots in ca-certificates-mozilla and ships only tooling in ca-certificates; EL and openEuler
|
||||
# keep them in ca-certificates itself. Measured in a Leap 42.3 chroot: Go's system pool holds 146
|
||||
# roots with no ca-certificates package, 0 once ca-certificates alone is installed, and 201 once
|
||||
# ca-certificates-mozilla is added.
|
||||
my $req = MockBuildUtils->can('goconserver_pinned_go_buildrequires');
|
||||
ok($req, 'MockBuildUtils says what a pinned-Go chroot needs installed')
|
||||
or do { done_testing(); exit 0 };
|
||||
|
||||
for my $target (sort keys %pinned) {
|
||||
my $got = $req->($target);
|
||||
if (!$pinned{$target}) {
|
||||
is($got, undef, "$target needs no toolchain dependencies");
|
||||
next;
|
||||
}
|
||||
like($got, qr/\bca-certificates\b/, "$target installs the CA tooling");
|
||||
if ($target =~ /\Aopensuse-/) {
|
||||
like($got, qr/\bca-certificates-mozilla\b/,
|
||||
"$target also installs the roots, which openSUSE packages separately");
|
||||
} else {
|
||||
unlike($got, qr/ca-certificates-mozilla/,
|
||||
"$target keeps its roots in ca-certificates and asks for no openSUSE package");
|
||||
}
|
||||
}
|
||||
|
||||
done_testing();
|
||||
|
||||
Reference in New Issue
Block a user