All of lore.kernel.org
 help / color / mirror / Atom feed
* Dynamic PV version in recipe
@ 2016-06-16 15:11 Marco Garzola
  2016-06-16 19:51 ` Christopher Larson
  0 siblings, 1 reply; 5+ messages in thread
From: Marco Garzola @ 2016-06-16 15:11 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]

Hi all,


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.



Thanks anyone for the help


Marco

[-- Attachment #2: Type: text/html, Size: 903 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dynamic PV version in recipe
  2016-06-16 15:11 Dynamic PV version in recipe Marco Garzola
@ 2016-06-16 19:51 ` Christopher Larson
  2016-06-16 20:11   ` Marco Garzola
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Larson @ 2016-06-16 19:51 UTC (permalink / raw)
  To: Marco Garzola; +Cc: yocto

[-- Attachment #1: Type: text/plain, Size: 1367 bytes --]

On Thu, Jun 16, 2016 at 8:11 AM, Marco Garzola <marco.garzola@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

[-- Attachment #2: Type: text/html, Size: 1780 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dynamic PV version in recipe
  2016-06-16 19:51 ` Christopher Larson
@ 2016-06-16 20:11   ` Marco Garzola
  2016-06-17 10:59     ` Marco Garzola
  0 siblings, 1 reply; 5+ messages in thread
From: Marco Garzola @ 2016-06-16 20:11 UTC (permalink / raw)
  To: Christopher Larson; +Cc: yocto

[-- Attachment #1: Type: text/plain, Size: 1957 bytes --]


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@gmail.com <kergoth@gmail.com> per conto di Christopher Larson <clarson@kergoth.com>
Inviato: giovedì 16 giugno 2016 21.51.26
A: Marco Garzola
Cc: yocto@yoctoproject.org
Oggetto: Re: [yocto] Dynamic PV version in recipe

On Thu, Jun 16, 2016 at 8:11 AM, Marco Garzola <marco.garzola@tecniplast.it<mailto:marco.garzola@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

[-- Attachment #2: Type: text/html, Size: 3436 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dynamic PV version in recipe
  2016-06-16 20:11   ` Marco Garzola
@ 2016-06-17 10:59     ` Marco Garzola
  2016-06-17 11:03       ` Marco Garzola
  0 siblings, 1 reply; 5+ messages in thread
From: Marco Garzola @ 2016-06-17 10:59 UTC (permalink / raw)
  To: Christopher Larson; +Cc: yocto

[-- Attachment #1: Type: text/plain, Size: 2421 bytes --]

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@yoctoproject.org <yocto-bounces@yoctoproject.org> per conto di Marco Garzola <marco.garzola@tecniplast.it>
Inviato: giovedì 16 giugno 2016 22.11.25
A: Christopher Larson
Cc: yocto@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@gmail.com <kergoth@gmail.com> per conto di Christopher Larson <clarson@kergoth.com>
Inviato: giovedì 16 giugno 2016 21.51.26
A: Marco Garzola
Cc: yocto@yoctoproject.org
Oggetto: Re: [yocto] Dynamic PV version in recipe

On Thu, Jun 16, 2016 at 8:11 AM, Marco Garzola <marco.garzola@tecniplast.it<mailto:marco.garzola@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

[-- Attachment #2: Type: text/html, Size: 4568 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dynamic PV version in recipe
  2016-06-17 10:59     ` Marco Garzola
@ 2016-06-17 11:03       ` Marco Garzola
  0 siblings, 0 replies; 5+ messages in thread
From: Marco Garzola @ 2016-06-17 11:03 UTC (permalink / raw)
  To: Christopher Larson; +Cc: yocto

[-- Attachment #1: Type: text/plain, Size: 3013 bytes --]

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@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@yoctoproject.org <yocto-bounces@yoctoproject.org> per conto di Marco Garzola <marco.garzola@tecniplast.it>
Inviato: giovedì 16 giugno 2016 22.11.25
A: Christopher Larson
Cc: yocto@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@gmail.com <kergoth@gmail.com> per conto di Christopher Larson <clarson@kergoth.com>
Inviato: giovedì 16 giugno 2016 21.51.26
A: Marco Garzola
Cc: yocto@yoctoproject.org
Oggetto: Re: [yocto] Dynamic PV version in recipe

On Thu, Jun 16, 2016 at 8:11 AM, Marco Garzola <marco.garzola@tecniplast.it<mailto:marco.garzola@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

[-- Attachment #2: Type: text/html, Size: 5983 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-17 11:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-16 15:11 Dynamic PV version in recipe Marco Garzola
2016-06-16 19:51 ` Christopher Larson
2016-06-16 20:11   ` Marco Garzola
2016-06-17 10:59     ` Marco Garzola
2016-06-17 11:03       ` Marco Garzola

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.