[oe-commits] org.oe.dev 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.

rpurdie commit openembedded-commits at lists.openembedded.org
Fri Oct 20 16:17:20 UTC 2006


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.

Author: rpurdie at openembedded.org
Branch: org.openembedded.dev
Revision: eeb4aa4753929432a02465dc9850da705a64c40c
ViewMTN: http://monotone.openembedded.org/revision.psp?id=eeb4aa4753929432a02465dc9850da705a64c40c
Files:
1
classes/base.bbclass
classes/debian.bbclass
classes/package.bbclass
classes/package_ipk.bbclass
classes/package_rpm.bbclass
classes/package_tar.bbclass
Diffs:

#
# mt diff -r0bf9a44e639e07dde3c8f34b782f5bcbbd9c98eb -reeb4aa4753929432a02465dc9850da705a64c40c
#
# 
# 
# patch "classes/base.bbclass"
#  from [66c093c52e2bdbdd4758ae423d739682db973429]
#    to [e7bb3e05349837a73ade704395d8c7e466446b2d]
# 
# patch "classes/debian.bbclass"
#  from [132b41c84a471064940737943c193f24c73023d2]
#    to [8c9b52de3271429660ba9770645078d16d198921]
# 
# patch "classes/package.bbclass"
#  from [5d22ca2ba023e249bd55db345f18b077d89ae27c]
#    to [f0c24df8d83cb5eddc8dd139f1b482595a08a080]
# 
# patch "classes/package_ipk.bbclass"
#  from [03e5c828ed9b4f8d9935e303a5441183ded84414]
#    to [25329a5477253bdcdb72f43a093cba57c0bf6f14]
# 
# patch "classes/package_rpm.bbclass"
#  from [5900fb28e76c0dc4cc5dfc4c82c65cb63b81cf93]
#    to [522c66295b43bee82e1b488cb2a0dceddd668687]
# 
# patch "classes/package_tar.bbclass"
#  from [c06d37b142acf556e3eb869db5d8aa14a8b5fc1d]
#    to [ab914c75bfceda90c80cff09743b39a444bba112]
# 
============================================================
--- classes/base.bbclass	66c093c52e2bdbdd4758ae423d739682db973429
+++ classes/base.bbclass	e7bb3e05349837a73ade704395d8c7e466446b2d
@@ -575,7 +575,7 @@ do_populate_staging[dirs] = "${STAGING_D
 			     ${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)
============================================================
--- classes/debian.bbclass	132b41c84a471064940737943c193f24c73023d2
+++ classes/debian.bbclass	8c9b52de3271429660ba9770645078d16d198921
@@ -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
============================================================
--- classes/package.bbclass	5d22ca2ba023e249bd55db345f18b077d89ae27c
+++ classes/package.bbclass	f0c24df8d83cb5eddc8dd139f1b482595a08a080
@@ -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_locale
 		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)
============================================================
--- classes/package_ipk.bbclass	03e5c828ed9b4f8d9935e303a5441183ded84414
+++ classes/package_ipk.bbclass	25329a5477253bdcdb72f43a093cba57c0bf6f14
@@ -1,7 +1,7 @@ BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collat
 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
============================================================
--- classes/package_rpm.bbclass	5900fb28e76c0dc4cc5dfc4c82c65cb63b81cf93
+++ classes/package_rpm.bbclass	522c66295b43bee82e1b488cb2a0dceddd668687
@@ -1,8 +1,8 @@ RPMBUILD="rpmbuild --short-circuit ${RPM
 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
============================================================
--- classes/package_tar.bbclass	c06d37b142acf556e3eb869db5d8aa14a8b5fc1d
+++ classes/package_tar.bbclass	ab914c75bfceda90c80cff09743b39a444bba112
@@ -1,6 +1,6 @@ inherit package
 inherit package
 
-PACKAGEFUNCS += "do_package_tar"
+PACKAGE_WRITE_FUNCS += "do_package_tar"
 
 python package_tar_fn () {
 	import os






More information about the Openembedded-commits mailing list