diff options
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r-- | meta/classes/package.bbclass | 82 |
1 files changed, 77 insertions, 5 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 0b5ff1d0d7..77c2a01967 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -14,17 +14,21 @@ | |||
14 | # c) populate_packages - Split the files in PKGD into separate packages in PKGDEST/<pkgname> | 14 | # c) populate_packages - Split the files in PKGD into separate packages in PKGDEST/<pkgname> |
15 | # Also triggers the binary stripping code to put files in -dbg packages. | 15 | # Also triggers the binary stripping code to put files in -dbg packages. |
16 | # | 16 | # |
17 | # d) package_do_shlibs - Look at the shared libraries generated and autotmatically add any | 17 | # d) package_do_filedeps - Collect perfile run-time dependency metadata |
18 | # The data is stores in FILER{PROVIDES,DEPENDS}_file_pkg variables with | ||
19 | # a list of affected files in FILER{PROVIDES,DEPENDS}FLIST_pkg | ||
20 | # | ||
21 | # e) package_do_shlibs - Look at the shared libraries generated and autotmatically add any | ||
18 | # depenedencies found. Also stores the package name so anyone else using this library | 22 | # depenedencies found. Also stores the package name so anyone else using this library |
19 | # knows which package to depend on. | 23 | # knows which package to depend on. |
20 | # | 24 | # |
21 | # e) package_do_pkgconfig - Keep track of which packages need and provide which .pc files | 25 | # f) package_do_pkgconfig - Keep track of which packages need and provide which .pc files |
22 | # | 26 | # |
23 | # f) read_shlibdeps - Reads the stored shlibs information into the metadata | 27 | # g) read_shlibdeps - Reads the stored shlibs information into the metadata |
24 | # | 28 | # |
25 | # g) package_depchains - Adds automatic dependencies to -dbg and -dev packages | 29 | # h) package_depchains - Adds automatic dependencies to -dbg and -dev packages |
26 | # | 30 | # |
27 | # h) emit_pkgdata - saves the packaging data into PKGDATA_DIR for use in later | 31 | # i) emit_pkgdata - saves the packaging data into PKGDATA_DIR for use in later |
28 | # packaging steps | 32 | # packaging steps |
29 | 33 | ||
30 | inherit packagedata | 34 | inherit packagedata |
@@ -32,6 +36,9 @@ inherit packagedata | |||
32 | PKGD = "${WORKDIR}/package" | 36 | PKGD = "${WORKDIR}/package" |
33 | PKGDEST = "${WORKDIR}/packages-split" | 37 | PKGDEST = "${WORKDIR}/packages-split" |
34 | 38 | ||
39 | # rpm is used for the per-file dependency identification | ||
40 | PACKAGE_DEPENDS += "rpm-native" | ||
41 | |||
35 | def legitimize_package_name(s): | 42 | def legitimize_package_name(s): |
36 | """ | 43 | """ |
37 | Make sure package names are legitimate strings | 44 | Make sure package names are legitimate strings |
@@ -519,6 +526,14 @@ python emit_pkgdata() { | |||
519 | write_if_exists(sf, pkg, 'pkg_postrm') | 526 | write_if_exists(sf, pkg, 'pkg_postrm') |
520 | write_if_exists(sf, pkg, 'pkg_preinst') | 527 | write_if_exists(sf, pkg, 'pkg_preinst') |
521 | write_if_exists(sf, pkg, 'pkg_prerm') | 528 | write_if_exists(sf, pkg, 'pkg_prerm') |
529 | write_if_exists(sf, pkg, 'FILERPROVIDESFLIST') | ||
530 | for dfile in (bb.data.getVar('FILERPROVIDESFLIST_' + pkg, d, True) or "").split(): | ||
531 | write_if_exists(sf, pkg, 'FILERPROVIDES_' + dfile) | ||
532 | |||
533 | write_if_exists(sf, pkg, 'FILERDEPENDSFLIST') | ||
534 | for dfile in (bb.data.getVar('FILERDEPENDSFLIST_' + pkg, d, True) or "").split(): | ||
535 | write_if_exists(sf, pkg, 'FILERDEPENDS_' + dfile) | ||
536 | |||
522 | sf.close() | 537 | sf.close() |
523 | 538 | ||
524 | 539 | ||
@@ -545,6 +560,62 @@ fi | |||
545 | SHLIBSDIR = "${STAGING_DIR_HOST}/shlibs" | 560 | SHLIBSDIR = "${STAGING_DIR_HOST}/shlibs" |
546 | SHLIBSWORKDIR = "${WORKDIR}/shlibs" | 561 | SHLIBSWORKDIR = "${WORKDIR}/shlibs" |
547 | 562 | ||
563 | RPMDEPS = "${STAGING_LIBDIR_NATIVE}/rpm/${BUILD_ARCH}-${BUILD_OS}-rpmdeps" | ||
564 | |||
565 | # Collect perfile run-time dependency metadata | ||
566 | # Output: | ||
567 | # FILERPROVIDESFLIST_pkg - list of all files w/ deps | ||
568 | # FILERPROVIDES_filepath_pkg - per file dep | ||
569 | # | ||
570 | # FILERDEPENDSFLIST_pkg - list of all files w/ deps | ||
571 | # FILERDEPENDS_filepath_pkg - per file dep | ||
572 | |||
573 | python package_do_filedeps() { | ||
574 | import os | ||
575 | |||
576 | pkgdest = bb.data.getVar('PKGDEST', d, True) | ||
577 | packages = bb.data.getVar('PACKAGES', d, True) | ||
578 | |||
579 | cmd = bb.data.expand("${STAGING_LIBDIR_NATIVE}/rpm/perfile_rpmdeps.sh", d) | ||
580 | rpmdeps = bb.data.expand("${RPMDEPS}", d) | ||
581 | |||
582 | # Quick routine to process the results of the rpmdeps call... | ||
583 | def process_deps(pipe, pkg, varname): | ||
584 | dep_files = "" | ||
585 | for line in pipe: | ||
586 | key = ""; | ||
587 | value = ""; | ||
588 | # We expect two items on each line | ||
589 | # 1 - filepath | ||
590 | # 2 - dep list | ||
591 | line_list = line.split(None,1); | ||
592 | if len(line_list) <= 0 or len(line_list) > 2: | ||
593 | bb.error("deps list length error! " + len(line_list)); | ||
594 | if len(line_list) == 2: | ||
595 | file = line_list[0]; | ||
596 | value = line_list[1] | ||
597 | file = file.replace(pkgdest + "/" + pkg, "") | ||
598 | dep_files = dep_files + " " + file | ||
599 | key = "FILE" + varname + "_" + file + "_" + pkg | ||
600 | bb.data.setVar(key, value, d) | ||
601 | bb.data.setVar("FILE" + varname + "_" + pkg, dep_files, d) | ||
602 | |||
603 | # Determine dependencies | ||
604 | for pkg in packages.split(): | ||
605 | if pkg.endswith('-dbg'): | ||
606 | continue | ||
607 | |||
608 | # Process provides | ||
609 | dep_pipe = os.popen(cmd + " --rpmdeps " + rpmdeps + " --provides " + pkgdest + "/" + pkg) | ||
610 | |||
611 | process_deps(dep_pipe, pkg, 'RPROVIDES') | ||
612 | |||
613 | # Process requirements | ||
614 | dep_pipe = os.popen(cmd + " --rpmdeps " + rpmdeps + " --requires " + pkgdest + "/" + pkg) | ||
615 | |||
616 | process_deps(dep_pipe, pkg, 'RDEPENDS') | ||
617 | } | ||
618 | |||
548 | python package_do_shlibs() { | 619 | python package_do_shlibs() { |
549 | import re | 620 | import re |
550 | 621 | ||
@@ -976,6 +1047,7 @@ PACKAGEFUNCS ?= "perform_packagecopy \ | |||
976 | ${PACKAGE_PREPROCESS_FUNCS} \ | 1047 | ${PACKAGE_PREPROCESS_FUNCS} \ |
977 | package_do_split_locales \ | 1048 | package_do_split_locales \ |
978 | populate_packages \ | 1049 | populate_packages \ |
1050 | package_do_filedeps \ | ||
979 | package_do_shlibs \ | 1051 | package_do_shlibs \ |
980 | package_do_pkgconfig \ | 1052 | package_do_pkgconfig \ |
981 | read_shlibdeps \ | 1053 | read_shlibdeps \ |