'Yocto Recipe - Override python module version

I've created a layer to install some python modules, but some of them are already included in a third party layer I need (meta-openembedded). The version of python modules installed by the other layer is lower than that I need. I changed my layer priority, and I set it higher than that of the other layer. I tried to do the build, but the installed python modules version is still that of meta-openembedded layer.

If I execute bitbake-layers show-layers my custom layer has a higher priority.

Is there something else I need to do?

Here my layer structure:

meta-chiarini
├── conf
│   └── layer.conf <---- (BBFILE_PRIORITY_meta-one = "10")
├── recipes-python
│   └── paho-mqtt
│       └── python3-paho-mqtt_1.6.1.bb

Here my layer.conf:

# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "meta-chiarini"
BBFILE_PATTERN_meta-chiarini = "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-chiarini = "10"

LAYERDEPENDS_meta-chiarini = "core"
LAYERSERIES_COMPAT_meta-chiarini = "dunfell"

Here python3-paho-mqtt_1.6.1.bb:

SUMMARY = "MQTT version 5.0/3.1.1 client class"
HOMEPAGE = "http://eclipse.org/paho"
AUTHOR = "Roger Light <[email protected]>"
LICENSE = "Eclipse Public License v2.0"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=8e5f264c6988aec56808a3a11e77b913"

SRC_URI = "https://files.pythonhosted.org/packages/f8/dd/4b75dcba025f8647bc9862ac17299e0d7d12d3beadbf026d8c8d74215c12/paho-mqtt-1.6.1.tar.gz"
SRC_URI[md5sum] = "bdb20f88db291fdb4a0fe804c0f29316"
SRC_URI[sha256sum] = "2a8291c81623aec00372b5a85558a372c747cbca8e9934dfe218638b8eefc26f"

S = "${WORKDIR}/paho-mqtt-1.6.1"

RDEPENDS_${PN} = ""

inherit setuptools3


Solution 1:[1]

Generally when working with multiple versions of one recipe, here is the idea:

  • If the two layers have the same priority, bitbake chooses the highest version in the two layers
  • If one of the layers is higher, bitbake chooses the highest version in the highest priority layer

If you want to force a particular version:

PREFERRED_VERSION_<recipe> = "<version>"

NOTE: Make sure that the recipes have the same name in <name>_<version>.bb

Here is an example:

meta-one
??? conf
?   ??? layer.conf <---- (BBFILE_PRIORITY_meta-one = "7")
??? recipes-one
?   ??? one
?       ??? one_1.0.bb
??? recipes-one-one
?   ??? one
?       ??? one_2.0.bb
meta-two
??? conf
?   ??? layer.conf <---- (BBFILE_PRIORITY_meta-two = "8")
??? recipes-one
?   ??? one
?       ??? one_3.0.bb

meta-two has the highest priority, so when I run:

bitbake -s | grep ^one

output is:

one                 :3.0-r0
  • Changing them to the same priority gives the same output.
  • Changing meta-one to be higher (9) gives the highest version in meta-one:
one                 :2.0-r0

Even if it selects automatically the highest version, you can still select a minor version manually:

PREFERRED_VERSION_one = "1.0"

again, bitbake -s | grep one gives:

one                 :2.0-r0                  :1.0-r0
                       ^                        ^
                       |                        |
(you have 2.0 as       |                        |
 highest version) ------                        |
                                                |
(but you selected 1.0) --------------------------

Now, changing the two layers to the same priority with the selection of 1.0 should shows that you have 3.0 as highest version but you selected 1.0:

one                 :3.0-r0                  :1.0-r0

NOTE:

  • The placement of the recipe in each layer is not important to be the same path as:
    • meta-one/recipes-one/one
    • meta-two/recipes-one/one

it is just recommended for readability and organization.

The most important thing is the recipe name matching:

  • Main recipe: one_1.0.bb
  • one_2.0.bb (OK)
  • onee_2.0.bb (NOK, Other entire recipe)

Solution 2:[2]

Using command bitbake -s | grep paho-mqtt I got a log with the issue. The License value added in python3-paho-mqtt_1.6.1.bb wasn't using the right format.

So I've changed:

LICENSE = "Eclipse Public License v2.0"

to:

LICENSE = "EPL-2.0 | EDL-1.0"

I used pipoe to generate .bb files, and it did't found the right license format, so I've added it manually, but without using the short format.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Talel BELHADJSALEM
Solution 2 RiccardoCh