
python () {
    if d.getVar("PREFERRED_PROVIDER_qemu-helper-native") != d.getVar("PN"):
        raise bb.parse.SkipRecipe("Set qemu-helper-native provider to use this recipe")
}

def get_filespath_extra(d, subpath):
    metaroot = next((p for p in d.getVar('BBPATH').split(':') if os.path.basename(p) == 'meta'), None)
    if metaroot:
        return os.path.join(metaroot, subpath) + ":"
    return ""

# TODO: improve this, since it is very hacky that this recipe need to build tunctl.
# include the existing qemu-helper-native
require recipes-devtools/qemu/qemu-helper-native_1.0.bb
# get the path to tunctl.c
FILESEXTRAPATHS_prepend := "${@get_filespath_extra(d, 'recipes-devtools/qemu/qemu-helper')}"

# provide it, to replace the existing
PROVIDES += "qemu-helper-native"

# replace qemu with qemu-xilinx
DEPENDS_remove = "qemu-system-native"
DEPENDS_append = " \
		qemu-xilinx-system-native \
		qemu-xilinx-multiarch-helper-native \
		"

RDEPENDS_${PN}_remove = "qemu-system-native"
RDEPENDS_${PN}_append = " qemu-xilinx-system-native"


python () {
    if d.getVar("PREFERRED_PROVIDER_qemu-helper-native") != d.getVar("PN"):
        raise bb.parse.SkipRecipe("Set qemu-helper-native provider to use this recipe")
}

# TODO: improve this, since it is very hacky that this recipe need to build tunctl.
# include the existing qemu-helper-native
require recipes-devtools/qemu/qemu-helper-native_1.0.bb
# get the path to tunctl.c (from oe-core!)
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-devtools/qemu/qemu-helper:"

# provide it, to replace the existing
PROVIDES += "qemu-helper-native"

# replace qemu with qemu-xilinx
DEPENDS_remove = "qemu-system-native"
DEPENDS_append = " \
		qemu-xilinx-system-native \
		qemu-xilinx-multiarch-helper-native \
		"

RDEPENDS_${PN}_remove = "qemu-system-native"
RDEPENDS_${PN}_append = " qemu-xilinx-system-native"

Change the way we find the oe-core files
qemu-xilinx-helper-native: Change the way we find the oe-core files

Issue: SSW-773

Due to changing the order of the search paths in meta-petalinux to allow
us to override classes, the way we find the oe-core files needs to also
change.  Instead of using a search approach, just assume that the files
we need will always come from oe-core itself.

Signed-off-by: Mark Hatle <41765ab18fb75e64ff0efe27f2ebcdb2d6f7e44e@xilinx.com>
