dnf.py: installroot support usrmerge

(From OE-Core rev: 65f8dfd81abcf48d472ee28c2cdae819fd87ef32)

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Changqing Li
2019-09-03 12:46:36 +08:00
committed by Richard Purdie
parent 19086789d9
commit 46448785a4

View File

@@ -9,7 +9,7 @@ from oeqa.utils.httpserver import HTTPService
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.depends import OETestDepends
from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature
from oeqa.core.decorator.data import skipIfNotDataVar, skipIfNotFeature, skipIfInDataVar, skipIfNotInDataVar
from oeqa.runtime.decorator.package import OEHasPackage
class DnfTest(OERuntimeTestCase):
@@ -116,6 +116,7 @@ class DnfRepoTest(DnfTest):
self.dnf_with_repo('reinstall -y run-postinsts-dev')
@OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache'])
@skipIfInDataVar('DISTRO_FEATURES', 'usrmerge', 'Test run when not enable usrmerge')
def test_dnf_installroot(self):
rootpath = '/home/root/chroot/test'
#Copy necessary files to avoid errors with not yet installed tools on
@@ -140,6 +141,37 @@ class DnfRepoTest(DnfTest):
status, output = self.target.run('test -e %s/bin/busybox' % rootpath, 1500)
self.assertEqual(0, status, output)
@OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache'])
@skipIfNotInDataVar('DISTRO_FEATURES', 'usrmerge', 'Test run when enable usrmege')
def test_dnf_installroot_usrmerge(self):
rootpath = '/home/root/chroot/test'
#Copy necessary files to avoid errors with not yet installed tools on
#installroot directory.
self.target.run('mkdir -p %s/etc' % rootpath, 1500)
self.target.run('mkdir -p %s/usr/bin %s/usr/sbin' % (rootpath, rootpath), 1500)
self.target.run('ln -sf -r %s/usr/bin %s/bin' % (rootpath, rootpath), 1500)
self.target.run('ln -sf -r %s/usr/sbin %s/sbin' % (rootpath, rootpath), 1500)
self.target.run('mkdir -p %s/dev' % rootpath, 1500)
#Handle different architectures lib dirs
self.target.run('mkdir -p %s/usr/lib' % rootpath, 1500)
self.target.run('mkdir -p %s/usr/libx32' % rootpath, 1500)
self.target.run('mkdir -p %s/usr/lib64' % rootpath, 1500)
self.target.run('cp /lib/libtinfo.so.5 %s/usr/lib' % rootpath, 1500)
self.target.run('cp /libx32/libtinfo.so.5 %s/usr/libx32' % rootpath, 1500)
self.target.run('cp /lib64/libtinfo.so.5 %s/usr/lib64' % rootpath, 1500)
self.target.run('ln -sf -r %s/lib %s/usr/lib' % (rootpath,rootpath), 1500)
self.target.run('ln -sf -r %s/libx32 %s/usr/libx32' % (rootpath,rootpath), 1500)
self.target.run('ln -sf -r %s/lib64 %s/usr/lib64' % (rootpath,rootpath), 1500)
self.target.run('cp -r /etc/rpm %s/etc' % rootpath, 1500)
self.target.run('cp -r /etc/dnf %s/etc' % rootpath, 1500)
self.target.run('cp /bin/sh %s/bin' % rootpath, 1500)
self.target.run('mount -o bind /dev %s/dev/' % rootpath, 1500)
self.dnf_with_repo('install --installroot=%s -v -y --rpmverbosity=debug busybox run-postinsts' % rootpath)
status, output = self.target.run('test -e %s/var/cache/dnf' % rootpath, 1500)
self.assertEqual(0, status, output)
status, output = self.target.run('test -e %s/bin/busybox' % rootpath, 1500)
self.assertEqual(0, status, output)
@OETestDepends(['dnf.DnfRepoTest.test_dnf_makecache'])
def test_dnf_exclude(self):
excludepkg = 'curl-dev'