From 6238eb641547ecf445b5ea4e717d8a4011398ff8 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Thu, 16 Jul 2026 18:22:29 -0300 Subject: [PATCH] fix(mockbuild-all): resolve mock config by .cfg file existence, not by running mock mock --print-root-path can fail transiently (bootstrap chroot setup, a concurrent mock holding a lock), which made el10 flakily resolve to the long os_id form that has no .cfg and then die 'Could not find mock config for almalinux+epel-10-...'. Check /etc/mock/.cfg existence instead -- deterministic and fast. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- mockbuild-all.pl | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/mockbuild-all.pl b/mockbuild-all.pl index f3659a9..429d1f1 100755 --- a/mockbuild-all.pl +++ b/mockbuild-all.pl @@ -1047,21 +1047,19 @@ sub resolve_mock_cfg { 'centos-stream' => 'centos-stream', rocky => 'rocky', ); - my $candidate = "${os_id}+epel-${rel}-${arch}"; - my $rc = system("mock -r " . sh_quote($candidate) . " --print-root-path >/dev/null 2>&1"); - if ($rc == 0) { - return $candidate; - } - if (exists $short_forms{$os_id}) { - my $short = $short_forms{$os_id}; - $candidate = "${short}+epel-${rel}-${arch}"; - $rc = system("mock -r " . sh_quote($candidate) . " --print-root-path >/dev/null 2>&1"); - if ($rc == 0) { - print "Mock config resolved (short form): $candidate\n"; + # Resolve by CONFIG-FILE existence, not by running `mock --print-root-path`: the latter can fail + # transiently (bootstrap chroot setup, a concurrent mock holding a lock) and made el10 flakily + # "resolve" to the long form that has no .cfg. Checking /etc/mock/.cfg is deterministic. + for my $id ($os_id, (exists $short_forms{$os_id} ? ($short_forms{$os_id}) : ())) { + my $candidate = "${id}+epel-${rel}-${arch}"; + if (-f "/etc/mock/${candidate}.cfg") { + print "Mock config resolved: $candidate\n" if $id ne $os_id; return $candidate; } } - die "Could not find mock config for ${os_id}+epel-${rel}-${arch}\n"; + my $short = $short_forms{$os_id} // $os_id; + die "Could not find mock config for ${os_id}+epel-${rel}-${arch} " + . "(tried /etc/mock/${os_id}+epel-${rel}-${arch}.cfg and /etc/mock/${short}+epel-${rel}-${arch}.cfg)\n"; } sub build_mock_uniqueext {