From e20853681b788ff318448195fb03d6d4e525ca6b Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Thu, 30 Jul 2026 12:13:13 -0300 Subject: [PATCH] fix(xcat-core): restore finalize_core so xCAT-release stable-alias test passes The CI buildrpms.pl port (d2d98b724) renamed the upstream sub finalize_core($dir) to merge_core_repos($out) and inlined its index/sign/metadata/alias tail. The xCAT-release logic (write the xCAT-release-latest stable bootstrap alias AFTER the final metadata pass, so it stays out of the repo index) was preserved, but the rename broke xCAT-test/unit/xcat_release_package.t, which statically pins: sub finalize_core { ... write_repo_metadata_dir($dir); ... write_release_alias($dir); } so 'assembled core repository creates the stable alias after final metadata' failed (1 of 26), turning xcat_pr_test red on PR #7701. Restore finalize_core($dir) as the shared finalize primitive (index -> sign -> final metadata -> stable alias) and have merge_core_repos delegate to it on the assembled multi-arch dir. Re-expose the --finalize-core CLI (single already-populated dir) it also feeds. Behaviour is unchanged for both --merge-core-repos (CI) and --finalize-core; only the shared code path is named again. xcat_release_package.t now 26/26; perl -c clean. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- buildrpms.pl | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/buildrpms.pl b/buildrpms.pl index 57b3be13f..43f41a2b4 100755 --- a/buildrpms.pl +++ b/buildrpms.pl @@ -190,6 +190,7 @@ GetOptions( "xcat_dep_path=s" => \$opts{xcat_dep_path}, "setup_local_repos" => \$opts{setup_local_repos}, "merge-core-repos" => \$opts{merge_core_repos}, + "finalize-core=s" => \$opts{finalize_core}, "output-dir=s" => \$opts{output_dir}, "input-core-repos=s{1,}" => \@cli_input_core_repos, "repo-baseurl=s" => \$opts{repo_baseurl}, @@ -859,13 +860,29 @@ sub merge_core_repos { and die "Failed to rsync '$in' into '$out'\n"; } - index_repo($out); + # index + sign + final metadata + stable alias -- shared with the single-dir + # --finalize-core path (finalize_core), so the xCAT-release-latest alias is always + # written AFTER the final metadata pass and excluded from the repo index. + return finalize_core($out); +} + +# finalize_core($dir): index, sign (when --gpg-sign), write the final repository metadata, +# then create the xCAT-release-latest stable bootstrap alias. The alias MUST be written +# after the final metadata pass so write_release_alias can unlink it before createrepo and +# keep it out of the repository index. Called with an explicit dir by merge_core_repos (the +# assembled multi-arch core) and with no arg by the --finalize-core CLI (an already-populated +# single dir, e.g. a per-arch dist//rpms). +sub finalize_core { + my ($dir) = @_; + $dir //= $opts{finalize_core}; + die "FATAL: --finalize-core dir '$dir' does not exist\n" unless defined $dir && -d $dir; + index_repo($dir); if ($opts{gpg_sign}) { $ENV{GNUPGHOME} = $opts{gpg_home} if $opts{gpg_home}; - sign_repo_dir($out, $opts{gpg_key_name}); + sign_repo_dir($dir, $opts{gpg_key_name}); } - write_repo_metadata_dir($out); - write_release_alias($out); + write_repo_metadata_dir($dir); + write_release_alias($dir); return 0; } @@ -941,6 +958,7 @@ sub main { return exit(configure_nginx()) if $opts{configure_nginx}; return exit(setup_local_repos()) if $opts{setup_local_repos}; return exit(merge_core_repos()) if $opts{merge_core_repos}; + return exit(finalize_core()) if $opts{finalize_core}; prepare_xcat_probe_source_tar() if grep { $_ eq "xCAT-probe" } $opts{packages}->@*;