From a92c196449c516fe51786d429078bbb1213bb029 Mon Sep 17 00:00:00 2001 From: Stephano Cetola Date: Wed, 10 Aug 2016 13:03:16 -0700 Subject: Allow for simultaneous do_rootfs tasks with rpm Give each rootfs its own RPM channel to use. This puts the RPM metadata in a private subdirectory of $WORKDIR, rather than living in DEPLOY_DIR where other tasks may race with it. This allows us to reduce the time that the rpm.lock is held to only the time needed to hardlink the RPMs, allowing the majority of the rootfs operation to run in parallel. Also, this fixes the smart tests by generating an index for all packages at the time of the test, rather than using the one provided by the rootfs process. Original credit for the enhancement should go to Steven Walter stevenrwalter@gmail.com. Signed-off-by: Stephano Cetola Signed-off-by: Richard Purdie --- meta/lib/oe/package_manager.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'meta/lib/oe') diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 47f6831f98..2802254f1f 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -9,6 +9,7 @@ import collections import bb import tempfile import oe.utils +import oe.path import string from oe.gpg_sign import get_signer @@ -175,7 +176,7 @@ class RpmIndexer(Indexer): dbpath = os.path.join(self.d.getVar('WORKDIR', True), 'rpmdb', arch) if os.path.exists(dbpath): bb.utils.remove(dbpath, True) - arch_dir = os.path.join(self.deploy_dir, arch) + arch_dir = os.path.join(self.d.getVar('WORKDIR', True), 'rpms', arch) if not os.path.isdir(arch_dir): continue @@ -1010,8 +1011,18 @@ class RpmPM(PackageManager): ch_already_added = [] for canonical_arch in platform_extra: arch = canonical_arch.split('-')[0] - arch_channel = os.path.join(self.deploy_dir, arch) - if os.path.exists(arch_channel) and not arch in ch_already_added: + arch_channel = os.path.join(self.d.getVar('WORKDIR', True), 'rpms', arch) + oe.path.remove(arch_channel) + deploy_arch_dir = os.path.join(self.deploy_dir, arch) + if not os.path.exists(deploy_arch_dir): + continue + + lockfilename = self.d.getVar('DEPLOY_DIR_RPM', True) + "/rpm.lock" + lf = bb.utils.lockfile(lockfilename, False) + oe.path.copyhardlinktree(deploy_arch_dir, arch_channel) + bb.utils.unlockfile(lf) + + if not arch in ch_already_added: bb.note('Adding Smart channel %s (%s)' % (arch, channel_priority)) self._invoke_smart('channel --add %s type=rpm-md baseurl=%s -y' -- cgit 1.2.3-korg