[oe-commits] org.oe.dev classes/package.bbclass, conf/bitbake.conf:

clarson commit openembedded-commits at lists.openembedded.org
Thu Sep 14 21:23:09 UTC 2006


classes/package.bbclass,conf/bitbake.conf:
  * Add package "depchains".  This facilitates, for example, ensuring that if
    A depends upon B, then A-dev will RRECOMMENDS B-dev, and the same for the
    -dbg packages.

Author: clarson at kergoth.com
Branch: org.openembedded.dev
Revision: fd4f8197fc893ac473a9b7436ba5268b5e0da70d
ViewMTN: http://monotone.openembedded.org/revision.psp?id=fd4f8197fc893ac473a9b7436ba5268b5e0da70d
Files:
1
classes/package.bbclass
conf/bitbake.conf
Diffs:

#
# mt diff -rdb2f843f48cece5e25cf2e654db269ba3dba5192 -rfd4f8197fc893ac473a9b7436ba5268b5e0da70d
#
# 
# 
# patch "classes/package.bbclass"
#  from [b159264f3db7d8574669025ea38bf8007d06242f]
#    to [45874535a5de1fced4ea0e4057e755471c7c6ccc]
# 
# patch "conf/bitbake.conf"
#  from [9bd342a6265a8324bf0b5aeabc9166a69966c598]
#    to [fd6dc697393dabff068e6ce15c3a9fed49b830c4]
# 
============================================================
--- classes/package.bbclass	b159264f3db7d8574669025ea38bf8007d06242f
+++ classes/package.bbclass	45874535a5de1fced4ea0e4057e755471c7c6ccc
@@ -429,6 +429,58 @@ fi
 fi
 }
 
+python package_depchains() {
+	"""
+	For a given set of prefix and postfix modifiers, make those packages
+	RRECOMMENDS on the corresponding packages for its DEPENDS.
+
+	Example:  If package A depends upon package B, and A's .bb emits an
+	A-dev package, this would make A-dev Recommends: B-dev.
+	"""
+
+	packages  = bb.data.getVar('PACKAGES', d, 1)
+	postfixes = (bb.data.getVar('DEPCHAIN_POST', d, 1) or '').split()
+	prefixes  = (bb.data.getVar('DEPCHAIN_PRE', d, 1) or '').split()
+
+	def pkg_addrrecs(pkg, base, func, d):
+		rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + base, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "")
+		# bb.note('rdepends for %s is %s' % (base, rdepends))
+		rreclist = []
+
+		for depend in rdepends:
+			split_depend = depend.split(' (')
+			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)
+
+	def packaged(pkg, d):
+		return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK)
+
+	for pkg in packages.split():
+		for postfix in postfixes:
+			def func(list, name):
+				pkg = '%s%s' % (name, postfix)
+				if packaged(pkg, d):
+					list.append(pkg)
+
+			base = pkg[:-len(postfix)]
+			if pkg.endswith(postfix):
+				pkg_addrrecs(pkg, base, func, d)
+				continue
+
+		for prefix in prefixes:
+			def func(list, name):
+				pkg = '%s%s' % (prefix, name)
+				if packaged(pkg, d):
+					list.append(pkg)
+
+			base = pkg[len(prefix):]
+			if pkg.startswith(prefix):
+				pkg_addrrecs(pkg, base, func, d)
+}
+
 python package_do_shlibs() {
 	import os, re, os.path
 
@@ -734,9 +786,10 @@ python package_do_split_locales() {
 	bb.data.setVar('RDEPENDS_%s' % mainpkg, ' '.join(rdep), d)
 }
 
-PACKAGEFUNCS ?= " package_do_split_locales \
+PACKAGEFUNCS = "do_install package_do_split_locales \
 		populate_packages package_do_shlibs \
-		package_do_pkgconfig read_shlibdeps"
+		package_do_pkgconfig read_shlibdeps \
+		package_depchains"
 python package_do_package () {
 	for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split():
 		bb.build.exec_func(f, d)
============================================================
--- conf/bitbake.conf	9bd342a6265a8324bf0b5aeabc9166a69966c598
+++ conf/bitbake.conf	fd6dc697393dabff068e6ce15c3a9fed49b830c4
@@ -96,6 +96,11 @@ HOMEPAGE = "unknown"
 
 # Package dependencies and provides.
 
+# Ensure that -dev packages recommend the corresponding -dev packages of their
+# deps, and the same for -dbg.
+DEPCHAIN_PRE  = ""
+DEPCHAIN_POST = "-dev -dbg"
+
 DEPENDS = ""
 RDEPENDS = ""
 PROVIDES = ""






More information about the Openembedded-commits mailing list