diff options
Diffstat (limited to 'meta/classes')
| -rw-r--r-- | meta/classes/testimage.bbclass | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index 016c1c136a..abcecca472 100644 --- a/meta/classes/testimage.bbclass +++ b/meta/classes/testimage.bbclass | |||
| @@ -116,6 +116,10 @@ python do_testimage() { | |||
| 116 | 116 | ||
| 117 | testimage_sanity(d) | 117 | testimage_sanity(d) |
| 118 | 118 | ||
| 119 | if (d.getVar('IMAGE_PKGTYPE') == 'rpm' | ||
| 120 | and 'smart' in d.getVar('TEST_SUITES')): | ||
| 121 | create_rpm_index(d) | ||
| 122 | |||
| 119 | testimage_main(d) | 123 | testimage_main(d) |
| 120 | } | 124 | } |
| 121 | 125 | ||
| @@ -284,6 +288,55 @@ def get_runtime_paths(d): | |||
| 284 | paths.append(path) | 288 | paths.append(path) |
| 285 | return paths | 289 | return paths |
| 286 | 290 | ||
| 291 | def create_index(arg): | ||
| 292 | import subprocess | ||
| 293 | |||
| 294 | index_cmd = arg | ||
| 295 | try: | ||
| 296 | bb.note("Executing '%s' ..." % index_cmd) | ||
| 297 | result = subprocess.check_output(index_cmd, | ||
| 298 | stderr=subprocess.STDOUT, | ||
| 299 | shell=True) | ||
| 300 | result = result.decode('utf-8') | ||
| 301 | except subprocess.CalledProcessError as e: | ||
| 302 | return("Index creation command '%s' failed with return code " | ||
| 303 | '%d:\n%s' % (e.cmd, e.returncode, e.output.decode("utf-8"))) | ||
| 304 | if result: | ||
| 305 | bb.note(result) | ||
| 306 | return None | ||
| 307 | |||
| 308 | def create_rpm_index(d): | ||
| 309 | # Index RPMs | ||
| 310 | rpm_createrepo = bb.utils.which(os.getenv('PATH'), "createrepo") | ||
| 311 | index_cmds = [] | ||
| 312 | archs = (d.getVar('ALL_MULTILIB_PACKAGE_ARCHS') or '').replace('-', '_') | ||
| 313 | |||
| 314 | for arch in archs.split(): | ||
| 315 | rpm_dir = os.path.join(d.getVar('DEPLOY_DIR_RPM'), arch) | ||
| 316 | idx_path = os.path.join(d.getVar('WORKDIR'), 'rpm', arch) | ||
| 317 | db_path = os.path.join(d.getVar('WORKDIR'), 'rpmdb', arch) | ||
| 318 | |||
| 319 | if not os.path.isdir(rpm_dir): | ||
| 320 | continue | ||
| 321 | if os.path.exists(db_path): | ||
| 322 | bb.utils.remove(dbpath, True) | ||
| 323 | |||
| 324 | lockfilename = os.path.join(d.getVar('DEPLOY_DIR_RPM'), 'rpm.lock') | ||
| 325 | lf = bb.utils.lockfile(lockfilename, False) | ||
| 326 | oe.path.copyhardlinktree(rpm_dir, idx_path) | ||
| 327 | # Full indexes overload a 256MB image so reduce the number of rpms | ||
| 328 | # in the feed. Filter to p* since we use the psplash packages and | ||
| 329 | # this leaves some allarch and machine arch packages too. | ||
| 330 | bb.utils.remove(idx_path + "*/[a-oq-z]*.rpm") | ||
| 331 | bb.utils.unlockfile(lf) | ||
| 332 | cmd = '%s --dbpath %s --update -q %s' % (rpm_createrepo, | ||
| 333 | db_path, idx_path) | ||
| 334 | |||
| 335 | # Create repodata | ||
| 336 | result = create_index(cmd) | ||
| 337 | if result: | ||
| 338 | bb.fatal('%s' % ('\n'.join(result))) | ||
| 339 | |||
| 287 | def test_create_extract_dirs(d): | 340 | def test_create_extract_dirs(d): |
| 288 | install_path = d.getVar("TEST_INSTALL_TMP_DIR") | 341 | install_path = d.getVar("TEST_INSTALL_TMP_DIR") |
| 289 | package_path = d.getVar("TEST_PACKAGED_DIR") | 342 | package_path = d.getVar("TEST_PACKAGED_DIR") |
