diff options
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/package.bbclass | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 2168dbea7b..30f97fac8f 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -128,11 +128,12 @@ python () { | |||
128 | deps += " %s:do_populate_staging" % dep | 128 | deps += " %s:do_populate_staging" % dep |
129 | bb.data.setVarFlag('do_package', 'depends', deps, d) | 129 | bb.data.setVarFlag('do_package', 'depends', deps, d) |
130 | 130 | ||
131 | deps = (bb.data.getVarFlag('do_package', 'deptask', d) or "").split() | ||
131 | # shlibs requires any DEPENDS to have already packaged for the *.list files | 132 | # shlibs requires any DEPENDS to have already packaged for the *.list files |
132 | bb.data.setVarFlag('do_package', 'deptask', 'do_package', d) | 133 | deps.append("do_package") |
134 | bb.data.setVarFlag('do_package', 'deptask', " ".join(deps), d) | ||
133 | } | 135 | } |
134 | 136 | ||
135 | |||
136 | def runstrip(file, d): | 137 | def runstrip(file, d): |
137 | # Function to strip a single file, called from populate_packages below | 138 | # Function to strip a single file, called from populate_packages below |
138 | # A working 'file' (one which works on the target architecture) | 139 | # A working 'file' (one which works on the target architecture) |
@@ -481,6 +482,8 @@ python populate_packages () { | |||
481 | populate_packages[dirs] = "${D}" | 482 | populate_packages[dirs] = "${D}" |
482 | 483 | ||
483 | python emit_pkgdata() { | 484 | python emit_pkgdata() { |
485 | from glob import glob | ||
486 | |||
484 | def write_if_exists(f, pkg, var): | 487 | def write_if_exists(f, pkg, var): |
485 | def encode(str): | 488 | def encode(str): |
486 | import codecs | 489 | import codecs |
@@ -492,14 +495,14 @@ python emit_pkgdata() { | |||
492 | f.write('%s_%s: %s\n' % (var, pkg, encode(val))) | 495 | f.write('%s_%s: %s\n' % (var, pkg, encode(val))) |
493 | 496 | ||
494 | packages = bb.data.getVar('PACKAGES', d, 1) | 497 | packages = bb.data.getVar('PACKAGES', d, 1) |
495 | if not packages: | ||
496 | return | ||
497 | 498 | ||
498 | data_file = bb.data.expand("${PKGDATA_DIR}/${PN}", d) | 499 | data_file = bb.data.expand("${PKGDATA_DIR}/${PN}", d) |
499 | f = open(data_file, 'w') | 500 | f = open(data_file, 'w') |
500 | f.write("PACKAGES: %s\n" % packages) | 501 | f.write("PACKAGES: %s\n" % packages) |
501 | f.close() | 502 | f.close() |
502 | 503 | ||
504 | workdir = bb.data.getVar('WORKDIR', d, 1) | ||
505 | |||
503 | for pkg in packages.split(): | 506 | for pkg in packages.split(): |
504 | subdata_file = bb.data.expand("${PKGDATA_DIR}/runtime/%s" % pkg, d) | 507 | subdata_file = bb.data.expand("${PKGDATA_DIR}/runtime/%s" % pkg, d) |
505 | sf = open(subdata_file, 'w') | 508 | sf = open(subdata_file, 'w') |
@@ -519,6 +522,13 @@ python emit_pkgdata() { | |||
519 | write_if_exists(sf, pkg, 'pkg_preinst') | 522 | write_if_exists(sf, pkg, 'pkg_preinst') |
520 | write_if_exists(sf, pkg, 'pkg_prerm') | 523 | write_if_exists(sf, pkg, 'pkg_prerm') |
521 | sf.close() | 524 | sf.close() |
525 | |||
526 | allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, 1) | ||
527 | root = "%s/install/%s" % (workdir, pkg) | ||
528 | os.chdir(root) | ||
529 | g = glob('*') | ||
530 | if g or allow_empty == "1": | ||
531 | file(bb.data.expand('${PKGDATA_DIR}/runtime/%s.packaged' % pkg, d), 'w').close() | ||
522 | } | 532 | } |
523 | emit_pkgdata[dirs] = "${PKGDATA_DIR}/runtime" | 533 | emit_pkgdata[dirs] = "${PKGDATA_DIR}/runtime" |
524 | 534 | ||
@@ -540,9 +550,6 @@ python package_do_shlibs() { | |||
540 | libdir_re = re.compile(".*/lib$") | 550 | libdir_re = re.compile(".*/lib$") |
541 | 551 | ||
542 | packages = bb.data.getVar('PACKAGES', d, 1) | 552 | packages = bb.data.getVar('PACKAGES', d, 1) |
543 | if not packages: | ||
544 | bb.debug(1, "no packages to build; not calculating shlibs") | ||
545 | return | ||
546 | 553 | ||
547 | workdir = bb.data.getVar('WORKDIR', d, 1) | 554 | workdir = bb.data.getVar('WORKDIR', d, 1) |
548 | if not workdir: | 555 | if not workdir: |
@@ -674,9 +681,6 @@ python package_do_pkgconfig () { | |||
674 | import re, os | 681 | import re, os |
675 | 682 | ||
676 | packages = bb.data.getVar('PACKAGES', d, 1) | 683 | packages = bb.data.getVar('PACKAGES', d, 1) |
677 | if not packages: | ||
678 | bb.debug(1, "no packages to build; not calculating pkgconfig dependencies") | ||
679 | return | ||
680 | 684 | ||
681 | workdir = bb.data.getVar('WORKDIR', d, 1) | 685 | workdir = bb.data.getVar('WORKDIR', d, 1) |
682 | if not workdir: | 686 | if not workdir: |
@@ -782,7 +786,7 @@ python package_do_pkgconfig () { | |||
782 | } | 786 | } |
783 | 787 | ||
784 | python read_shlibdeps () { | 788 | python read_shlibdeps () { |
785 | packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() | 789 | packages = bb.data.getVar('PACKAGES', d, 1).split() |
786 | for pkg in packages: | 790 | for pkg in packages: |
787 | rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") | 791 | rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 0) or bb.data.getVar('RDEPENDS', d, 0) or "") |
788 | shlibsfile = bb.data.expand("${PKGDEST}/" + pkg + ".shlibdeps", d) | 792 | shlibsfile = bb.data.expand("${PKGDEST}/" + pkg + ".shlibdeps", d) |
@@ -892,6 +896,11 @@ PACKAGEFUNCS ?= "package_do_split_locales \ | |||
892 | emit_pkgdata" | 896 | emit_pkgdata" |
893 | 897 | ||
894 | python package_do_package () { | 898 | python package_do_package () { |
899 | packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() | ||
900 | if len(packages) < 1: | ||
901 | bb.debug(1, "No packages to build, skipping do_package") | ||
902 | return | ||
903 | |||
895 | for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split(): | 904 | for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split(): |
896 | bb.build.exec_func(f, d) | 905 | bb.build.exec_func(f, d) |
897 | } | 906 | } |