bitbake.conf, freeze.inc: Add version lockdown implementation and use it by default.
PATCH 1/1 bitbake.conf, freeze.inc: Add version lockdown implementation and use it by default.
For each recipe which completes a task successfully, this emits the current version into ${TMPDIR}/versions.conf as a PREFERRED_VERSION line. ${TMPDIR}/versions.conf and conf/versions.conf are automatically included, in that order, in subsequent builds, to provide more deterinistic builds by default, and to let the user make the lockdown persist via a simple cp command.
Assuming that the latest ncurses in the recipes is 5.7, and that 5.7 is preferred over 5.3 by default given any distro version preferences, if they exist, the following are examples of its behavior:
$ rm -rf tmp $ bitbake ncurses-5.3 $ bitbake -c clean ncurses $ bitbake ncurses # builds ncurses 5.3
$ cp tmp/versions.conf conf/ $ rm -rf tmp $ bitbake ncurses # builds ncurses 5.3
--- conf/bitbake.conf | 1 + conf/freeze.inc | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 0 deletions(-) create mode 100644 conf/freeze.inc
conf/bitbake.conf +1 -0
@@ -618,6 +618,7 @@ OVERRIDES = "local:${MACHINE}:${DISTRO}:${TARGET_OS}:${TARGET_ARCH}:build-${BUIL ################################################################## require conf/collections.inc +require conf/freeze.inc include conf/site.conf include conf/auto.conf include conf/local.conf
conf/freeze.inc new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
1.6.2
Quoted 11 lines · Chris Larson
For each recipe which completes a task successfully, this emits the current version into
${TMPDIR}/versions.confas aPREFERRED_VERSIONline.${TMPDIR}/versions.confandconf/versions.confare automatically included, in that order, in subsequent builds, to provide more deterinistic builds by default, and to let the user make the lockdown persist via a simple cp command.Assuming that the latest ncurses in the recipes is 5.7, and that 5.7 is preferred over 5.3 by default given any distro version preferences, if they exist, the following are examples of its behavior:
Quoted 8 lines
$ rm -rf tmp $ bitbake ncurses-5.3 $ bitbake -c clean ncurses $ bitbake ncurses # builds ncurses 5.3$ cp tmp/versions.conf conf/ $ rm -rf tmp $ bitbake ncurses # builds ncurses 5.3
Very nice! Let me try it here...
Quoted 104 lines
Signed-off-by Chris Larson <[email protected]>--- conf/bitbake.conf | 1 + conf/freeze.inc | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 0 deletions(-) create mode 100644 conf/freeze.incconf/bitbake.conf +1
-0@@ -618,6 +618,7 @@ OVERRIDES = "local:${MACHINE}:${DISTRO}:${TARGET_OS}:${TARGET_ARCH}:build-${BUIL ################################################################## require conf/collections.inc +require conf/freeze.inc include conf/site.conf include conf/auto.conf include conf/local.confconf/freeze.inc new file +71
-0@@ -0,0 +1,71 @@ +# Recipe version "freeze" aka lockdown implementation. +# +# For each recipe which completes a task successfully, this emits the current +# version into ${TMPDIR}/versions.conf as a PREFERRED_VERSION line. +# ${TMPDIR}/versions.conf and conf/versions.conf are automatically included, +# in that order, in subsequent builds, to provide more deterinistic builds by +# default, and to let the user make the lockdown persist via a simple cp +# command. +# +# Assuming that the latest ncurses in the recipes is 5.7, and that 5.7 is +# preferred over 5.3 by default given any distro version preferences, if they +# exist, the following are examples of its behavior: +# +# $ rm -rf tmp +# $ bitbake ncurses-5.3 +# $ bitbake -c clean ncurses +# $ bitbake ncurses # builds ncurses 5.3 +# +# $ cp tmp/versions.conf conf/ +# $ rm -rf tmp +# $ bitbake ncurses # builds ncurses 5.3 + +__FREEZEFN ?= "versions.conf" +__FREEZEFILE = "${TMPDIR}/${__FREEZEFN}" +__FREEZELINE = 'PREFERRED_VERSION_%s = "%s"' +__FREEZELINERE = '^PREFERRED_VERSION_(.*) = "(.*)"$' + +include ${__FREEZEFILE} +include conf/${__FREEZEFN} + +def freeze_add(d): + fn = d.getVar("__FREEZEFILE", 1) + f = open(fn, "a") + f.write("%s\n" % (d.getVar("__FREEZELINE", 1) % (d.getVar("PN", 1), d.getVar("PV", 1)))) + f.close() + +def freeze_finish(d): + import re + + # Cleaning up the freezefile + freezefile = d.getVar("__FREEZEFILE", 1) + verdata = {} + + try: + f = open(freezefile, "r") + except (OSError, IOError): + pass + + regexp = re.compile(d.getVar("__FREEZELINERE", 1)) + for line in f: + m = regexp.match(line) + verdata[m.group(1)] = m.group(2) + f.close() + + fl = d.getVar("__FREEZELINE", 1) + f = open(freezefile, "w") + f.writelines([("%s\n" % (fl % (pn, pv))) for (pn, pv) in verdata.items()]) + f.close() + +addhandler freeze_eventhandler +python freeze_eventhandler () { + from bb.event import BuildCompleted + from bb.build import TaskSucceeded + + if isinstance(e, TaskSucceeded): + freeze_add(e.data) + elif isinstance(e, BuildCompleted): + freeze_finish(e.data) +} + +# vim: set ft=bitbake fenc=utf-8 sts=4 sw=4 et :Signature · 7 lines
1.6.2 _______________________________________________ Openembedded-devel mailing list [email protected] http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Quoted 17 lines · Denys Dmytriyenko
Quoted 16 lines · Chris Larson
For each recipe which completes a task successfully, this emits the current version into
${TMPDIR}/versions.confas aPREFERRED_VERSIONline.${TMPDIR}/versions.confandconf/versions.confare automatically included, in that order, in subsequent builds, to provide more deterinistic builds by default, and to let the user make the lockdown persist via a simple cp command.Assuming that the latest ncurses in the recipes is 5.7, and that 5.7 is preferred over 5.3 by default given any distro version preferences, if they exist, the following are examples of its behavior:
$ rm -rf tmp $ bitbake ncurses-5.3 $ bitbake -c clean ncurses $ bitbake ncurses # builds ncurses 5.3
Quoted 7 lines
Quoted 3 lines
$ cp tmp/versions.conf conf/ $ rm -rf tmp $ bitbake ncurses # builds ncurses 5.3Very nice! Let me try it here...
Quoted 1 line
Signed-off-by Chris Larson <[email protected]>
Chris,
Will you be sending an updated version of the patch, which handles TMPDIR overwritten in local.conf, as we discussed last week? Thanks.
Signature · 1 line
Denys
Quoted 27 lines · Denys Dmytriyenko
Quoted 25 lines · Denys Dmytriyenko
Quoted 11 lines · Chris Larson
For each recipe which completes a task successfully, this emits the current version into
${TMPDIR}/versions.confas aPREFERRED_VERSIONline.${TMPDIR}/versions.confandconf/versions.confare automatically included, in that order, in subsequent builds, to provide more deterinistic builds by default, and to let the user make the lockdown persist via a simple cp command.Assuming that the latest ncurses in the recipes is 5.7, and that 5.7 is preferred over 5.3 by default given any distro version preferences, if they exist, the following are examples of its behavior:
Quoted 9 lines
$ rm -rf tmp $ bitbake ncurses-5.3 $ bitbake -c clean ncurses $ bitbake ncurses # builds ncurses 5.3$ cp tmp/versions.conf conf/ $ rm -rf tmp $ bitbake ncurses # builds ncurses 5.3Very nice! Let me try it here...
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Signed-off-by Chris Larson <[email protected]>Chris,
Will you be sending an updated version of the patch, which handles TMPDIR overwritten in local.conf, as we discussed last week? Thanks.
Yep, I'm going to make the thing opt-in rather than default, since apparently not everyone wants it as default behavior, and change it to use ?= assignments, and leave it at that.
-Chris
Quoted 35 lines · Christopher Larson
Quoted 34 lines · Denys Dmytriyenko
Quoted 31 lines · Denys Dmytriyenko
Quoted 15 lines · Chris Larson
For each recipe which completes a task successfully, this emits the current
version into${TMPDIR}/versions.confas aPREFERRED_VERSIONline.${TMPDIR}/versions.confandconf/versions.confare automatically included,
in that order, in subsequent builds, to provide more deterinistic builds by
default, and to let the user make the lockdown persist via a simple cp command.Assuming that the latest ncurses in the recipes is 5.7, and that 5.7 is preferred over 5.3 by default given any distro version preferences, if they
exist, the following are examples of its behavior:Quoted 9 lines
$ rm -rf tmp $ bitbake ncurses-5.3 $ bitbake -c clean ncurses $ bitbake ncurses # builds ncurses 5.3$ cp tmp/versions.conf conf/ $ rm -rf tmp $ bitbake ncurses # builds ncurses 5.3Very nice! Let me try it here...
Quoted 2 lines
Signed-off-by Chris Larson <[email protected]>
Quoted 7 lines
Quoted 4 lines
Chris,
Will you be sending an updated version of the patch, which handles TMPDIR overwritten in local.conf, as we discussed last week? Thanks.
Yep, I'm going to make the thing opt-in rather than default, since apparently not everyone wants it as default behavior, and change it to use ?= assignments, and leave it at that.
Hmm, I'm using the updated version of freeze.inc with weak assignments and there seems to be an issue with picking the correct version. Or maybe I'm doing something wrong...
I have a customized u-boot recipe, based on 1.3.4, which sets PV as "1.3.4" and PR as "myX.Y.Z". Having 2 revisions of the above recipe with X.Y.Z = "2.0.0" and "2.1.0", by default BitBake picks the correct one with higher PR - i.e. "1.3.4-my2.1.0". Then when freeze.inc sets PREFERRED_VERSION to "1.3.4", it starts picking the lowest version, i.e. "1.3.4-my2.0.0". What gives? Any ideas?
Signature · 1 line
Denys
Quoted 6 lines · Chris Larson
For each recipe which completes a task successfully, this emits the current version into
${TMPDIR}/versions.confas aPREFERRED_VERSIONline.${TMPDIR}/versions.confandconf/versions.confare automatically included, in that order, in subsequent builds, to provide more deterinistic builds by default, and to let the user make the lockdown persist via a simple cp command...
Excellent! This is much needed as a feature. The usage model seems to be a very reasonable one, and would tend to be consistent with what users sort of expect for a workflow.
I say "sort of expect" because I think they would rather see the management of the versions.conf file be done by bitbake. For example, the "bitbake crystallize" command (to choose a name) might do no build at all, but just generate, or re-generate, the versions.conf file. But that's a trivial point; they'll have to remember to cp or rm versions.conf as necessary themselves.
The only big concern that I have is that this is really quite a drastic change in behavior for the "cookbook-type" OE user community out there (the folks who have memorized a set of procedures to build their distro images without any real understanding of how it works). How do we propose to roll out this change?
-Mike (mwester)
Quoted 2 lines
How do we
propose to roll out this change?
What about adding a -u (update) option? This would just give old behaviour.
My 2 (euro)cents
Andrea
Quoted 4 lines · Andrea Adami
Quoted 2 lines
How do we
propose to roll out this change?What about adding a -u (update) option? This would just give old behaviour.
I don't understand what you'd want -u to do? This patch doesn't modify bitbake, so it doesn't mess with commandline arguments at all. Are you arguing for a variable which could be set to disable this functionality? That would seem like a reasonable thing to do, though I doubt anyone would actually want to disable it, once they get used to it.
Signature · 7 lines
Chris Larson clarson at kergoth dot com clarson at mvista dot com Founder - BitBake, OpenEmbedded, OpenZaurus Maintainer - Tslib Software Engineer MontaVista Software, Inc.
Quoted 4 lines
Quoted 1 line
What about adding a -u (update) option? This would just give old behaviour.
I don't understand what you'd want -u to do? This patch doesn't modify bitbake,
Why? Taboo?
Adding the 'update' option to bitbake would be logic at this point. Buildscripts would just have to change to 'bitbake -u'.
(see Gentoo's emerge)
Regards
Andrea
Quoted 10 lines · Andrea Adami
Quoted 4 lines
Quoted 1 line
What about adding a -u (update) option? This would just give old behaviour.
I don't understand what you'd want -u to do? This patch doesn't modify bitbake,
Why? Taboo?
Adding the 'update' option to bitbake would be logic at this point. Buildscripts would just have to change to 'bitbake -u'.(see Gentoo's emerge)
I guess since bitbake is not part of OE (unlike Gentoo's emerge/portage), it is less transparent for introducing new features like this one...
Signature · 1 line
Denys
Quoted 9 lines · Mike Westerhof (mwester)
I say "sort of expect" because I think they would rather see the management of the versions.conf file be done by bitbake. For example, the "bitbake crystallize" command (to choose a name) might do no build at all, but just generate, or re-generate, the versions.conf file. But that's a trivial point; they'll have to remember to cp or rm versions.conf as necessary themselves.
Holger (zecke) wrote exactly this task for openmoko, it is most likely still in the openmoko git tree.
Graeme
Quoted 12 lines · Mike Westerhof (mwester)
Quoted 6 lines · Chris Larson
For each recipe which completes a task successfully, this emits the current version into
${TMPDIR}/versions.confas aPREFERRED_VERSIONline.${TMPDIR}/versions.confandconf/versions.confare automatically included, in that order, in subsequent builds, to provide more deterinistic builds by default, and to let the user make the lockdown persist via a simple cp command...Excellent! This is much needed as a feature. The usage model seems to be a very reasonable one, and would tend to be consistent with what users sort of expect for a workflow.
Quoted 6 lines
I say "sort of expect" because I think they would rather see the management of the versions.conf file be done by bitbake. For example, the "bitbake crystallize" command (to choose a name) might do no build at all, but just generate, or re-generate, the versions.conf file. But that's a trivial point; they'll have to remember to cp or rm versions.conf as necessary themselves.
Aye, Phil Blundell and I were discussing this on IRC yesterday. This is mostly a hack around the fact that bitbake should never have defaulted to the latest version of a package to begin with. But in order to fix that, we'd need a new/better mechanism for the user to express what they want in a build.
Quoted 5 lines
The only big concern that I have is that this is really quite a drastic change in behavior for the "cookbook-type" OE user community out there (the folks who have memorized a set of procedures to build their distro images without any real understanding of how it works). How do we propose to roll out this change?
It does change behavior, but only within the context of a single tmp directory existance. I doubt anyone in particular relies on their build suddenly switching to a newer version of something when the newer version shows up in the repository, but perhaps they do. I expect the biggest change is that doing "bitbake foo-1.0" rather than the default of foo 1.2 would result in it continuing to build foo 1.0 going forward, rather than that being a temporary change.
Honestly, I'm not sure how best to smoothly roll something like this out. I don't think you can make it any less intrusive for a default behavior without modifying bitbake. Obviously, we could make it not be default, but I don't know how I feel about that, either. I guess thatd be best, to avoid breaking people's scripts, but I still quite dislike the current bitbake version behavior, personally.
Anyone have any ideas on this?
Signature · 7 lines
Chris Larson clarson at kergoth dot com clarson at mvista dot com Founder - BitBake, OpenEmbedded, OpenZaurus Maintainer - Tslib Software Engineer MontaVista Software, Inc.
On Fri, May 15, 2009 at 08:08:29AM -0700, Chris Larson wrote:
[snip]
Quoted 4 lines
It does change behavior, but only within the context of a single tmp directory existance. I doubt anyone in particular relies on their build suddenly switching to a newer version of something when the newer version shows up in the repository, but perhaps they do. I
People with buildbots (hrw, myself, I'm sure others) do, for our incremental builds. But of course, the reason for incremental builds is the behavior that this would change.
Signature · 1 line
Tom Rini
Quoted 6 lines · Chris Larson
For each recipe which completes a task successfully, this emits the current version into
${TMPDIR}/versions.confas aPREFERRED_VERSIONline.${TMPDIR}/versions.confandconf/versions.confare automatically included, in that order, in subsequent builds, to provide more deterinistic builds by default, and to let the user make the lockdown persist via a simple cp command.
Hi Chris,
If a distro doesn't lock down a particular version of a package, I figure after a "git pull" I'll be building the latest version of everything. At least, if I do a "bitbake -c clean somepkg" followed by a "bitbake somepkg", I'll get the latest version of somepkg.
If I understand the patch correctly, that won't happen anymore unless I remember to remove tmp/versions.conf. It adds an extra step to the process when one developer is using another's package.
I can see it leading to confusion between developers. Any time there's a multi-step process, humans will find a way to forget a step. :)
What's the problem the versions.conf is meant to solve? I would think if I'm doing a git pull and then rebuilding a package, it's because I want to get the latest version, but I think I'm missing something here.
Mike