From 3505c49b9a84a267716fdff59cf2b84f00a38136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 2 Nov 2026 18:25:34 -0300 Subject: [PATCH] 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. --- xCAT-server/lib/xcat/plugins/anaconda.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index dee1055d44..dcc6c3859e 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -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) {