2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2026-09-12 04:26:25 +00:00

fix(grub2-xcat): epoch bump to satisfy xCAT-server; dynamic src.rpm URL

xCAT-server Requires: grub2-xcat >= 2.02-0.76.el7.1.snap201905160255, but the el10
rewrite reset grub2-xcat to Version 1.0 -- which can never satisfy that. Add Epoch: 1
so 1:1.0-2 outranks 0:2.02 and the (unchanged) xCAT-server dependency resolves.

Also stop pinning the upstream grub2 source rpm URL (the distro rolls grub2 forward
and prunes the old src.rpm from the mirror -> 404). grub2-xcat/mockbuild.pl now
resolves the current grub2 source rpm URL via dnf (download --source --url, then
repoquery --location) unless --upstream-url is given.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-07-02 10:11:51 -03:00
parent a83a23c57a
commit 1361332d6e
2 changed files with 33 additions and 1 deletions
+4
View File
@@ -1,5 +1,9 @@
Summary: grub2 resources generated by grub2-mknetdir
Name: grub2-xcat
# This el10 rewrite reset the version scheme from the el7-era 2.02 down to 1.0, but
# xCAT-server still Requires: grub2-xcat >= 2.02-0.76.el7.1.snap201905160255. An Epoch
# bump makes 1:1.0 outrank 0:2.02 so the (unchanged) xCAT-server dependency resolves.
Epoch: 1
Version: 1.0
#Release: snap%(date +"%Y%m%d%H%M")
Release: 2
+29 -1
View File
@@ -15,7 +15,10 @@ my $spec_file = "$pkg_dir/grub2-xcat.spec";
my $recompile_dir = "$repo_root/grub2-xcat.recompile";
my $resource_mode = 'reuse-grub2-res';
my $upstream_url = 'https://mirror.stream.centos.org/10-stream/BaseOS/source/tree/Packages/grub2-2.12-37.el10.src.rpm';
# Empty by default -> resolved dynamically from the distro's source repo (a pinned URL rots:
# the distro bumps grub2 and prunes the old src.rpm from the mirror -> 404). Override with
# --upstream-url to force a specific source rpm.
my $upstream_url = '';
my $upstream_file = '';
my $work_dir = '/tmp/grub2-xcat-mockbuild';
my $mock_cfg = '';
@@ -56,6 +59,16 @@ for my $bin (qw(wget mock rpmbuild rpm dnf file bash tar sha256sum grep cmp cut)
my ($version, @spec_assets) = parse_spec($spec_file);
die "Could not parse Version from $spec_file\n" if !$version;
# Resolve the grub2 source RPM URL dynamically unless one was passed. This replaces the old
# hard-pinned mirror.stream.centos.org URL that 404s once the distro rolls grub2 forward.
if (!$upstream_url) {
$upstream_url = resolve_grub2_src_url();
die "Could not resolve a current grub2 source RPM URL from the source repos.\n"
. "Enable a *-source repo (e.g. baseos-source / BaseOS Source) or pass --upstream-url.\n"
if !$upstream_url;
print "Resolved grub2 source RPM URL: $upstream_url\n";
}
if (!$upstream_file) {
$upstream_file = basename($upstream_url);
}
@@ -366,6 +379,21 @@ sub run {
}
}
# resolve_grub2_src_url: ask dnf for the current grub2 source rpm URL from the host's source
# repos, so we track the distro's grub2 instead of a pinned (and eventually 404ing) version.
sub resolve_grub2_src_url {
for my $cmd (
'dnf download --source grub2 --url 2>/dev/null',
'dnf repoquery --quiet --qf "%{location}" --source grub2 2>/dev/null',
) {
print "+ $cmd\n";
my $out = `$cmd`;
my ($url) = $out =~ m{(https?://\S+/grub2-\S+\.src\.rpm)};
return $url if $url;
}
return '';
}
sub capture {
my ($cmd) = @_;
print "+ $cmd\n";