A couple of Toaster data collection fixes
cover A couple of Toaster data collection fixes
The following changes since commit cec33d4fdc05db3a41e978f3a1ab977730c443eb:
user-manual-metadata.xml: Added new section on mapping functions. (2014-04-02 14:15:21 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib paule/toaster-fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/toaster-fixes
Paul Eggleton (2):
toaster: fix help texts not showing for most tasks
toaster: fix mis-detection of targets as images
lib/bb/ui/buildinfohelper.py | 31 +-- .../orm/migrations/0007_auto__add_helptext.py | 214 +++++++++++++++++++++ lib/toaster/orm/models.py | 13 +- 3 files changed, 244 insertions(+), 14 deletions(-) create mode 100644 lib/toaster/orm/migrations/0007_auto__add_helptext.py
Signature · 1 line
1.9.0
PATCH 1/2 toaster: fix help texts not showing for most tasks
These were not being collected properly because we were explicitly excluding variables defined as functions from being stored in the database. We don't want these to be shown in the variables list, and in any case it makes sense for these to be stored elsewhere, so create a separate model to store these.
Fixes [YOCTO #6050].
--- lib/bb/ui/buildinfohelper.py | 23 ++- .../orm/migrations/0007_auto__add_helptext.py | 214 +++++++++++++++++++++ lib/toaster/orm/models.py | 13 +- 3 files changed, 239 insertions(+), 11 deletions(-) create mode 100644 lib/toaster/orm/migrations/0007_auto__add_helptext.py
lib/bb/ui/buildinfohelper.py +14 -9
@@ -25,7 +25,7 @@ import ast os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toaster.toastermain.settings") import toaster.toastermain.settings as toaster_django_settings -from toaster.orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage +from toaster.orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage, HelpText from toaster.orm.models import Target_Image_File from toaster.orm.models import Variable, VariableHistory from toaster.orm.models import Package, Package_File, Target_Installed_Package, Target_File
@@ -445,18 +445,23 @@ class ORMWrapper(object): assert isinstance(build_obj, Build) for k in vardump: + desc = vardump[k]['doc']; + if desc is None: + var_words = [word for word in k.split('_')] + root_var = "_".join([word for word in var_words if word.isupper()]) + if root_var and root_var != k and root_var in vardump: + desc = vardump[root_var]['doc'] + if desc is None: + desc = '' + if desc: + helptext_obj = HelpText.objects.create(build=build_obj, + area=HelpText.VARIABLE, + key=k, + text=desc) if not bool(vardump[k]['func']): value = vardump[k]['v']; if value is None: value = '' - desc = vardump[k]['doc']; - if desc is None: - var_words = [word for word in k.split('_')] - root_var = "_".join([word for word in var_words if word.isupper()]) - if root_var and root_var != k and root_var in vardump: - desc = vardump[root_var]['doc'] - if desc is None: - desc = '' variable_obj = Variable.objects.create( build = build_obj, variable_name = k, variable_value = value,
lib/toaster/orm/migrations/0007_auto__add_helptext.py new file +214 -0
215 lines not on this page · raw message
lib/toaster/orm/models.py +11 -2
@@ -175,9 +175,9 @@ class Task(models.Model): return "Not Executed" def get_description(self): - variable = Variable.objects.filter(variable_name=self.task_name, build = self.build) + helptext = HelpText.objects.filter(key=self.task_name, area=HelpText.VARIABLE, build=self.build) try: - return variable[0].description + return helptext[0].text except IndexError: return ''
@@ -343,6 +343,15 @@ class VariableHistory(models.Model): line_number = models.IntegerField(null=True) operation = models.CharField(max_length=16) +class HelpText(models.Model): + VARIABLE = 0 + HELPTEXT_AREA = ((VARIABLE, 'variable'), ) + + build = models.ForeignKey(Build, related_name='helptext_build') + area = models.IntegerField(choices=HELPTEXT_AREA) + key = models.CharField(max_length=100) + text = models.TextField() + class LogMessage(models.Model): INFO = 0 WARNING = 1
Signature · 1 line
1.9.0
PATCH 2/2 toaster: fix mis-detection of targets as images
In reply to Paul EggletonIf you are using the testimage class then the old test mistook the global inheritance of testimage.bbclass with the recipe inheriting image.bbclass because it was only looking for that at the end of the string.
Also tidy up the code so you an easily tell what it's doing. (The original method may have been more "pythonic", but it does nothing for readability.)
--- lib/bb/ui/buildinfohelper.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
lib/bb/ui/buildinfohelper.py +5 -3
@@ -845,10 +845,12 @@ class BuildInfoHelper(object): recipe_info['bugtracker'] = event._depgraph['pn'][pn]['bugtracker'] recipe_info['file_path'] = file_name recipe = self.orm_wrapper.get_update_recipe_object(recipe_info) + recipe.is_image = False if 'inherits' in event._depgraph['pn'][pn].keys(): - recipe.is_image = True in map(lambda x: x.endswith('image.bbclass'), event._depgraph['pn'][pn]['inherits']) - else: - recipe.is_image = False + for cls in event._depgraph['pn'][pn]['inherits']: + if cls.endswith('/image.bbclass'): + recipe.is_image = True + break if recipe.is_image: for t in self.internal_state['targets']: if pn == t.target:
Signature · 1 line
1.9.0