[yocto] Dynamic PV version in recipe

Marco Garzola marco.garzola at tecniplast.it
Fri Jun 17 04:03:37 PDT 2016


Hello , sorry for previous mail.


I tried with

python do_package_prepend() {

  d.setVar('PKGV', d.getVar("JENKINS_VERSION", True))

}


and in do_compile :


{

  ....

  VERSION= get from bash parsing.

  "${@d.setVar("JENKINS_VERSION","$VERSION"}"


}



but doesn't work... it only work if  i put a static string in version.


any help?


thanks


________________________________
Da: Marco Garzola
Inviato: venerdì 17 giugno 2016 12.59.32
A: Christopher Larson
Cc: yocto at yoctoproject.org
Oggetto: Re: [yocto] Dynamic PV version in recipe


hello again,


I tried adding :



python do_package_prepend() {

d.setVar('PKGV', d.getVar("JENKINS_VERSION", True)) print d.getVar('PKGV',True)

________________________________
Da: yocto-bounces at yoctoproject.org <yocto-bounces at yoctoproject.org> per conto di Marco Garzola <marco.garzola at tecniplast.it>
Inviato: giovedì 16 giugno 2016 22.11.25
A: Christopher Larson
Cc: yocto at yoctoproject.org
Oggetto: Re: [yocto] Dynamic PV version in recipe


Hi Christopher,

PKGV seems very interesting to me. is there out there any example to follow ?

if I add something like that at the end of do_compile task should it work?

do_compile(){
#..... do stuff and get in myVersion the revision

{@setVar("PKGV","${myVersion}")}

}


Thanks .

Marco
________________________________
Da: kergoth at gmail.com <kergoth at gmail.com> per conto di Christopher Larson <clarson at kergoth.com>
Inviato: giovedì 16 giugno 2016 21.51.26
A: Marco Garzola
Cc: yocto at yoctoproject.org
Oggetto: Re: [yocto] Dynamic PV version in recipe

On Thu, Jun 16, 2016 at 8:11 AM, Marco Garzola <marco.garzola at tecniplast.it<mailto:marco.garzola at tecniplast.it>> wrote:
I got a problem, maybe someone could help me.I have a recipe that takes from a jenkins server via json API a binary file with a version that i know only after do_compile task. the question is : is there any way to tell bitbake that $PV should change dynamically  , maybe in do_install task ? My goal is  to create the package with  the revision read from jenkins.

PV has to be set at parse time, up front, so bitbake can use it in stamps to help determine when tasks need to be run, as well as including it in WORKDIR and whatnot.

If all you want is to change the version in the emitted binary packages, you can dynamically set PKGV, i.e. add a prefunc before do_package which reads the PKGV. Of course, making sure it re-runs the appropriate tasks when that value changes is rather less trivial, since bitbake generates signatures/checksums at parse time.

Alternatively, would it be possible to contact the server via the json API at parse time as long as BB_NO_NETWORK isn't set? Of course, unless there's a way to support the BB_NO_NETWORK case, that would be problematic as well.
--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160617/378c67c7/attachment.html>


More information about the yocto mailing list