2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-19 08:52:15 +00:00

fix(anaconda): refuse to mix the RVA20 and RVA23 openEuler media

openEuler publishes RVA20 and RVA23 builds of each riscv64 release. Both
carry the same .treeinfo identity, so copycds copies the second one into
the directory of the first, and the result is a repository with packages
of two builds.

copycds now compares the .discinfo description, RVA23 or empty, with the
copy already in the target directory, and refuses a different build. Media
of the same build, and every other architecture, copy as before.
This commit is contained in:
Vinícius Ferrão
2026-11-02 18:25:34 -03:00
parent fd8e60c21e
commit 3505c49b9a
+24
View File
@@ -119,6 +119,19 @@ sub _openeuler_media_info
return { distname => "openeuler$version", arch => $general{arch} };
}
# The second line of .discinfo, or '' when it is missing.
sub _discinfo_description
{
my ($file) = @_;
open(my $fh, '<', $file) or return '';
<$fh>;
my $description = <$fh>;
close($fh);
return '' unless defined($description);
chomp($description);
return $description;
}
sub _driver_disk_marker_path
{
@@ -2503,6 +2516,17 @@ sub copycd
{
$path = $defaultpath;
}
# The RVA20 and RVA23 builds of an openEuler riscv64 release have the same
# .treeinfo identity. Only the .discinfo description tells them apart.
if ($openeuler_media && -r "$path/.discinfo") {
my $copied = _discinfo_description("$path/.discinfo");
my $media = defined($desc) ? $desc : '';
if (lc($copied) ne lc($media)) {
my $build = length($copied) ? $copied : 'no build name';
$callback->({ error => "$path holds openEuler media of another build ($build). Copy this media to another directory with -p.", errorcode => [1] });
return;
}
}
if ($::XCATSITEVALS{osimagerequired}) {
my ($nohaveimages, $errstr) = xCAT::SvrUtils->update_tables_with_templates($distname, $arch, $path, $osdistroname, checkonly => 1);
if ($nohaveimages) {