[oe] Trying to resolve build-time cyclic dependency between packages

Boszormenyi Zoltan zboszor at pr.hu
Wed Jul 29 13:26:29 UTC 2015


Hi,

I have a customized Mesa 10.6.3 package recipe which depends on libva
to be able to build its mesa-va-driver subpackage, but libva also depends
on Mesa to support GLX.

Previously, I simply created a libva-noglx package that builds libva
with --disable-glx that Mesa depend on and the "real" libva package can
depend on Mesa.

But since I also have to produce an SDK image with all the *-dev packages,
creating such an initial image with bitbake fails because of a conflict
in the dependency chain: libva-dev -> mesa-dev -> libva-noglx-dev.

I have come up with the attached bbclass (based on Yocto 1.6) that
now Mesa can inherit and that patches the RDEPENDS / RRECOMMENDS
variables according to externally set variables. The comment at
the beginning of the file explains how to use it.

This pushes the cyclic dependency to opkg which happily breaks it and
installs both libva* and *mesa* packages properly. Creating the initial
image via bitbake works now.

Comments?

Best regards,
Zoltán Böszörményi

-------------- next part --------------
# Resolve cyclic dependencies in final packages
#
# Example: Mesa vs libva cyclic dependency
#
# Resolving the cyclic dependency can be:
# 1. build libva without GLX support (libva-noglx package)
# 2. build mesa
# 3. build libva with GLX support
#
# Mesa's DEPENDS contains libva-noglx
# libva's DEPENDS contains mesa
# The subpackages of mesa will reference libva-noglx
#
# This class attempts to patch the final package dependencies
# with the following:
# CYCLIC_DEPENDS = "pkg"
# CYCLIC_DEPENDS_pkg = "basepkg"
#
# With the example of Mesa:
# CYCLIC_DEPENDS_PKGS = "libva"
# CYCLIC_DEPENDS_libva = "libva-noglx"

python package_depchains_append () {
    deps = d.getVar('CYCLIC_DEPENDS_PKGS', True).split()
    packages = d.getVar('PACKAGES', True).split()
    for pkg in packages:
        for dep in deps:
            depvar = 'CYCLIC_DEPENDS_' + dep
            basedep = d.getVar(depvar, True)
            bb.note("before cyclic dependency dep %s depvar %s basedep %s" % (dep, depvar, basedep))

            rdep = 'RDEPENDS_' + pkg
            rdepends = d.getVar(rdep, True)
            if rdepends:
                bb.note("before cyclic dependency fix %s = '%s'" % (rdep, rdepends))
                d.setVar(rdep, rdepends.replace(basedep, dep))
                bb.note("after cyclic dependency fix %s = '%s'" % (rdep, d.getVar(rdep, True)))

            rrec = 'RRECOMMENDS_' + pkg
            rrecommends = d.getVar(rrec, True)
            if rrecommends:
                bb.note("before cyclic dependency fix %s = '%s'" % (rrec, rrecommends))
                d.setVar(rrec, rrecommends.replace(basedep, dep))
                bb.note("after cyclic dependency fix %s = '%s'" % (rrec, d.getVar(rrec, True)))
}


More information about the Openembedded-devel mailing list