2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-07-31 10:09:40 +00:00

fix(xcat-core): fold release-alias finalize into merge_core_repos

merge_core_repos already assembles the multi-arch core and runs the full
finalize tail (index -> sign -> final metadata -> write_release_alias, in the
required order so the xCAT-release-latest alias lands AFTER metadata and stays
out of the repo index). The preceding commit restored a separate finalize_core
sub purely to satisfy xcat_release_package.t, which grepped for
'sub finalize_core { ... $dir ... }'. That left two overlapping entry points:
--finalize-core (finalize one pre-assembled dir) and --merge-core-repos
(assemble N per-arch dirs THEN finalize) -- the former a strict subset of the
latter, with no in-tree or CI caller.

Consolidate on the single assemble+finalize path: inline the finalize tail into
merge_core_repos, drop sub finalize_core and the --finalize-core getopt/dispatch,
and update xcat_release_package.t to assert the stable alias is created after the
final metadata pass inside merge_core_repos ($out). Behaviour is unchanged (merge
already wrote the alias); only the redundant finalize_core interface is removed.
xcat_release_package.t 26/26; perl -c clean.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-07-30 13:07:06 -03:00
parent e20853681b
commit 5d9286cfb7
2 changed files with 9 additions and 23 deletions
+8 -22
View File
@@ -190,7 +190,6 @@ 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},
@@ -860,29 +859,17 @@ sub merge_core_repos {
and die "Failed to rsync '$in' into '$out'\n";
}
# 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/<target>/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);
# Index, sign (when --gpg-sign), write the final repository metadata, then create the
# xCAT-release-latest stable bootstrap alias. The alias MUST be created AFTER the final
# metadata pass so write_release_alias can unlink it before createrepo and keep it out of
# the repository index.
index_repo($out);
if ($opts{gpg_sign}) {
$ENV{GNUPGHOME} = $opts{gpg_home} if $opts{gpg_home};
sign_repo_dir($dir, $opts{gpg_key_name});
sign_repo_dir($out, $opts{gpg_key_name});
}
write_repo_metadata_dir($dir);
write_release_alias($dir);
write_repo_metadata_dir($out);
write_release_alias($out);
return 0;
}
@@ -958,7 +945,6 @@ 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}->@*;
+1 -1
View File
@@ -72,7 +72,7 @@ ok(
);
like(
$builder,
qr/sub finalize_core \{.*?write_repo_metadata_dir\(\$dir\);.*?write_release_alias\(\$dir\);/s,
qr/sub merge_core_repos \{.*?write_repo_metadata_dir\(\$out\);.*?write_release_alias\(\$out\);/s,
'assembled core repository creates the stable alias after final metadata'
);