From 1a7cff6077b770083062952ef6f6f7517bfd2c07 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 18 Apr 2007 21:22:03 +0000 Subject: 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. --- classes/base.bbclass | 66 ++++++++++++++++++++++++++++++++------------- classes/image.bbclass | 22 ++++++++------- classes/package.bbclass | 21 ++++++++++++--- classes/package_deb.bbclass | 4 ++- classes/package_ipk.bbclass | 4 ++- classes/package_tar.bbclass | 2 ++ classes/patch.bbclass | 11 ++++++++ classes/rootfs_deb.bbclass | 4 +-- classes/rootfs_ipk.bbclass | 5 ++-- 9 files changed, 100 insertions(+), 39 deletions(-) diff --git a/classes/base.bbclass b/classes/base.bbclass index aa693cd4c6..d78bd3cec3 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -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) } diff --git a/classes/image.bbclass b/classes/image.bbclass index 4f870915d0..2954dcdf39 100644 --- a/classes/image.bbclass +++ b/classes/image.bbclass @@ -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. diff --git a/classes/package.bbclass b/classes/package.bbclass index 3e80b2b31c..e044395347 100644 --- a/classes/package.bbclass +++ b/classes/package.bbclass @@ -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 diff --git a/classes/package_deb.bbclass b/classes/package_deb.bbclass index 0c83e58a37..d172fb1766 100644 --- a/classes/package_deb.bbclass +++ b/classes/package_deb.bbclass @@ -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" diff --git a/classes/package_ipk.bbclass b/classes/package_ipk.bbclass index 19c082d978..b5cc6af3bb 100644 --- a/classes/package_ipk.bbclass +++ b/classes/package_ipk.bbclass @@ -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" diff --git a/classes/package_tar.bbclass b/classes/package_tar.bbclass index b048b08ebe..e94e763150 100644 --- a/classes/package_tar.bbclass +++ b/classes/package_tar.bbclass @@ -1,5 +1,7 @@ inherit package +PACKAGE_EXTRA_DEPENDS += "tar-native" + PACKAGE_WRITE_FUNCS += "do_package_tar" IMAGE_PKGTYPE ?= "tar" diff --git a/classes/patch.bbclass b/classes/patch.bbclass index a28f8896c9..84cca7f5a0 100644 --- a/classes/patch.bbclass +++ b/classes/patch.bbclass @@ -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 diff --git a/classes/rootfs_deb.bbclass b/classes/rootfs_deb.bbclass index 59909d6852..f444541509 100644 --- a/classes/rootfs_deb.bbclass +++ b/classes/rootfs_deb.bbclass @@ -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 diff --git a/classes/rootfs_ipk.bbclass b/classes/rootfs_ipk.bbclass index fdd42ee429..26eca34da9 100644 --- a/classes/rootfs_ipk.bbclass +++ b/classes/rootfs_ipk.bbclass @@ -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 () { -- cgit 1.2.3-korg