yum-minimal: use DNF tools on host
The latest Debian bullseye release doesn't provide yum any more, only DNF. This breaks the minimal builds that are using on-host yum tools to start the chroot. Probe for yumdownloader, and if it's not there, use DNF. Note this requires "dnf download" which may not be packaged. See I21cfbd3935e48be4b92591ea36c7eed301230753 for a sample work-around that installs this plugin in the nodepool-builder container. Change-Id: Ia7f1e4d115cc67c378d865d91af94a07b8cdc6cc
This commit is contained in:
parent
a6ee4d0c21
commit
5f47584196
@ -19,11 +19,12 @@ gnupg2 [!platform:redhat !platform:ubuntu-trusty !platform:suse]
|
||||
# ubuntu
|
||||
apt-transport-https [platform:dpkg]
|
||||
inetutils-ping [platform:dpkg]
|
||||
python-lzma [platform:dpkg !platform:ubuntu-focal]
|
||||
python-lzma [platform:dpkg !platform:ubuntu-focal !platform:debian-bullseye]
|
||||
qemu-utils [platform:dpkg]
|
||||
rpm [platform:dpkg]
|
||||
uuid-runtime [platform:dpkg]
|
||||
yum-utils [platform:dpkg !platform:ubuntu-focal]
|
||||
yum-utils [platform:dpkg !platform:ubuntu-focal !platform:debian-bullseye]
|
||||
dnf [platform:debian-bullseye]
|
||||
debootstrap [platform:dpkg]
|
||||
procps [platform:dpkg]
|
||||
|
||||
|
@ -46,6 +46,16 @@ trap "$EACTION" EXIT
|
||||
YUM_CACHE=$DIB_IMAGE_CACHE/yum
|
||||
mkdir -p $YUM_CACHE
|
||||
|
||||
# Debian Bullseye and beyond only has DNF locally
|
||||
HOST_YUM_DOWNLOADER="yumdownloader"
|
||||
HOST_YUM="yum"
|
||||
if ! command -v yumdownloader &> /dev/null
|
||||
then
|
||||
HOST_YUM_DOWNLOADER="dnf download"
|
||||
HOST_YUM="dnf"
|
||||
fi
|
||||
|
||||
|
||||
# Note, on Debian/Ubuntu, %_dbpath is set in the RPM macros as
|
||||
# ${HOME}/.rpmdb/ -- this makes sense as RPM isn't the system
|
||||
# packager. This path is relative to the "--root" argument
|
||||
@ -55,7 +65,7 @@ _RPM="rpm --dbpath=/var/lib/rpm"
|
||||
# chroot, which are needed to bootstrap yum/dnf
|
||||
#
|
||||
# note this runs outside the chroot, where we're assuming the platform
|
||||
# has yum/yumdownloader
|
||||
# has yum/yumdownloader/dnf download
|
||||
function _install_repos {
|
||||
local packages
|
||||
local rc
|
||||
@ -130,7 +140,7 @@ function _install_repos {
|
||||
# can clean it up nicely
|
||||
local temp_tmp
|
||||
temp_tmp=$(mktemp -d)
|
||||
TMPDIR=${temp_tmp} yumdownloader --verbose \
|
||||
TMPDIR=${temp_tmp} ${HOST_YUM_DOWNLOADER} --verbose \
|
||||
--releasever=${DIB_RELEASE/-*/} \
|
||||
--setopt=reposdir=$repo \
|
||||
--setopt=cachedir=$temp_tmp \
|
||||
@ -237,7 +247,7 @@ function _install_pkg_manager {
|
||||
sudo ln -s $TARGET_ROOT/etc/dnf/vars $TARGET_ROOT/etc/yum/vars
|
||||
fi
|
||||
|
||||
sudo -E yum -y \
|
||||
sudo -E ${HOST_YUM} -y \
|
||||
--disableexcludes=all \
|
||||
--setopt=cachedir=$YUM_CACHE/$ARCH/$DIB_RELEASE \
|
||||
--setopt=reposdir=$TARGET_ROOT/etc/yum.repos.d \
|
||||
|
6
releasenotes/notes/yum-minimal-dnf-63305c349bcccdd4.yaml
Normal file
6
releasenotes/notes/yum-minimal-dnf-63305c349bcccdd4.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
This includes updates to allow `yum-minimal` elements to work on
|
||||
host platforms that only supply DNF (e.g. Debian Bullseye). Note
|
||||
the `dnf download` plugin is required on these platforms.
|
Loading…
Reference in New Issue
Block a user