Merge "yum-minimal: use DNF tools on host"

This commit is contained in:
Zuul 2021-09-09 00:09:56 +00:00 committed by Gerrit Code Review
commit 8250b33d68
3 changed files with 22 additions and 5 deletions

View File

@ -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]

View File

@ -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 \

View 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.