From d1b2a43a84a116eccadd4ab72e7c7614689fe78f Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 25 Jan 2022 15:48:47 +1100 Subject: [PATCH] centos: do not use $releasever in .repo files For centos stream, the $releasever is just the major version. Several of our .repo files are using $releasever in their path, and I think that 8-stream installs are actually using 8 repos to install from. For 9-stream, which doesn't have a corresponding 9, we're getting errors enabling some of the aarch64 tests. Replace all the $releasever expansions in the .repo files with the exact version they are being installed for. They don't need to be generic; we are installing these specific repos for each DIB_RELEASE, so they don't mix-and-match. Change-Id: I48d438d8f51280cd060433fc8a67358d8345287f --- .../centos-minimal/yum.repos.d/8-stream/appstream.repo | 2 +- .../centos-minimal/yum.repos.d/8-stream/base.repo | 2 +- .../elements/yum-minimal/root.d/08-yum-chroot | 9 ++++++--- .../templates/centos-minimal/8-stream/appstream.repo.j2 | 2 +- .../templates/centos-minimal/8-stream/base.repo.j2 | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/diskimage_builder/elements/centos-minimal/yum.repos.d/8-stream/appstream.repo b/diskimage_builder/elements/centos-minimal/yum.repos.d/8-stream/appstream.repo index 0c8c2a20..e4213df3 100644 --- a/diskimage_builder/elements/centos-minimal/yum.repos.d/8-stream/appstream.repo +++ b/diskimage_builder/elements/centos-minimal/yum.repos.d/8-stream/appstream.repo @@ -1,5 +1,5 @@ [Stream-AppStream] name=CentOS-Stream - AppStream -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream +mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=AppStream gpgcheck=0 diff --git a/diskimage_builder/elements/centos-minimal/yum.repos.d/8-stream/base.repo b/diskimage_builder/elements/centos-minimal/yum.repos.d/8-stream/base.repo index b8546d9a..6b48d2a9 100644 --- a/diskimage_builder/elements/centos-minimal/yum.repos.d/8-stream/base.repo +++ b/diskimage_builder/elements/centos-minimal/yum.repos.d/8-stream/base.repo @@ -1,5 +1,5 @@ [Stream-BaseOS] name=CentOS-Stream - Base -mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS +mirrorlist=http://mirrorlist.centos.org/?release=8-stream&arch=$basearch&repo=BaseOS gpgcheck=0 diff --git a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot index f848cb73..0127b15f 100755 --- a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot +++ b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot @@ -140,10 +140,13 @@ function _install_repos { # ${TMPDIR}/yum-$USER-random. Since we don't need this once the # initial download happens, redirect TMPDIR for this call so we # can clean it up nicely + # + # Note that the $releasever for centos-stream is just the major + # version. There is another variable "$stream" that we don't pass local temp_tmp temp_tmp=$(mktemp -d) TMPDIR=${temp_tmp} ${HOST_YUM_DOWNLOADER} --verbose \ - --releasever=${DIB_RELEASE} \ + --releasever=${DIB_RELEASE/-*/} \ --setopt=reposdir=$repo \ --setopt=cachedir=$temp_tmp \ --destdir=$WORKING \ @@ -205,8 +208,8 @@ function _install_pkg_manager { # the yumdownloader calls above in _install_repos want to use # ~/.rpmdb/ ... there is nothing in the build-system /var/lib/rpm! # - # Another issue we hit is having to set --releasedir here. yum - # determines $releasevar based on (more or less) "rpm -q + # Another issue we hit is having to set --releasever here. yum + # determines $releasever based on (more or less) "rpm -q # --whatprovides $distroverpkg". By default, this is # "redhat-release" (fedora-release provides redhat-release) but # some platforms like CentOS override it in /etc/yum.conf (to diff --git a/roles/dib-setup-gate-mirrors/templates/centos-minimal/8-stream/appstream.repo.j2 b/roles/dib-setup-gate-mirrors/templates/centos-minimal/8-stream/appstream.repo.j2 index a996540c..0ded296f 100644 --- a/roles/dib-setup-gate-mirrors/templates/centos-minimal/8-stream/appstream.repo.j2 +++ b/roles/dib-setup-gate-mirrors/templates/centos-minimal/8-stream/appstream.repo.j2 @@ -1,5 +1,5 @@ [Stream-AppStream] name=CentOS-Stream - AppStream -baseurl=https://{{ mirror_fqdn }}/centos/$releasever/AppStream/$basearch/os/ +baseurl=https://{{ mirror_fqdn }}/centos/8-stream/AppStream/$basearch/os/ gpgcheck=0 diff --git a/roles/dib-setup-gate-mirrors/templates/centos-minimal/8-stream/base.repo.j2 b/roles/dib-setup-gate-mirrors/templates/centos-minimal/8-stream/base.repo.j2 index bcab6d6d..bd123cfc 100644 --- a/roles/dib-setup-gate-mirrors/templates/centos-minimal/8-stream/base.repo.j2 +++ b/roles/dib-setup-gate-mirrors/templates/centos-minimal/8-stream/base.repo.j2 @@ -1,5 +1,5 @@ [Stream-BaseOS] name=CentOS-Stream - Base -baseurl=https://{{ mirror_fqdn }}/centos/$releasever/BaseOS/$basearch/os/ +baseurl=https://{{ mirror_fqdn }}/centos/8-stream/BaseOS/$basearch/os/ gpgcheck=0