Skip to contentSkip to conversation

Setting recipe version inside an image recipe

DISCUSSION Mauro Ziliani 2 participants 3 messages Jul 19, 2018

lore
Share & tools
lore
#0 lore raw

Hi all

I'm working with Krogoth.

I'd like to do this.

- I have my application added to yocto tree by its own recipe myapp_git.bb

This recipe get the source code from a local git repository setting  SRCREV for the last stable application source code.

SRCREV is fixed in myapp_git.bb

- I have the recipe for the final production image for the embedded  system  myos.bb, which declare

IMAGE_INSTALL_append = " myapp "

The myos.bb compiles myapp with the version declare in myapp_git.bb recipe

I'd like to do that

- prepare a base recipe myos-base.inc  where I define all I need the produce the final image with

IMAGE_INSTALL_append = " myapp "

- prepare myos.bb recipe where I can fix the version of myapp.bb to a prpduction version

- prepare myos-test.bb recipre where I can fix the HEAD branch of git from I can download the  latest source code for test.

I try this

- inside myapp_git.bb I put SRCREV="${MYAPP_SRCREV}"

- inside myos.bb I set MYAPP_SRCREV="prodution-version-X" to download the tag/branch production-version-X

- inside myos-test.bb I set MYAPP_SRCREV="${AUTOREV}" to download the latest git commit

Any idea?

MZ

#1 lore raw

Hi Mauro

Quoted 36 lines · CEST Mauro Ziliani

I'm working with Krogoth.

I'd like to do this.

- I have my application added to yocto tree by its own recipe myapp_git.bb

This recipe get the source code from a local git repository setting SRCREV for the last stable application source code.

SRCREV is fixed in myapp_git.bb

- I have the recipe for the final production image for the embedded system myos.bb, which declare

IMAGE_INSTALL_append = " myapp "

The myos.bb compiles myapp with the version declare in myapp_git.bb recipe

I'd like to do that

- prepare a base recipe myos-base.inc where I define all I need the produce the final image with

IMAGE_INSTALL_append = " myapp "

- prepare myos.bb recipe where I can fix the version of myapp.bb to a prpduction version

- prepare myos-test.bb recipre where I can fix the HEAD branch of git from I can download the latest source code for test.

I try this

Quoted 7 lines

- inside myapp_git.bb I put SRCREV="${MYAPP_SRCREV}"

- inside myos.bb I set MYAPP_SRCREV="prodution-version-X" to download the tag/branch production-version-X

- inside myos-test.bb I set MYAPP_SRCREV="${AUTOREV}" to download the latest git commit

You cannot do this I'm afraid - in general you cannot set a variable in one recipe that will be read by another. See:

https://wiki.yoctoproject.org/wiki/Technical_FAQ#How_do_I_change_how_my_recipe_is_built_depending_on_what_image_I.27m_building.3F

The only real way to do what you're looking for is to have two different recipes (where the name is actually different, not just the version). e.g. you could have myapp_git.bb and myapp-test_git.bb. You could use a common inc file and "require" that from both .bb files in order to keep the common parts in one place. Then you can specify the corresponding package name in each image recipe.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#2 lore raw

Thank you.

Your suggestion is very useful.

The best choice at the end is to have one  recipe every stable version of myapp.

So I can freeze the true production recipe for that version.

Maybe in the future the recipe myapp could be evolve with some enhancement which could not be compatible with older version.

Good idea.

Best regards,

MZ

Il 19/07/2018 16:02, Paul Eggleton ha scritto:

Quoted 61 lines

Hi Mauro

Quoted 36 lines · CEST Mauro Ziliani

I'm working with Krogoth.

I'd like to do this.

- I have my application added to yocto tree by its own recipe myapp_git.bb

This recipe get the source code from a local git repository setting SRCREV for the last stable application source code.

SRCREV is fixed in myapp_git.bb

- I have the recipe for the final production image for the embedded system myos.bb, which declare

IMAGE_INSTALL_append = " myapp "

The myos.bb compiles myapp with the version declare in myapp_git.bb recipe

I'd like to do that

- prepare a base recipe myos-base.inc where I define all I need the produce the final image with

IMAGE_INSTALL_append = " myapp "

- prepare myos.bb recipe where I can fix the version of myapp.bb to a prpduction version

- prepare myos-test.bb recipre where I can fix the HEAD branch of git from I can download the latest source code for test.

I try this

Quoted 7 lines

- inside myapp_git.bb I put SRCREV="${MYAPP_SRCREV}"

- inside myos.bb I set MYAPP_SRCREV="prodution-version-X" to download the tag/branch production-version-X

- inside myos-test.bb I set MYAPP_SRCREV="${AUTOREV}" to download the latest git commit

You cannot do this I'm afraid - in general you cannot set a variable in one recipe that will be read by another. See:

https://wiki.yoctoproject.org/wiki/Technical_FAQ#How_do_I_change_how_my_recipe_is_built_depending_on_what_image_I.27m_building.3F

The only real way to do what you're looking for is to have two different recipes (where the name is actually different, not just the version). e.g. you could have myapp_git.bb and myapp-test_git.bb. You could use a common .inc file and "require" that from both .bb files in order to keep the common parts in one place. Then you can specify the corresponding package name in each image recipe.

Cheers,
Paul