]> git.openpandora.org Git - openembedded.git/commitdiff
classes: Add support for intertask dependencies to be specified, needed for correct...
authorRichard Purdie <rpurdie@rpsys.net>
Wed, 18 Apr 2007 21:22:03 +0000 (21:22 +0000)
committerRichard Purdie <rpurdie@rpsys.net>
Wed, 18 Apr 2007 21:22:03 +0000 (21:22 +0000)
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

index aa693cd4c6df0cf59b77da36273e3c082e858269..d78bd3cec37fffffb989069d6101f1325cf20e8c 100644 (file)
@@ -78,22 +78,9 @@ 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) !=
@@ -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)
 }
 
index 4f870915d0f4f5dc5ea42dfa7c2b9080d8c6d705..2954dcdf39307fff5c407856bda3549dd65f4536 100644 (file)
@@ -13,19 +13,21 @@ USE_DEVFS ?= "0"
 
 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.
index 3e80b2b31cd3a06888f0dc3ddeb656622fce7ae5..e044395347c0f57e5ac8b487cffc375dc916afa6 100644 (file)
@@ -116,8 +116,23 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
 
        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 @@ IGNORE_STRIP_ERRORS ?= "1"
 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
 
index 0c83e58a3767231aa725eb1695dd800ebb6324ee..d172fb176684c0878841e3c5436bb9843de432dd 100644 (file)
@@ -1,5 +1,7 @@
 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"
index 19c082d9788ce2ed1ea651df662849e83381cd61..b5cc6af3bbb3859f42781a36d8bb48691bbf908e 100644 (file)
@@ -1,5 +1,7 @@
 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"
index b048b08ebeb2929f9e90dcd80e1393408f694eb4..e94e7631509d7d25c94ce6d870e06a7deafc3da9 100644 (file)
@@ -1,5 +1,7 @@
 inherit package
 
+PACKAGE_EXTRA_DEPENDS += "tar-native"
+
 PACKAGE_WRITE_FUNCS += "do_package_tar"
 IMAGE_PKGTYPE ?= "tar"
 
index a28f8896c9a73f4e743bced078b1206d51be9499..84cca7f5a0cefc809d9d134061bff612b6805a44 100644 (file)
@@ -417,6 +417,17 @@ def patch_init(d):
 
 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
index 59909d6852f186ac66455bca72c4a51bb8700a17..f44454150974e6bff4be7c98d6f099ccad6fad0f 100644 (file)
@@ -1,5 +1,5 @@
-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
index fdd42ee4293800f1c0d263b265b937410ac459d4..26eca34da97e89567698a593d22a75d7bad4276a 100644 (file)
@@ -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 () {