How do you use a specific package version in a Yocto image recipe?

My current project is based on Yocto Daisy, with user level ads in one repo and →> repo. The life cycle of the application code is slightly different from the life cycle of the user level, so I would like to be able to capture it in the assembly.

For this purpose, I have two recipes extending core-image: 'my-image' and 'my-image-dev'. I would like my-image to always use the labeled version of the application (for example, v0.1, v0.2, etc.). I would like my-image-dev to always use the HEAD app from git master.

I wrote the recipes 'application_0.1.bb' and 'application_git.bb' and tested them in isolation. They behave as expected - "application_0.1.bb" receives a 0.1 tag, and "application_git.bb" receives a master.

The problem arises when I try to instruct a specific image to use a specific version of an “application”. I would think that it would be as simple as adding PREFERRED_VERSION_application = "0.1" and PREFERRED_VERSION_application = "git%" to my image recipes, but that does not give me any love. The only places PREFERRED_VERSION works in are in the layer.conf and machine.conf files, which does not help me, since both images are for the same logical machine.

So, this is my question - is there a way to declare a dependency on a particular package version on a Yocto image?

+5
source share
1 answer

I found a solution that allows me to do exactly what I was looking for.

The key was to split my application package into two packages - "application" and "application - git". Then I transferred the recipe with the version to “application” and the development recipe to “application-git”. To reduce duplicate code, I moved all the common logic between the two recipes to the file "application / application.inc" and included it in the "application- git.bb" using require recipes-application/application/application.inc .

Now I can include the appropriate package in my images. So, 'my-image.bb' contains IMAGE_INSTALL += "application" . "my -image-dev.bb" requires "my-image.bb", so I added the line IMAGE_INSTALL_remove = "application" and added IMAGE_INSTALL += "application-git" .

This is a mild abuse of the system, but since it leads to an explicit result (the release version in the image, the dev version in image-dev), I think it's worth it.

+3
source

Source: https://habr.com/ru/post/1201693/


All Articles