How to dynamically set PKGV? #yocto #python


Denys Dmytriyenko
 

On Wed, Jan 15, 2020 at 12:38:19PM -0800, Bill.Kulp@azuresummit.com wrote:
I have a recipe that builds an application from the master branch of a local
git repository.  AUTOREV is working, so the recipe automatically rebuilds
whenever the repository is updated.  The source code has its own version
number.  I'm wondering if it is possible to grab that version number during
the do_compile step, and set the package version based on that?

As a first step, I tried to change the value of PKGV from a bitbake task.

PKGV = "BadBad"
python do_foo () {
d.setVar( "PKGV" , "GoodGood" )
print ( "PKGV set to " + d.getVar( "PKGV" ))
}
addtask foo after do_compile before do_package

However, this did not work - the resulting RPM packages are named
"my_package-BadBad-r0.noarch.rpm".  Can anyone suggest a fix, or a different
method?

Thanks!


Bill.Kulp@...
 

I have a recipe that builds an application from the master branch of a local git repository.  AUTOREV is working, so the recipe automatically rebuilds whenever the repository is updated.  The source code has its own version number.  I'm wondering if it is possible to grab that version number during the do_compile step, and set the package version based on that?

As a first step, I tried to change the value of PKGV from a bitbake task.

PKGV="BadBad"
python do_foo () {
    d.setVar("PKGV""GoodGood")
    print("PKGV set to " + d.getVar("PKGV"))
}
addtask foo after do_compile before do_package

However, this did not work - the resulting RPM packages are named "my_package-BadBad-r0.noarch.rpm".  Can anyone suggest a fix, or a different method?


Thanks!