PREFERRED_VERSION_pn-: which version is selected?


Mauro Ziliani
 

Hi all.

I'm working with Krogoth on imx6


I have the same recipe with different versions

recipe1_0.9.bb

recipe1_1.0.bb


In the image recipe I put


image-recipe.bb

IMAGE_INSTALL_append := " \

    recipe1 \

"

PREFERRED_VERSION_pn-recipe1 := "0.9"


If I do

 bitbake -s

I get

recipe1    :1.0-r0


If I do

bitbake image-recipe


in image-recipe.manifest I look

recipe1  1.0-r0


Why is not selected the preferred version?

How can I choose the recipe's version I'd like?


Best regards,

   MZ


Josef Holzmayr
 

Howdy!

Am Mo., 8. Feb. 2021 um 11:52 Uhr schrieb Mauro Ziliani <mauro@faresoftware.it>:
In the image recipe I put

image-recipe.bb

IMAGE_INSTALL_append := " \
recipe1 \
"

PREFERRED_VERSION_pn-recipe1 := "0.9"
As usual, recipe data is local, conf data is global. Setting things
that should affect other recipes (like PREFERRED_VERSION) does not
work inside a recipe - and an image recipe is still just a recipe.
This needs to go into the DISTRO config, usually.

Greetz


Martin Jansa
 

And the variable should be named PREFERRED_VERSION_recipe1 (it's not using pn as an override).


On Mon, Feb 8, 2021 at 12:10 PM Josef Holzmayr <jester@...> wrote:
Howdy!

Am Mo., 8. Feb. 2021 um 11:52 Uhr schrieb Mauro Ziliani <mauro@...>:
> In the image recipe I put
>
> image-recipe.bb
>
> IMAGE_INSTALL_append := " \
>      recipe1 \
> "
>
> PREFERRED_VERSION_pn-recipe1 := "0.9"

As usual, recipe data is local, conf data is global. Setting things
that should affect other recipes (like PREFERRED_VERSION) does not
work inside a recipe - and an image recipe is still just a recipe.
This needs to go into the DISTRO config, usually.

Greetz




Quentin Schulz
 

Hi Mauro,

On Mon, Feb 08, 2021 at 11:52:33AM +0100, Mauro Ziliani wrote:
Hi all.

I'm working with Krogoth on imx6


I have the same recipe with different versions

recipe1_0.9.bb

recipe1_1.0.bb


In the image recipe I put


image-recipe.bb

IMAGE_INSTALL_append := " \

    recipe1 \

"

PREFERRED_VERSION_pn-recipe1 := "0.9"
Yocto chant #1: Recipe data is local, conf data is global.

In other words, you cannot modify other recipes from one recipe.

Since image recipes are recipes, your PREFERRED_VERSION ni your image
recipe is effectively a no-op.

On a side note, := operator is rarely seen outside of
FILESEXTRAPATHS_prepend in bbappend, try to keep it this way.


If I do

 bitbake -s

I get

recipe1    :1.0-r0


If I do

bitbake image-recipe


in image-recipe.manifest I look

recipe1  1.0-r0


Why is not selected the preferred version?

How can I choose the recipe's version I'd like?
In a configuration file: local.conf, distro.conf, machine.conf.

Though, it is heavily discouraged to use local.conf for anything except
debugging sessions, as it is meant only for **local** configuration and
isn't supposed to be versioned.

Cheers,
Quentin


Mauro Ziliani
 

My purpose is this.

For image-recipe_1.0.0 I need recip1 version 0.9

For image-recipe_1.1.0 I need recip1 version 1.0


How I can solve this?


Best regards

  MZ

Il 08/02/21 12:09, Josef Holzmayr ha scritto:
Howdy!

Am Mo., 8. Feb. 2021 um 11:52 Uhr schrieb Mauro Ziliani <mauro@faresoftware.it>:
In the image recipe I put

image-recipe.bb

IMAGE_INSTALL_append := " \
recipe1 \
"

PREFERRED_VERSION_pn-recipe1 := "0.9"
As usual, recipe data is local, conf data is global. Setting things
that should affect other recipes (like PREFERRED_VERSION) does not
work inside a recipe - and an image recipe is still just a recipe.
This needs to go into the DISTRO config, usually.

Greetz


Mauro Ziliani
 

Thanks all for suggestions ed corrections

MZ

Il 08/02/21 12:14, Quentin Schulz ha scritto:
Hi Mauro,

On Mon, Feb 08, 2021 at 11:52:33AM +0100, Mauro Ziliani wrote:
Hi all.

I'm working with Krogoth on imx6


I have the same recipe with different versions

recipe1_0.9.bb

recipe1_1.0.bb


In the image recipe I put


image-recipe.bb

IMAGE_INSTALL_append := " \

    recipe1 \

"

PREFERRED_VERSION_pn-recipe1 := "0.9"
Yocto chant #1: Recipe data is local, conf data is global.

In other words, you cannot modify other recipes from one recipe.

Since image recipes are recipes, your PREFERRED_VERSION ni your image
recipe is effectively a no-op.

On a side note, := operator is rarely seen outside of
FILESEXTRAPATHS_prepend in bbappend, try to keep it this way.

If I do

 bitbake -s

I get

recipe1    :1.0-r0


If I do

bitbake image-recipe


in image-recipe.manifest I look

recipe1  1.0-r0


Why is not selected the preferred version?

How can I choose the recipe's version I'd like?
In a configuration file: local.conf, distro.conf, machine.conf.

Though, it is heavily discouraged to use local.conf for anything except
debugging sessions, as it is meant only for **local** configuration and
isn't supposed to be versioned.

Cheers,
Quentin


Quentin Schulz
 

Hi Mauro,

On Mon, Feb 08, 2021 at 05:23:36PM +0100, Mauro Ziliani wrote:
My purpose is this.

For image-recipe_1.0.0 I need recip1 version 0.9

For image-recipe_1.1.0 I need recip1 version 1.0
You can't. Because recipes cannot impact other recipes.

Now there's a catch, which applies to a VERY specific corner case.

Let's say recip1 is a final package (recip1 recipe is in no DEPENDS of any
recipe, recip1 recipe packages are in no RDEPENDS, only recip1 packages are
mentioned in image recipes).

You can rename recip1_0.9 to recip109_0.9.bb and in your
image-recipe_1.0.0 add recip109 to IMAGE_INSTALL.
in image-recipe_1.1.0 have recip1 in IMAGE_INSTALL.

Obviously, since the recipe name is now different, they are different
recipes to Yocto, which means DEPENDS and RDEPENDS won't be
automatically "updated" to get the version you selected in image-recipe
(because... recipes can't modify other recipes).

Cheers,
Quentin