From ce781fbbc4c6767046cbefda232c4d4de3c8ddcd Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 2 Dec 2015 07:26:26 +1100 Subject: [PATCH] Fix fedora-minimal on CentOS builds As described in the comments, CentOS overrides the "distroverpkg" variable in yum.conf. This is the package that yum queries to establish the value of the $releasever variable. On other platforms, this defaults to "redhat-release" (which "fedora-release" provides) so everything works. It is only when the base-system "distroverpkg" refers to a package not in the chroot we hit the issue. We can avoid this by setting the releasever variable via the commandline. Change-Id: I231c3277960992cd479b8aff7838f246397936f2 --- elements/yum-minimal/root.d/08-yum-chroot | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/elements/yum-minimal/root.d/08-yum-chroot b/elements/yum-minimal/root.d/08-yum-chroot index 1de427dc9..ec22e0bff 100755 --- a/elements/yum-minimal/root.d/08-yum-chroot +++ b/elements/yum-minimal/root.d/08-yum-chroot @@ -97,12 +97,23 @@ function _install_pkg_manager { # picking up the base-system's default rpm macros. For example, # 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 + # --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 + # centos-release in their case). You can't override this (see + # [1]), but setting --releasever works around this. + # + # [1] https://bugzilla.redhat.com/show_bug.cgi?id=1287333 ( flock -w 1200 9 || die "Can not lock .rpmmacros" echo "%_dbpath /var/lib/rpm" >> $HOME/.rpmmacros sudo -E yum -y \ --setopt=cachedir=$YUM_CACHE/$ARCH/$DIB_RELEASE \ --setopt=reposdir=$TARGET_ROOT/etc/yum.repos.d \ + --releasever=$DIB_RELEASE \ --installroot $TARGET_ROOT \ install $@ sed -i '$ d' $HOME/.rpmmacros