* [PATCH] HOB: MACHINE should be saved in conf files using ?=
@ 2013-09-27 14:10 Valentin Popa
2013-09-30 7:34 ` cristiana.voicu
0 siblings, 1 reply; 5+ messages in thread
From: Valentin Popa @ 2013-09-27 14:10 UTC (permalink / raw)
To: bitbake-devel
MACHINE var is saved using early assignment operator.
Calling MACHINE=x bitbake core-image-... works properly.
Comment "#added by bitbake" is replaced with "#added by hob".
[YOCTO #5070]
Signed-off-by: Valentin Popa <valentin.popa@intel.com>
---
bitbake/lib/bb/cooker.py | 17 ++++++++++-------
bitbake/lib/bb/ui/crumbs/builder.py | 2 +-
bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 7 ++++++-
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index ff2af69..ce7ca43 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -193,7 +193,10 @@ class BBCooker:
if op == "append":
self.appendConfigurationVar(var, val, default_file)
elif op == "set":
- self.saveConfigurationVar(var, val, default_file)
+ self.saveConfigurationVar(var, val, default_file, "=")
+ elif op == "earlyAssign":
+ self.saveConfigurationVar(var, val, default_file, "?=")
+
def appendConfigurationVar(self, var, val, default_file):
#add append var operation to the end of default_file
@@ -207,7 +210,7 @@ class BBCooker:
for c in contents:
total += c
- total += "#added by bitbake"
+ total += "#added by hob"
total += "\n%s += \"%s\"\n" % (var, val)
with open(default_file, 'w') as f:
@@ -218,7 +221,7 @@ class BBCooker:
loginfo = {"op":append, "file":default_file, "line":total.count("\n")}
self.data.appendVar(var, val, **loginfo)
- def saveConfigurationVar(self, var, val, default_file):
+ def saveConfigurationVar(self, var, val, default_file, op):
replaced = False
#do not save if nothing changed
@@ -260,8 +263,8 @@ class BBCooker:
#check if the variable was saved before in the same way
#if true it replace the place where the variable was declared
#else it comments it
- if contents[begin_line-1]== "#added by bitbake\n":
- contents[begin_line] = "%s = \"%s\"\n" % (var, val)
+ if contents[begin_line-1]== "#added by hob\n":
+ contents[begin_line] = "%s %s \"%s\"\n" % (var, op, val)
replaced = True
else:
for ii in range(begin_line, end_line):
@@ -290,8 +293,8 @@ class BBCooker:
total += c
#add the variable on a single line, to be easy to replace the second time
- total += "\n#added by bitbake"
- total += "\n%s = \"%s\"\n" % (var, val)
+ total += "\n#added by hob"
+ total += "\n%s %s \"%s\"\n" % (var, op, val)
with open(default_file, 'w') as f:
f.write(total)
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 86fdbfe..f9fd15a 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -197,7 +197,7 @@ class Configuration:
handler.set_var_in_file("BBLAYERS", self.layers, "bblayers.conf")
# local.conf
if not defaults:
- handler.set_var_in_file("MACHINE", self.curr_mach, "local.conf")
+ handler.early_assign_var_in_file("MACHINE", self.curr_mach, "local.conf")
handler.set_var_in_file("DISTRO", self.curr_distro, "local.conf")
handler.set_var_in_file("DL_DIR", self.dldir, "local.conf")
handler.set_var_in_file("SSTATE_DIR", self.sstatedir, "local.conf")
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index ef74e56..3f5beba 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -315,7 +315,7 @@ class HobHandler(gobject.GObject):
def set_machine(self, machine):
if machine:
- self.set_var_in_file("MACHINE", machine, "local.conf")
+ self.early_assign_var_in_file("MACHINE", machine, "local.conf")
def set_sdk_machine(self, sdk_machine):
self.set_var_in_file("SDKMACHINE", sdk_machine, "local.conf")
@@ -472,6 +472,11 @@ class HobHandler(gobject.GObject):
self.server.runCommand(["setVarFile", var, val, default_file, "set"])
self.runCommand(["disableDataTracking"])
+ def early_assign_var_in_file(self, var, val, default_file=None):
+ self.runCommand(["enableDataTracking"])
+ self.server.runCommand(["setVarFile", var, val, default_file, "earlyAssign"])
+ self.runCommand(["disableDataTracking"])
+
def append_var_in_file(self, var, val, default_file=None):
self.server.runCommand(["setVarFile", var, val, default_file, "append"])
--
1.8.1.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] HOB: MACHINE should be saved in conf files using ?=
2013-09-27 14:10 [PATCH] HOB: MACHINE should be saved in conf files using ?= Valentin Popa
@ 2013-09-30 7:34 ` cristiana.voicu
2013-10-03 13:27 ` cristiana.voicu
0 siblings, 1 reply; 5+ messages in thread
From: cristiana.voicu @ 2013-09-30 7:34 UTC (permalink / raw)
To: Valentin Popa; +Cc: bitbake-devel
On 09/27/2013 05:10 PM, Valentin Popa wrote:
> MACHINE var is saved using early assignment operator.
> Calling MACHINE=x bitbake core-image-... works properly.
> Comment "#added by bitbake" is replaced with "#added by hob".
>
> [YOCTO #5070]
> Signed-off-by: Valentin Popa <valentin.popa@intel.com>
> ---
> bitbake/lib/bb/cooker.py | 17 ++++++++++-------
> bitbake/lib/bb/ui/crumbs/builder.py | 2 +-
> bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 7 ++++++-
> 3 files changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
> index ff2af69..ce7ca43 100644
> --- a/bitbake/lib/bb/cooker.py
> +++ b/bitbake/lib/bb/cooker.py
> @@ -193,7 +193,10 @@ class BBCooker:
> if op == "append":
> self.appendConfigurationVar(var, val, default_file)
> elif op == "set":
> - self.saveConfigurationVar(var, val, default_file)
> + self.saveConfigurationVar(var, val, default_file, "=")
> + elif op == "earlyAssign":
> + self.saveConfigurationVar(var, val, default_file, "?=")
> +
>
> def appendConfigurationVar(self, var, val, default_file):
> #add append var operation to the end of default_file
> @@ -207,7 +210,7 @@ class BBCooker:
> for c in contents:
> total += c
>
> - total += "#added by bitbake"
> + total += "#added by hob"
> total += "\n%s += \"%s\"\n" % (var, val)
>
> with open(default_file, 'w') as f:
> @@ -218,7 +221,7 @@ class BBCooker:
> loginfo = {"op":append, "file":default_file, "line":total.count("\n")}
> self.data.appendVar(var, val, **loginfo)
>
> - def saveConfigurationVar(self, var, val, default_file):
> + def saveConfigurationVar(self, var, val, default_file, op):
>
> replaced = False
> #do not save if nothing changed
> @@ -260,8 +263,8 @@ class BBCooker:
> #check if the variable was saved before in the same way
> #if true it replace the place where the variable was declared
> #else it comments it
> - if contents[begin_line-1]== "#added by bitbake\n":
> - contents[begin_line] = "%s = \"%s\"\n" % (var, val)
> + if contents[begin_line-1]== "#added by hob\n":
> + contents[begin_line] = "%s %s \"%s\"\n" % (var, op, val)
> replaced = True
> else:
> for ii in range(begin_line, end_line):
> @@ -290,8 +293,8 @@ class BBCooker:
> total += c
>
> #add the variable on a single line, to be easy to replace the second time
> - total += "\n#added by bitbake"
> - total += "\n%s = \"%s\"\n" % (var, val)
> + total += "\n#added by hob"
> + total += "\n%s %s \"%s\"\n" % (var, op, val)
>
> with open(default_file, 'w') as f:
> f.write(total)
> diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
> index 86fdbfe..f9fd15a 100755
> --- a/bitbake/lib/bb/ui/crumbs/builder.py
> +++ b/bitbake/lib/bb/ui/crumbs/builder.py
> @@ -197,7 +197,7 @@ class Configuration:
> handler.set_var_in_file("BBLAYERS", self.layers, "bblayers.conf")
> # local.conf
> if not defaults:
> - handler.set_var_in_file("MACHINE", self.curr_mach, "local.conf")
> + handler.early_assign_var_in_file("MACHINE", self.curr_mach, "local.conf")
> handler.set_var_in_file("DISTRO", self.curr_distro, "local.conf")
> handler.set_var_in_file("DL_DIR", self.dldir, "local.conf")
> handler.set_var_in_file("SSTATE_DIR", self.sstatedir, "local.conf")
> diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> index ef74e56..3f5beba 100644
> --- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> +++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> @@ -315,7 +315,7 @@ class HobHandler(gobject.GObject):
>
> def set_machine(self, machine):
> if machine:
> - self.set_var_in_file("MACHINE", machine, "local.conf")
> + self.early_assign_var_in_file("MACHINE", machine, "local.conf")
>
> def set_sdk_machine(self, sdk_machine):
> self.set_var_in_file("SDKMACHINE", sdk_machine, "local.conf")
> @@ -472,6 +472,11 @@ class HobHandler(gobject.GObject):
> self.server.runCommand(["setVarFile", var, val, default_file, "set"])
> self.runCommand(["disableDataTracking"])
>
> + def early_assign_var_in_file(self, var, val, default_file=None):
> + self.runCommand(["enableDataTracking"])
> + self.server.runCommand(["setVarFile", var, val, default_file, "earlyAssign"])
> + self.runCommand(["disableDataTracking"])
> +
> def append_var_in_file(self, var, val, default_file=None):
> self.server.runCommand(["setVarFile", var, val, default_file, "append"])
>
Looks good to me.
Cristiana
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] HOB: MACHINE should be saved in conf files using ?=
2013-09-30 7:34 ` cristiana.voicu
@ 2013-10-03 13:27 ` cristiana.voicu
2013-10-04 13:37 ` Richard Purdie
0 siblings, 1 reply; 5+ messages in thread
From: cristiana.voicu @ 2013-10-03 13:27 UTC (permalink / raw)
To: Valentin Popa; +Cc: bitbake-devel
On 09/30/2013 10:34 AM, cristiana.voicu wrote:
> On 09/27/2013 05:10 PM, Valentin Popa wrote:
>> MACHINE var is saved using early assignment operator.
>> Calling MACHINE=x bitbake core-image-... works properly.
>> Comment "#added by bitbake" is replaced with "#added by hob".
>>
>> [YOCTO #5070]
>> Signed-off-by: Valentin Popa <valentin.popa@intel.com>
>> ---
>> bitbake/lib/bb/cooker.py | 17 ++++++++++-------
>> bitbake/lib/bb/ui/crumbs/builder.py | 2 +-
>> bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 7 ++++++-
>> 3 files changed, 17 insertions(+), 9 deletions(-)
>>
>> diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
>> index ff2af69..ce7ca43 100644
>> --- a/bitbake/lib/bb/cooker.py
>> +++ b/bitbake/lib/bb/cooker.py
>> @@ -193,7 +193,10 @@ class BBCooker:
>> if op == "append":
>> self.appendConfigurationVar(var, val, default_file)
>> elif op == "set":
>> - self.saveConfigurationVar(var, val, default_file)
>> + self.saveConfigurationVar(var, val, default_file, "=")
>> + elif op == "earlyAssign":
>> + self.saveConfigurationVar(var, val, default_file, "?=")
>> +
>> def appendConfigurationVar(self, var, val, default_file):
>> #add append var operation to the end of default_file
>> @@ -207,7 +210,7 @@ class BBCooker:
>> for c in contents:
>> total += c
>> - total += "#added by bitbake"
>> + total += "#added by hob"
>> total += "\n%s += \"%s\"\n" % (var, val)
>> with open(default_file, 'w') as f:
>> @@ -218,7 +221,7 @@ class BBCooker:
>> loginfo = {"op":append, "file":default_file,
>> "line":total.count("\n")}
>> self.data.appendVar(var, val, **loginfo)
>> - def saveConfigurationVar(self, var, val, default_file):
>> + def saveConfigurationVar(self, var, val, default_file, op):
>> replaced = False
>> #do not save if nothing changed
>> @@ -260,8 +263,8 @@ class BBCooker:
>> #check if the variable was saved before in the
>> same way
>> #if true it replace the place where the
>> variable was declared
>> #else it comments it
>> - if contents[begin_line-1]== "#added by bitbake\n":
>> - contents[begin_line] = "%s = \"%s\"\n" %
>> (var, val)
>> + if contents[begin_line-1]== "#added by hob\n":
>> + contents[begin_line] = "%s %s \"%s\"\n" %
>> (var, op, val)
>> replaced = True
>> else:
>> for ii in range(begin_line, end_line):
>> @@ -290,8 +293,8 @@ class BBCooker:
>> total += c
>> #add the variable on a single line, to be easy to
>> replace the second time
>> - total += "\n#added by bitbake"
>> - total += "\n%s = \"%s\"\n" % (var, val)
>> + total += "\n#added by hob"
>> + total += "\n%s %s \"%s\"\n" % (var, op, val)
>> with open(default_file, 'w') as f:
>> f.write(total)
>> diff --git a/bitbake/lib/bb/ui/crumbs/builder.py
>> b/bitbake/lib/bb/ui/crumbs/builder.py
>> index 86fdbfe..f9fd15a 100755
>> --- a/bitbake/lib/bb/ui/crumbs/builder.py
>> +++ b/bitbake/lib/bb/ui/crumbs/builder.py
>> @@ -197,7 +197,7 @@ class Configuration:
>> handler.set_var_in_file("BBLAYERS", self.layers,
>> "bblayers.conf")
>> # local.conf
>> if not defaults:
>> - handler.set_var_in_file("MACHINE", self.curr_mach,
>> "local.conf")
>> + handler.early_assign_var_in_file("MACHINE",
>> self.curr_mach, "local.conf")
>> handler.set_var_in_file("DISTRO", self.curr_distro,
>> "local.conf")
>> handler.set_var_in_file("DL_DIR", self.dldir, "local.conf")
>> handler.set_var_in_file("SSTATE_DIR", self.sstatedir,
>> "local.conf")
>> diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
>> b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
>> index ef74e56..3f5beba 100644
>> --- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
>> +++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
>> @@ -315,7 +315,7 @@ class HobHandler(gobject.GObject):
>> def set_machine(self, machine):
>> if machine:
>> - self.set_var_in_file("MACHINE", machine, "local.conf")
>> + self.early_assign_var_in_file("MACHINE", machine,
>> "local.conf")
>> def set_sdk_machine(self, sdk_machine):
>> self.set_var_in_file("SDKMACHINE", sdk_machine, "local.conf")
>> @@ -472,6 +472,11 @@ class HobHandler(gobject.GObject):
>> self.server.runCommand(["setVarFile", var, val,
>> default_file, "set"])
>> self.runCommand(["disableDataTracking"])
>> + def early_assign_var_in_file(self, var, val, default_file=None):
>> + self.runCommand(["enableDataTracking"])
>> + self.server.runCommand(["setVarFile", var, val,
>> default_file, "earlyAssign"])
>> + self.runCommand(["disableDataTracking"])
>> +
>> def append_var_in_file(self, var, val, default_file=None):
>> self.server.runCommand(["setVarFile", var, val,
>> default_file, "append"])
> Looks good to me.
> Cristiana
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
Hi Valentin,
I know I replied with an ack for this patch, but working on a similar
bug I realized that replacing the comment "total += "\n#added by
bitbake" with total += "\n#added by hob" in bitbake code is not ok. I
think it will be better to give as argument the comment string, in order
to keep this method reusable in other ui.
Cristiana
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] HOB: MACHINE should be saved in conf files using ?=
2013-10-03 13:27 ` cristiana.voicu
@ 2013-10-04 13:37 ` Richard Purdie
2013-10-04 16:29 ` Valentin Popa
0 siblings, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2013-10-04 13:37 UTC (permalink / raw)
To: cristiana.voicu; +Cc: bitbake-devel
On Thu, 2013-10-03 at 16:27 +0300, cristiana.voicu wrote:
> I know I replied with an ack for this patch, but working on a similar
> bug I realized that replacing the comment "total += "\n#added by
> bitbake" with total += "\n#added by hob" in bitbake code is not ok. I
> think it will be better to give as argument the comment string, in order
> to keep this method reusable in other ui.
To make things simpler can someone send a follow up patch to make this a
parameter please?
Cheers,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] HOB: MACHINE should be saved in conf files using ?=
2013-10-04 13:37 ` Richard Purdie
@ 2013-10-04 16:29 ` Valentin Popa
0 siblings, 0 replies; 5+ messages in thread
From: Valentin Popa @ 2013-10-04 16:29 UTC (permalink / raw)
To: Richard Purdie, cristiana.voicu; +Cc: bitbake-devel
On 10/04/2013 04:37 PM, Richard Purdie wrote:
> On Thu, 2013-10-03 at 16:27 +0300, cristiana.voicu wrote:
>> I know I replied with an ack for this patch, but working on a similar
>> bug I realized that replacing the comment "total += "\n#added by
>> bitbake" with total += "\n#added by hob" in bitbake code is not ok. I
>> think it will be better to give as argument the comment string, in order
>> to keep this method reusable in other ui.
> To make things simpler can someone send a follow up patch to make this a
> parameter please?
>
> Cheers,
>
> Richard
>
In case of multiple UI's in case some of them assigns(or earlyassigns) a
var then another one wants to do the same thing, which lines do we
cancel/comment in local.conf ? Do we let configurations from different
UIs to coexist in local.conf?
(with the respect of the code from cooker.py:
#check if the variable was saved before in the same way
#if true it replace the place where the variable was
declared
#else it comments it
if contents[begin_line-1]== "#added by hob\n":
contents[begin_line] = "%s %s \"%s\"\n" % (var,
op, val)
replaced = True
else:
for ii in range(begin_line, end_line):
contents[ii] = "#" + contents[ii]
)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-10-04 16:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-27 14:10 [PATCH] HOB: MACHINE should be saved in conf files using ?= Valentin Popa
2013-09-30 7:34 ` cristiana.voicu
2013-10-03 13:27 ` cristiana.voicu
2013-10-04 13:37 ` Richard Purdie
2013-10-04 16:29 ` Valentin Popa
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.