[oe-commits] org.oe.dev classes: Add support for intertask dependencies to be specified, needed for correct operation with bitbake 1.8.x. Old behaviour is maintained in a special legacy anonymous function in base.bbclass. The patch is an improved version of the one discussed on the mailing list.

rpurdie commit openembedded-commits at lists.openembedded.org
Wed Apr 18 21:24:34 UTC 2007


classes: Add support for intertask dependencies to be specified, needed for correct operation with bitbake 1.8.x. Old behaviour is maintained in a special legacy anonymous function in base.bbclass. The patch is an improved version of the one discussed on the mailing list.

Author: rpurdie at openembedded.org
Branch: org.openembedded.dev
Revision: 01dda772904521f7246a0216c44813ea4042014e
ViewMTN: http://monotone.openembedded.org/revision.psp?id=01dda772904521f7246a0216c44813ea4042014e
Files:
1
classes/base.bbclass
classes/image.bbclass
classes/package.bbclass
classes/package_deb.bbclass
classes/package_ipk.bbclass
classes/package_tar.bbclass
classes/patch.bbclass
classes/rootfs_deb.bbclass
classes/rootfs_ipk.bbclass
Diffs:

#
# mt diff -r0aaef57f33ff16c3524a4a462513efa630a92f0e -r01dda772904521f7246a0216c44813ea4042014e
#
# 
# 
# patch "classes/base.bbclass"
#  from [0546d90a54ab6f65b8b3d2795ddca861e3c7f0f9]
#    to [740d1674cf5585aab21f3f578bb7ca7471f984be]
# 
# patch "classes/image.bbclass"
#  from [2111e717ff5b9fe3a27b6376bb3bb2a494241fa2]
#    to [8daf2b6002f5e436c8a49e96a463591f8e36cb82]
# 
# patch "classes/package.bbclass"
#  from [1937c5926e696fbb28b13a0d7590d6e0946548c5]
#    to [de47edf65ee6076b0e6ad324f73e8d80f8133cfd]
# 
# patch "classes/package_deb.bbclass"
#  from [cc030a88f072281edf59354e68abe78585cac42b]
#    to [d9817556bc8d0216be0724c9e3aa9f9703d01496]
# 
# patch "classes/package_ipk.bbclass"
#  from [bc3ca13bb08fe7dde6d1ee992703139ae25910a2]
#    to [f94dda286b2ddbbb067587e2698b5115a7479f86]
# 
# patch "classes/package_tar.bbclass"
#  from [3a60413f4ef20c1c1131c518760c1fba70ad2f4f]
#    to [fcd7bc894001e323cb9cf5f5d1f547447e7b636e]
# 
# patch "classes/patch.bbclass"
#  from [27225cf1e714d9fe8497a039e8af77c65472940c]
#    to [7682491b44fa64bf586c254fee44ea241be759c1]
# 
# patch "classes/rootfs_deb.bbclass"
#  from [954625ccfd14ab1ab20944b1d03f376d1ce14305]
#    to [ea60c04636d188493ddb3bb12f1d3f28d078a109]
# 
# patch "classes/rootfs_ipk.bbclass"
#  from [04170b3871e0f3e177c162f74e50408afb735a0f]
#    to [121c47ba977e734c272032b7bcf21adaf2f13cf7]
# 
============================================================
--- classes/base.bbclass	0546d90a54ab6f65b8b3d2795ddca861e3c7f0f9
+++ classes/base.bbclass	740d1674cf5585aab21f3f578bb7ca7471f984be
@@ -78,23 +78,10 @@ def base_dep_prepend(d):
 	# the case where host == build == target, for now we don't work in
 	# that case though.
 	#
+	deps = "shasum-native "
 	if bb.data.getVar('PN', d, True) == "shasum-native":
 		deps = ""
-	else:
-		deps = "shasum-native "
 
-	# INHIBIT_PATCH_TOOL don't apply the patch tool dependency
-	inhibit_patch = (bb.data.getVar("INHIBIT_PATCH_TOOL", d, True) == "1") or False
-
-	# INHIBIT_DEFAULT_DEPS doesn't apply to the patch command.  Whether or  not
-	# we need that built is the responsibility of the patch function / class, not
-	# the application.
-	patchdeps = bb.data.getVar("PATCHTOOL", d, 1)
-        if patchdeps and not inhibit_patch:
-		patchdeps = "%s-native" % patchdeps
-		if not patchdeps in bb.data.getVar("PROVIDES", d, 1):
-			deps += patchdeps
-
 	if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d):
 		if (bb.data.getVar('HOST_SYS', d, 1) !=
 	     	    bb.data.getVar('BUILD_SYS', d, 1)):
@@ -819,11 +806,6 @@ def base_after_parse(d):
 
     pn = bb.data.getVar('PN', d, 1)
 
-    # OBSOLETE in bitbake 1.7.4
-    srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1)
-    if srcdate != None:
-        bb.data.setVar('SRCDATE', srcdate, d)
-
     use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1)
     if use_nls != None:
         bb.data.setVar('USE_NLS', use_nls, d)
@@ -850,8 +832,54 @@ def base_after_parse(d):
                 bb.data.setVar('PACKAGE_ARCH', mach_arch, d)
                 return
 
+#
+# Various backwards compatibility stuff to be removed
+# when we switch to bitbake 1.8.2+ as a minimum version
+#
+def base_oldbitbake_workarounds(d):
+    import bb
+    from bb import __version__
+    from distutils.version import LooseVersion
 
+    if (LooseVersion(__version__) > "1.8.0"):
+        return
+
+    pn = bb.data.getVar('PN', d, True)
+    srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, True)
+    if srcdate != None:
+        bb.data.setVar('SRCDATE', srcdate, d)
+    depends = bb.data.getVar('DEPENDS', d, False)
+    patchdeps = bb.data.getVar("PATCHTOOL", d, True)
+    if patchdeps:
+        patchdeps = "%s-native " % patchdeps
+        if not patchdeps in bb.data.getVar("PROVIDES", d, True):
+            depends = patchdeps + depends 
+    if bb.data.inherits_class('rootfs_ipk', d):
+        depends = "ipkg-native ipkg-utils-native fakeroot-native " + depends
+    if bb.data.inherits_class('rootfs_deb', d):
+        depends = "dpkg-native apt-native fakeroot-native " + depends
+    if bb.data.inherits_class('image', d):
+        depends = "makedevs-native " + depends
+        for type in (bb.data.getVar('IMAGE_FSTYPES', d, True) or "").split():
+            deps = bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or ""
+            if deps:
+                depends = depends + " %s" % deps
+        for dep in (bb.data.getVar('EXTRA_IMAGEDEPENDS', d, True) or "").split():
+            depends =  depends + " %s" % dep
+
+    packages = bb.data.getVar('PACKAGES', d, True)
+    if packages != '':
+        if bb.data.inherits_class('package_ipk', d):
+            depends = "ipkg-utils-native " + depends
+        if bb.data.inherits_class('package_deb', d):
+            depends = "dpkg-native " + depends
+        if bb.data.inherits_class('package', d):
+            depends = "${PACKAGE_DEPENDS} fakeroot-native" + depends
+
+    bb.data.setVar('DEPENDS', depends, d)
+
 python () {
+    base_oldbitbake_workarounds(d)
     base_after_parse(d)
 }
 
============================================================
--- classes/image.bbclass	2111e717ff5b9fe3a27b6376bb3bb2a494241fa2
+++ classes/image.bbclass	8daf2b6002f5e436c8a49e96a463591f8e36cb82
@@ -13,20 +13,22 @@ PID = "${@os.getpid()}"
 
 PID = "${@os.getpid()}"
 
-DEPENDS += "makedevs-native"
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
-def get_image_deps(d):
-	import bb
-	str = ""
-	for type in (bb.data.getVar('IMAGE_FSTYPES', d, 1) or "").split():
-		deps = bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or ""
-		if deps:
-			str += " %s" % deps
-	return str
+do_rootfs[depends] += "makedevs-native:do_populate_staging fakeroot-native:do_populate_staging"
 
-DEPENDS += "${@get_image_deps(d)}"
+python () {
+    import bb
 
+    deps = bb.data.getVarFlag('do_rootfs', 'depends', d) or ""
+    for type in (bb.data.getVar('IMAGE_FSTYPES', d, True) or "").split():
+        for dep in ((bb.data.getVar('IMAGE_DEPENDS_%s' % type, d) or "").split() or []):
+            deps += " %s:do_populate_staging" % dep
+    for dep in (bb.data.getVar('EXTRA_IMAGEDEPENDS', d, True) or "").split():
+        deps += " %s:do_populate_staging" % dep
+    bb.data.setVarFlag('do_rootfs', 'depends', deps, d)
+}
+
 #
 # Get a list of files containing device tables to create.
 # * IMAGE_DEVICE_TABLE is the old name to an absolute path to a device table file
============================================================
--- classes/package.bbclass	1937c5926e696fbb28b13a0d7590d6e0946548c5
+++ classes/package.bbclass	de47edf65ee6076b0e6ad324f73e8d80f8133cfd
@@ -116,8 +116,23 @@ def do_split_packages(d, root, file_rege
 
 	bb.data.setVar('PACKAGES', ' '.join(packages), d)
 
-PACKAGE_DEPENDS ?= "file-native fakeroot-native"
-DEPENDS_prepend =+ "${PACKAGE_DEPENDS} "
+PACKAGE_DEPENDS += "file-native"
+
+python () {
+    import bb
+
+    if bb.data.getVar('PACKAGES', d, True) != '':
+        deps = bb.data.getVarFlag('do_package', 'depends', d) or ""
+        for dep in (bb.data.getVar('PACKAGE_DEPENDS', d, True) or "").split():
+            deps += " %s:do_populate_staging" % dep
+        bb.data.setVarFlag('do_package', 'depends', deps, d)
+
+        deps = bb.data.getVarFlag('do_package_write', 'depends', d) or ""
+        for dep in (bb.data.getVar('PACKAGE_EXTRA_DEPENDS', d, True) or "").split():
+            deps += " %s:do_populate_staging" % dep
+        bb.data.setVarFlag('do_package_write', 'depends', deps, d)
+}
+
 # file(1) output to match to consider a file an unstripped executable
 FILE_UNSTRIPPED_MATCH ?= "not stripped"
 #FIXME: this should be "" when any errors are gone!
@@ -126,7 +141,7 @@ runstrip() {
 runstrip() {
 	# Function to strip a single file, called from RUNSTRIP in populate_packages below
 	# A working 'file' (one which works on the target architecture)
-	# is necessary for this stuff to work, hence the addition to PACKAGES_DEPENDS
+	# is necessary for this stuff to work, hence the addition to do_package[depends]
 
 	local ro st
 
============================================================
--- classes/package_deb.bbclass	cc030a88f072281edf59354e68abe78585cac42b
+++ classes/package_deb.bbclass	d9817556bc8d0216be0724c9e3aa9f9703d01496
@@ -1,5 +1,7 @@ inherit package
 inherit package
-DEPENDS_prepend="${@["dpkg-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}"
+
+PACKAGE_EXTRA_DEPENDS += "dpkg-native fakeroot-native"
+
 BOOTSTRAP_EXTRA_RDEPENDS += "dpkg"
 DISTRO_EXTRA_RDEPENDS += "dpkg"
 PACKAGE_WRITE_FUNCS += "do_package_deb"
============================================================
--- classes/package_ipk.bbclass	bc3ca13bb08fe7dde6d1ee992703139ae25910a2
+++ classes/package_ipk.bbclass	f94dda286b2ddbbb067587e2698b5115a7479f86
@@ -1,5 +1,7 @@ inherit package
 inherit package
-DEPENDS_prepend="${@["ipkg-utils-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}"
+
+PACKAGE_EXTRA_DEPENDS += "ipkg-utils-native fakeroot-native"
+
 BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg"
 PACKAGE_WRITE_FUNCS += "do_package_ipk"
 IMAGE_PKGTYPE ?= "ipk"
============================================================
--- classes/package_tar.bbclass	3a60413f4ef20c1c1131c518760c1fba70ad2f4f
+++ classes/package_tar.bbclass	fcd7bc894001e323cb9cf5f5d1f547447e7b636e
@@ -1,5 +1,7 @@ inherit package
 inherit package
 
+PACKAGE_EXTRA_DEPENDS += "tar-native"
+
 PACKAGE_WRITE_FUNCS += "do_package_tar"
 IMAGE_PKGTYPE ?= "tar"
 
============================================================
--- classes/patch.bbclass	27225cf1e714d9fe8497a039e8af77c65472940c
+++ classes/patch.bbclass	7682491b44fa64bf586c254fee44ea241be759c1
@@ -417,6 +417,17 @@ do_patch[dirs] = "${WORKDIR}"
 
 addtask patch after do_unpack
 do_patch[dirs] = "${WORKDIR}"
+
+python () {
+    import bb
+    # do_patch tasks require PATCHTOOL-native to have staged
+    patchdeps = bb.data.getVar("PATCHTOOL", d, True)
+    if patchdeps:
+        patchdeps = "%s-native" % patchdeps
+        if not patchdeps in bb.data.getVar("PROVIDES", d, True):
+            bb.data.setVarFlag('do_patch', 'depends', patchdeps + ":do_populate_staging", d)
+}
+
 python patch_do_patch() {
 	import re
 	import bb.fetch
============================================================
--- classes/rootfs_deb.bbclass	954625ccfd14ab1ab20944b1d03f376d1ce14305
+++ classes/rootfs_deb.bbclass	ea60c04636d188493ddb3bb12f1d3f28d078a109
@@ -1,6 +1,6 @@
-DEPENDS_prepend = "dpkg-native apt-native fakeroot-native "
-DEPENDS_append = " ${EXTRA_IMAGEDEPENDS}"
 
+do_rootfs[depends] += "dpkg-native:do_populate_staging apt-native:do_populate_staging"
+
 fakeroot rootfs_deb_do_rootfs () {
 	set +e
 	mkdir -p ${IMAGE_ROOTFS}/var/dpkg/{info,updates}
============================================================
--- classes/rootfs_ipk.bbclass	04170b3871e0f3e177c162f74e50408afb735a0f
+++ classes/rootfs_ipk.bbclass	121c47ba977e734c272032b7bcf21adaf2f13cf7
@@ -5,12 +5,11 @@
 # See image.bbclass for a usage of this.
 #
 
-DEPENDS_prepend="ipkg-native ipkg-utils-native fakeroot-native "
-DEPENDS_append=" ${EXTRA_IMAGEDEPENDS}"
-RDEPENDS += "ipkg ipkg-collateral"
+do_rootfs[depends] += "ipkg-native:do_populate_staging ipkg-utils-native:do_populate_staging"
 
 IPKG_ARGS = "-f ${T}/ipkg.conf -o ${IMAGE_ROOTFS}"
 
+RDEPENDS += "ipkg ipkg-collateral"
 PACKAGE_INSTALL += "ipkg ipkg-collateral"
 
 rootfs_ipk_do_indexes () {






More information about the Openembedded-commits mailing list