bitbake: toaster: do not create duplicate HelpText objects
buildinfohelper code expects only one HelpText object per build/variable/description. Current code creates more than one such an object, which causes toastergui to crash with this exception: MultipleObjectsReturned: get() returned more than one HelpText -- it returned 2! Used git_or_create API to ensure that only one HelpText object is created. (Bitbake rev: e9b46803eb6f1f4044919abf90c8aeb3536e73ed) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
4c1e5ec29a
commit
57e5f24e57
|
@ -700,7 +700,6 @@ class ORMWrapper(object):
|
||||||
def save_build_variables(self, build_obj, vardump):
|
def save_build_variables(self, build_obj, vardump):
|
||||||
assert isinstance(build_obj, Build)
|
assert isinstance(build_obj, Build)
|
||||||
|
|
||||||
helptext_objects = []
|
|
||||||
for k in vardump:
|
for k in vardump:
|
||||||
desc = vardump[k]['doc']
|
desc = vardump[k]['doc']
|
||||||
if desc is None:
|
if desc is None:
|
||||||
|
@ -711,10 +710,9 @@ class ORMWrapper(object):
|
||||||
if desc is None:
|
if desc is None:
|
||||||
desc = ''
|
desc = ''
|
||||||
if len(desc):
|
if len(desc):
|
||||||
helptext_objects.append(HelpText(build=build_obj,
|
HelpText.objects.get_or_create(build=build_obj,
|
||||||
area=HelpText.VARIABLE,
|
area=HelpText.VARIABLE,
|
||||||
key=k,
|
key=k, text=desc)
|
||||||
text=desc))
|
|
||||||
if not bool(vardump[k]['func']):
|
if not bool(vardump[k]['func']):
|
||||||
value = vardump[k]['v']
|
value = vardump[k]['v']
|
||||||
if value is None:
|
if value is None:
|
||||||
|
@ -734,8 +732,6 @@ class ORMWrapper(object):
|
||||||
if len(varhist_objects):
|
if len(varhist_objects):
|
||||||
VariableHistory.objects.bulk_create(varhist_objects)
|
VariableHistory.objects.bulk_create(varhist_objects)
|
||||||
|
|
||||||
HelpText.objects.bulk_create(helptext_objects)
|
|
||||||
|
|
||||||
|
|
||||||
class MockEvent(object):
|
class MockEvent(object):
|
||||||
""" This object is used to create event, for which normal event-processing methods can
|
""" This object is used to create event, for which normal event-processing methods can
|
||||||
|
|
Loading…
Reference in New Issue