diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2006-10-20 16:09:20 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2006-10-20 16:09:20 +0000 |
commit | a8be7e0efd18848795c0253a7e99128e028a3768 (patch) | |
tree | 440bcd3e2066a27cd4fa0110e7cb7398a55b6050 /classes/package.bbclass | |
parent | aac32c2eee74418bac9ceb763eeab6232cad130b (diff) |
package.bbclass: Split into two tasks, one which prepares the packages and then package_write which actually generates the packages. The two stage approach allows us to avoid circular dependency issues from classes like debian.bbclass. As the data being emitted into pkgdata/ changed, you need to either wipe tmp or rerun the do_package tasks (wipe the do_package stamps). Everything will repackage anyway due to the new task.
Diffstat (limited to 'classes/package.bbclass')
-rw-r--r-- | classes/package.bbclass | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/classes/package.bbclass b/classes/package.bbclass index 1fa65f0a0b..c70f08eefe 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -458,7 +458,10 @@ python populate_packages () { if found == False: bb.note("%s contains dangling symlink to %s" % (pkg, l)) bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d) +} +populate_packages[dirs] = "${D}" +python emit_pkgdata() { def write_if_exists(f, pkg, var): def encode(str): import codecs @@ -469,17 +472,26 @@ python populate_packages () { if val: f.write('%s_%s: %s\n' % (var, pkg, encode(val))) + packages = bb.data.getVar('PACKAGES', d, 1) + if not packages: + return + data_file = bb.data.expand("${STAGING_DIR}/pkgdata/${PN}", d) f = open(data_file, 'w') f.write("PACKAGES: %s\n" % packages) f.close() - for pkg in package_list: + for pkg in packages.split(): subdata_file = bb.data.expand("${STAGING_DIR}/pkgdata/runtime/%s" % pkg, d) sf = open(subdata_file, 'w') write_if_exists(sf, pkg, 'DESCRIPTION') write_if_exists(sf, pkg, 'RDEPENDS') write_if_exists(sf, pkg, 'RPROVIDES') + write_if_exists(sf, pkg, 'RRECOMMENDS') + write_if_exists(sf, pkg, 'RSUGGESTS') + write_if_exists(sf, pkg, 'RPROVIDES') + write_if_exists(sf, pkg, 'RREPLACES') + write_if_exists(sf, pkg, 'RCONFLICTS') write_if_exists(sf, pkg, 'PKG') write_if_exists(sf, pkg, 'ALLOW_EMPTY') write_if_exists(sf, pkg, 'FILES') @@ -488,9 +500,8 @@ python populate_packages () { write_if_exists(sf, pkg, 'pkg_preinst') write_if_exists(sf, pkg, 'pkg_prerm') sf.close() - bb.build.exec_func("read_subpackage_metadata", d) } -populate_packages[dirs] = "${STAGING_DIR}/pkgdata/runtime ${D}" +emit_pkgdata[dirs] = "${STAGING_DIR}/pkgdata/runtime" ldconfig_postinst_fragment() { if [ x"$D" = "x" ]; then @@ -791,8 +802,7 @@ python package_depchains() { name = split_depend[0].strip() func(rreclist, name) - oldrrec = bb.data.getVar('RRECOMMENDS_%s', d) or '' - bb.data.setVar('RRECOMMENDS_%s' % pkg, oldrrec + ' '.join(rreclist), d) + bb.data.setVar('RRECOMMENDS_%s' % pkg, ' '.join(rreclist), d) def packaged(pkg, d): return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK) @@ -826,24 +836,42 @@ PACKAGEFUNCS ?= "package_do_split_locales \ package_do_shlibs \ package_do_pkgconfig \ read_shlibdeps \ - package_depchains" + package_depchains \ + emit_pkgdata" python package_do_package () { for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split(): bb.build.exec_func(f, d) } - -do_package[dirs] = "${D}" # shlibs requires any DEPENDS to have already packaged for the *.list files do_package[deptask] = "do_package" -EXPORT_FUNCTIONS do_package +do_package[dirs] = "${D}" addtask package before do_build after do_install + + +PACKAGE_WRITE_FUNCS ?= "read_subpackage_metadata" + +python package_do_package_write () { + for f in (bb.data.getVar('PACKAGE_WRITE_FUNCS', d, 1) or '').split(): + bb.build.exec_func(f, d) +} +do_package_write[dirs] = "${D}" +addtask package_write before do_build after do_package + + +EXPORT_FUNCTIONS do_package do_package_write + + # # Helper functions for the package writing classes # python package_mapping_rename_hook () { + """ + Rewrite variables to account for package renaming in things + like debian.bbclass or manual PKG variable name changes + """ runtime_mapping_rename("RDEPENDS", d) runtime_mapping_rename("RRECOMMENDS", d) runtime_mapping_rename("RSUGGESTS", d) |