summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2006-10-20 16:09:20 +0000
committerRichard Purdie <rpurdie@rpsys.net>2006-10-20 16:09:20 +0000
commita8be7e0efd18848795c0253a7e99128e028a3768 (patch)
tree440bcd3e2066a27cd4fa0110e7cb7398a55b6050
parentaac32c2eee74418bac9ceb763eeab6232cad130b (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.
-rw-r--r--classes/base.bbclass2
-rw-r--r--classes/debian.bbclass2
-rw-r--r--classes/package.bbclass46
-rw-r--r--classes/package_ipk.bbclass2
-rw-r--r--classes/package_rpm.bbclass2
-rw-r--r--classes/package_tar.bbclass2
6 files changed, 42 insertions, 14 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 6c158e9ef7..7022236ca3 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -575,7 +575,7 @@ do_populate_staging[dirs] = "${STAGING_DIR}/${TARGET_SYS}/bin ${STAGING_DIR}/${T
${STAGING_DATADIR} \
${S} ${B}"
-addtask populate_staging after do_package
+addtask populate_staging after do_package_write
python do_populate_staging () {
bb.build.exec_func('do_stage', d)
diff --git a/classes/debian.bbclass b/classes/debian.bbclass
index 698d917b51..7ffa6c1a27 100644
--- a/classes/debian.bbclass
+++ b/classes/debian.bbclass
@@ -8,7 +8,7 @@ BUILD_ALL_DEPS = "1"
# Better expressed as ensure all RDEPENDS package before we package
# This means we can't have circular RDEPENDS/RRECOMMENDS
-do_package[rdeptask] = "do_package"
+do_package_write[rdeptask] = "do_package"
python debian_package_name_hook () {
import glob, copy, stat, errno, re
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)
diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass
index af6d905490..47cff1d27c 100644
--- a/classes/package_ipk.bbclass
+++ b/classes/package_ipk.bbclass
@@ -1,7 +1,7 @@
inherit package
DEPENDS_prepend="${@["ipkg-utils-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}"
BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg"
-PACKAGEFUNCS += "do_package_ipk"
+PACKAGE_WRITE_FUNCS += "do_package_ipk"
python package_ipk_fn () {
from bb import data
diff --git a/classes/package_rpm.bbclass b/classes/package_rpm.bbclass
index c29ab5f423..d5a1c8b379 100644
--- a/classes/package_rpm.bbclass
+++ b/classes/package_rpm.bbclass
@@ -2,7 +2,7 @@ inherit package
inherit rpm_core
RPMBUILD="rpmbuild --short-circuit ${RPMOPTS}"
-PACKAGEFUNCS += "do_package_rpm"
+PACKAGE_WRITE_FUNCS += "do_package_rpm"
python write_specfile() {
from bb import data, build
diff --git a/classes/package_tar.bbclass b/classes/package_tar.bbclass
index 63e82f7f39..9217811e38 100644
--- a/classes/package_tar.bbclass
+++ b/classes/package_tar.bbclass
@@ -1,6 +1,6 @@
inherit package
-PACKAGEFUNCS += "do_package_tar"
+PACKAGE_WRITE_FUNCS += "do_package_tar"
python package_tar_fn () {
import os