Skip to contentSkip to conversation

simultaneous do_rootfs tasks with testimage fix

PATCH New Stephano Cetola 1 participant 2 messages Aug 10, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 simultaneous do_rootfs tasks with testimage fix

Changed since V1:

I've added a fix to the smart tests which creates a fresh index of the RPM packages specifically for the tests. This decouples the tests and the rootfs processes, which also does some indexing for installation.

Stephano Cetola (1):
Allow for simultaneous do_rootfs tasks with rpm

 meta/classes/rootfs_rpm.bbclass |  5 -----
 meta/lib/oe/package_manager.py  | 17 ++++++++++++++---
 meta/lib/oeqa/runtime/smart.py  | 41 ++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 54 insertions(+), 9 deletions(-)
Signature · 1 line
2.9.2
#1 lore raw

PATCH v2 1/1 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 [email protected].

---
 meta/classes/rootfs_rpm.bbclass |  5 -----
 meta/lib/oe/package_manager.py  | 17 ++++++++++++++---
 meta/lib/oeqa/runtime/smart.py  | 41 ++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 54 insertions(+), 9 deletions(-)
meta/classes/rootfs_rpm.bbclass +0 -5
index 38b3c99..37730a7 100644
@@ -24,11 +24,6 @@ do_populate_sdk[depends] += "${RPMROOTFSDEPENDS}"
 do_rootfs[recrdeptask] += "do_package_write_rpm"
 do_rootfs[vardeps] += "PACKAGE_FEED_URIS"
 
-# RPM doesn't work with multiple rootfs generation at once due to collisions in the use of files 
-# in ${DEPLOY_DIR_RPM}. This can be removed if package_update_index_rpm can be called concurrently
-do_rootfs[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock"
-do_populate_sdk[lockfiles] += "${DEPLOY_DIR_RPM}/rpm.lock"
-
 python () {
     if d.getVar('BUILD_IMAGES_FROM_FEEDS', True):
         flags = d.getVarFlag('do_rootfs', 'recrdeptask', True)
meta/lib/oe/package_manager.py +14 -3
index 47f6831..2802254 100644
@@ -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'
meta/lib/oeqa/runtime/smart.py +40 -1

54 lines not on this page · raw message

Signature · 1 line
2.9.2