summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime/smart.py
diff options
context:
space:
mode:
authorStephano Cetola <stephano.cetola@linux.intel.com>2016-08-10 13:03:16 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-12 15:25:22 +0100
commit6b66e9317f4ec3a69f98f29836aafa35b52f3fc7 (patch)
treee97a5f491be57a28ebbb334af7fc706e93884904 /meta/lib/oeqa/runtime/smart.py
parentd11e8e1109c2c5a0cc3e4dea70cebe068b2a6ba1 (diff)
downloadpoky-6b66e9317f4ec3a69f98f29836aafa35b52f3fc7.tar.gz
Allow for simultaneous do_rootfs tasks with rpmuninative-1.3
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. (From OE-Core rev: a92c196449c516fe51786d429078bbb1213bb029) Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime/smart.py')
-rw-r--r--meta/lib/oeqa/runtime/smart.py41
1 files changed, 40 insertions, 1 deletions
diff --git a/meta/lib/oeqa/runtime/smart.py b/meta/lib/oeqa/runtime/smart.py
index c7a5753991..c8ba433cdd 100644
--- a/meta/lib/oeqa/runtime/smart.py
+++ b/meta/lib/oeqa/runtime/smart.py
@@ -1,5 +1,7 @@
1import unittest 1import unittest
2import re 2import re
3import oe
4import subprocess
3from oeqa.oetest import oeRuntimeTest, skipModule 5from oeqa.oetest import oeRuntimeTest, skipModule
4from oeqa.utils.decorators import * 6from oeqa.utils.decorators import *
5from oeqa.utils.httpserver import HTTPService 7from oeqa.utils.httpserver import HTTPService
@@ -53,9 +55,46 @@ class SmartBasicTest(SmartTest):
53class SmartRepoTest(SmartTest): 55class SmartRepoTest(SmartTest):
54 56
55 @classmethod 57 @classmethod
58 def create_index(self, arg):
59 index_cmd = arg
60 try:
61 bb.note("Executing '%s' ..." % index_cmd)
62 result = subprocess.check_output(index_cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8")
63 except subprocess.CalledProcessError as e:
64 return("Index creation command '%s' failed with return code %d:\n%s" %
65 (e.cmd, e.returncode, e.output.decode("utf-8")))
66 if result:
67 bb.note(result)
68 return None
69
70 @classmethod
56 def setUpClass(self): 71 def setUpClass(self):
57 self.repolist = [] 72 self.repolist = []
58 self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR', True), oeRuntimeTest.tc.target.server_ip) 73
74 # Index RPMs
75 rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo")
76 index_cmds = []
77 rpm_dirs_found = False
78 archs = (oeRuntimeTest.tc.d.getVar('ALL_MULTILIB_PACKAGE_ARCHS', True) or "").replace('-', '_').split()
79 for arch in archs:
80 rpm_dir = os.path.join(oeRuntimeTest.tc.d.getVar('DEPLOY_DIR_RPM', True), arch)
81 idx_path = os.path.join(oeRuntimeTest.tc.d.getVar('WORKDIR', True), 'rpm', arch)
82 db_path = os.path.join(oeRuntimeTest.tc.d.getVar('WORKDIR', True), 'rpmdb', arch)
83 if not os.path.isdir(rpm_dir):
84 continue
85 if os.path.exists(db_path):
86 bb.utils.remove(dbpath, True)
87 lockfilename = oeRuntimeTest.tc.d.getVar('DEPLOY_DIR_RPM', True) + "/rpm.lock"
88 lf = bb.utils.lockfile(lockfilename, False)
89 oe.path.copyhardlinktree(rpm_dir, idx_path)
90 bb.utils.unlockfile(lf)
91 index_cmds.append("%s --dbpath %s --update -q %s" % (rpm_createrepo, db_path, idx_path))
92 rpm_dirs_found = True
93 # Create repodata¬
94 result = oe.utils.multiprocess_exec(index_cmds, self.create_index)
95 if result:
96 bb.fatal('%s' % ('\n'.join(result)))
97 self.repo_server = HTTPService(oeRuntimeTest.tc.d.getVar('WORKDIR', True), oeRuntimeTest.tc.target.server_ip)
59 self.repo_server.start() 98 self.repo_server.start()
60 99
61 @classmethod 100 @classmethod