diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oe/package_manager.py | 114 | ||||
-rw-r--r-- | meta/lib/oeqa/utils/package_manager.py | 3 |
2 files changed, 113 insertions, 4 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index f7e013437c..f59eaf7b85 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
@@ -454,6 +454,114 @@ class PackageManager(object, metaclass=ABCMeta): | |||
454 | return res | 454 | return res |
455 | return _append(uris, base_paths) | 455 | return _append(uris, base_paths) |
456 | 456 | ||
457 | def create_packages_dir(d, rpm_repo_dir, deploydir, taskname, filterbydependencies): | ||
458 | """ | ||
459 | Go through our do_package_write_X dependencies and hardlink the packages we depend | ||
460 | upon into the repo directory. This prevents us seeing other packages that may | ||
461 | have been built that we don't depend upon and also packages for architectures we don't | ||
462 | support. | ||
463 | """ | ||
464 | import errno | ||
465 | |||
466 | taskdepdata = d.getVar("BB_TASKDEPDATA", False) | ||
467 | mytaskname = d.getVar("BB_RUNTASK") | ||
468 | pn = d.getVar("PN") | ||
469 | seendirs = set() | ||
470 | multilibs = {} | ||
471 | |||
472 | rpm_subrepo_dir = oe.path.join(rpm_repo_dir, "rpm") | ||
473 | |||
474 | bb.utils.remove(rpm_subrepo_dir, recurse=True) | ||
475 | bb.utils.mkdirhier(rpm_subrepo_dir) | ||
476 | |||
477 | # Detect bitbake -b usage | ||
478 | nodeps = d.getVar("BB_LIMITEDDEPS") or False | ||
479 | if nodeps or not filterbydependencies: | ||
480 | oe.path.symlink(deploydir, rpm_subrepo_dir, True) | ||
481 | return | ||
482 | |||
483 | start = None | ||
484 | for dep in taskdepdata: | ||
485 | data = taskdepdata[dep] | ||
486 | if data[1] == mytaskname and data[0] == pn: | ||
487 | start = dep | ||
488 | break | ||
489 | if start is None: | ||
490 | bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?") | ||
491 | rpmdeps = set() | ||
492 | start = [start] | ||
493 | seen = set(start) | ||
494 | # Support direct dependencies (do_rootfs -> rpms) | ||
495 | # or indirect dependencies within PN (do_populate_sdk_ext -> do_rootfs -> rpms) | ||
496 | while start: | ||
497 | next = [] | ||
498 | for dep2 in start: | ||
499 | for dep in taskdepdata[dep2][3]: | ||
500 | if taskdepdata[dep][0] != pn: | ||
501 | if "do_" + taskname in dep: | ||
502 | rpmdeps.add(dep) | ||
503 | elif dep not in seen: | ||
504 | next.append(dep) | ||
505 | seen.add(dep) | ||
506 | start = next | ||
507 | |||
508 | for dep in rpmdeps: | ||
509 | c = taskdepdata[dep][0] | ||
510 | |||
511 | d2 = d | ||
512 | variant = '' | ||
513 | if taskdepdata[dep][2].startswith("virtual:multilib"): | ||
514 | variant = taskdepdata[dep][2].split(":")[2] | ||
515 | if variant not in multilibs: | ||
516 | multilibs[variant] = oe.utils.get_multilib_datastore(variant, d) | ||
517 | d2 = multilibs[variant] | ||
518 | |||
519 | if c.endswith("-native"): | ||
520 | pkgarchs = ["${BUILD_ARCH}"] | ||
521 | elif c.startswith("nativesdk-"): | ||
522 | pkgarchs = ["${SDK_ARCH}_${SDK_OS}", "allarch"] | ||
523 | elif "-cross-canadian" in c: | ||
524 | pkgarchs = ["${SDK_ARCH}_${SDK_ARCH}-${SDKPKGSUFFIX}"] | ||
525 | elif "-cross-" in c: | ||
526 | pkgarchs = ["${BUILD_ARCH}_${TARGET_ARCH}"] | ||
527 | elif "-crosssdk" in c: | ||
528 | pkgarchs = ["${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS}"] | ||
529 | else: | ||
530 | pkgarchs = ['${MACHINE_ARCH}'] | ||
531 | pkgarchs = pkgarchs + list(reversed(d2.getVar("PACKAGE_EXTRA_ARCHS").split())) | ||
532 | pkgarchs.append('allarch') | ||
533 | pkgarchs.append('${SDK_ARCH}_${SDK_ARCH}-${SDKPKGSUFFIX}') | ||
534 | |||
535 | for pkgarch in pkgarchs: | ||
536 | manifest = d2.expand("${SSTATE_MANIFESTS}/manifest-%s-%s.%s" % (pkgarch, c, taskname)) | ||
537 | if os.path.exists(manifest): | ||
538 | break | ||
539 | if not os.path.exists(manifest): | ||
540 | bb.warn("Manifest %s not found in %s (variant '%s')?" % (manifest, d2.expand(" ".join(pkgarchs)), variant)) | ||
541 | continue | ||
542 | with open(manifest, "r") as f: | ||
543 | for l in f: | ||
544 | l = l.strip() | ||
545 | dest = l.replace(deploydir, "") | ||
546 | dest = rpm_subrepo_dir + dest | ||
547 | if l.endswith("/"): | ||
548 | if dest not in seendirs: | ||
549 | bb.utils.mkdirhier(dest) | ||
550 | seendirs.add(dest) | ||
551 | continue | ||
552 | # Try to hardlink the file, copy if that fails | ||
553 | destdir = os.path.dirname(dest) | ||
554 | if destdir not in seendirs: | ||
555 | bb.utils.mkdirhier(destdir) | ||
556 | seendirs.add(destdir) | ||
557 | try: | ||
558 | os.link(l, dest) | ||
559 | except OSError as err: | ||
560 | if err.errno == errno.EXDEV: | ||
561 | bb.utils.copyfile(l, dest) | ||
562 | else: | ||
563 | raise | ||
564 | |||
457 | class RpmPM(PackageManager): | 565 | class RpmPM(PackageManager): |
458 | def __init__(self, | 566 | def __init__(self, |
459 | d, | 567 | d, |
@@ -462,7 +570,8 @@ class RpmPM(PackageManager): | |||
462 | task_name='target', | 570 | task_name='target', |
463 | arch_var=None, | 571 | arch_var=None, |
464 | os_var=None, | 572 | os_var=None, |
465 | rpm_repo_workdir="oe-rootfs-repo"): | 573 | rpm_repo_workdir="oe-rootfs-repo", |
574 | filterbydependencies=True): | ||
466 | super(RpmPM, self).__init__(d) | 575 | super(RpmPM, self).__init__(d) |
467 | self.target_rootfs = target_rootfs | 576 | self.target_rootfs = target_rootfs |
468 | self.target_vendor = target_vendor | 577 | self.target_vendor = target_vendor |
@@ -477,8 +586,7 @@ class RpmPM(PackageManager): | |||
477 | self.primary_arch = self.d.getVar('MACHINE_ARCH') | 586 | self.primary_arch = self.d.getVar('MACHINE_ARCH') |
478 | 587 | ||
479 | self.rpm_repo_dir = oe.path.join(self.d.getVar('WORKDIR'), rpm_repo_workdir) | 588 | self.rpm_repo_dir = oe.path.join(self.d.getVar('WORKDIR'), rpm_repo_workdir) |
480 | bb.utils.mkdirhier(self.rpm_repo_dir) | 589 | create_packages_dir(self.d, self.rpm_repo_dir, d.getVar("DEPLOY_DIR_RPM"), "package_write_rpm", filterbydependencies) |
481 | oe.path.symlink(self.d.getVar('DEPLOY_DIR_RPM'), oe.path.join(self.rpm_repo_dir, "rpm"), True) | ||
482 | 590 | ||
483 | self.saved_packaging_data = self.d.expand('${T}/saved_packaging_data/%s' % self.task_name) | 591 | self.saved_packaging_data = self.d.expand('${T}/saved_packaging_data/%s' % self.task_name) |
484 | if not os.path.exists(self.d.expand('${T}/saved_packaging_data')): | 592 | if not os.path.exists(self.d.expand('${T}/saved_packaging_data')): |
diff --git a/meta/lib/oeqa/utils/package_manager.py b/meta/lib/oeqa/utils/package_manager.py index 724afb2b5e..afd5b8e75f 100644 --- a/meta/lib/oeqa/utils/package_manager.py +++ b/meta/lib/oeqa/utils/package_manager.py | |||
@@ -14,7 +14,8 @@ def get_package_manager(d, root_path): | |||
14 | if pkg_class == "rpm": | 14 | if pkg_class == "rpm": |
15 | pm = RpmPM(d, | 15 | pm = RpmPM(d, |
16 | root_path, | 16 | root_path, |
17 | d.getVar('TARGET_VENDOR')) | 17 | d.getVar('TARGET_VENDOR'), |
18 | filterbydependencies=False) | ||
18 | pm.create_configs() | 19 | pm.create_configs() |
19 | 20 | ||
20 | elif pkg_class == "ipk": | 21 | elif pkg_class == "ipk": |