summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2014-04-03 11:16:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-04-04 11:53:52 +0100
commit432505d5636a0303dfe3db26db15055d98624dc8 (patch)
treef841e4d190a1a6e11cb29f4fd11e95e9983f2d5c /bitbake/lib
parentfee85f01bb1d8b2019fea17afba36ad1846c42a7 (diff)
downloadpoky-432505d5636a0303dfe3db26db15055d98624dc8.tar.gz
bitbake: 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]. (Bitbake rev: 0d76a5461ce4bd554ff70a465064969e53edf0a4) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py23
-rw-r--r--bitbake/lib/toaster/orm/migrations/0007_auto__add_helptext.py214
-rw-r--r--bitbake/lib/toaster/orm/models.py13
3 files changed, 239 insertions, 11 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index f448c8448b..2a9e0981c7 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -25,7 +25,7 @@ import ast
25os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toaster.toastermain.settings") 25os.environ.setdefault("DJANGO_SETTINGS_MODULE", "toaster.toastermain.settings")
26 26
27import toaster.toastermain.settings as toaster_django_settings 27import toaster.toastermain.settings as toaster_django_settings
28from toaster.orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage 28from toaster.orm.models import Build, Task, Recipe, Layer_Version, Layer, Target, LogMessage, HelpText
29from toaster.orm.models import Target_Image_File 29from toaster.orm.models import Target_Image_File
30from toaster.orm.models import Variable, VariableHistory 30from toaster.orm.models import Variable, VariableHistory
31from toaster.orm.models import Package, Package_File, Target_Installed_Package, Target_File 31from toaster.orm.models import Package, Package_File, Target_Installed_Package, Target_File
@@ -445,18 +445,23 @@ class ORMWrapper(object):
445 assert isinstance(build_obj, Build) 445 assert isinstance(build_obj, Build)
446 446
447 for k in vardump: 447 for k in vardump:
448 desc = vardump[k]['doc'];
449 if desc is None:
450 var_words = [word for word in k.split('_')]
451 root_var = "_".join([word for word in var_words if word.isupper()])
452 if root_var and root_var != k and root_var in vardump:
453 desc = vardump[root_var]['doc']
454 if desc is None:
455 desc = ''
456 if desc:
457 helptext_obj = HelpText.objects.create(build=build_obj,
458 area=HelpText.VARIABLE,
459 key=k,
460 text=desc)
448 if not bool(vardump[k]['func']): 461 if not bool(vardump[k]['func']):
449 value = vardump[k]['v']; 462 value = vardump[k]['v'];
450 if value is None: 463 if value is None:
451 value = '' 464 value = ''
452 desc = vardump[k]['doc'];
453 if desc is None:
454 var_words = [word for word in k.split('_')]
455 root_var = "_".join([word for word in var_words if word.isupper()])
456 if root_var and root_var != k and root_var in vardump:
457 desc = vardump[root_var]['doc']
458 if desc is None:
459 desc = ''
460 variable_obj = Variable.objects.create( build = build_obj, 465 variable_obj = Variable.objects.create( build = build_obj,
461 variable_name = k, 466 variable_name = k,
462 variable_value = value, 467 variable_value = value,
diff --git a/bitbake/lib/toaster/orm/migrations/0007_auto__add_helptext.py b/bitbake/lib/toaster/orm/migrations/0007_auto__add_helptext.py
new file mode 100644
index 0000000000..9c73d1b8ec
--- /dev/null
+++ b/bitbake/lib/toaster/orm/migrations/0007_auto__add_helptext.py
@@ -0,0 +1,214 @@
1# -*- coding: utf-8 -*-
2from south.utils import datetime_utils as datetime
3from south.db import db
4from south.v2 import SchemaMigration
5from django.db import models
6
7
8class Migration(SchemaMigration):
9
10 def forwards(self, orm):
11 # Adding model 'HelpText'
12 db.create_table(u'orm_helptext', (
13 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14 ('build', self.gf('django.db.models.fields.related.ForeignKey')(related_name='helptext_build', to=orm['orm.Build'])),
15 ('area', self.gf('django.db.models.fields.IntegerField')()),
16 ('key', self.gf('django.db.models.fields.CharField')(max_length=100)),
17 ('text', self.gf('django.db.models.fields.TextField')()),
18 ))
19 db.send_create_signal(u'orm', ['HelpText'])
20
21
22 def backwards(self, orm):
23 # Deleting model 'HelpText'
24 db.delete_table(u'orm_helptext')
25
26
27 models = {
28 u'orm.build': {
29 'Meta': {'object_name': 'Build'},
30 'bitbake_version': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
31 'build_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
32 'completed_on': ('django.db.models.fields.DateTimeField', [], {}),
33 'cooker_log_path': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
34 'distro': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
35 'distro_version': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
36 'errors_no': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
37 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
38 'machine': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
39 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
40 'started_on': ('django.db.models.fields.DateTimeField', [], {}),
41 'timespent': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
42 'warnings_no': ('django.db.models.fields.IntegerField', [], {'default': '0'})
43 },
44 u'orm.helptext': {
45 'Meta': {'object_name': 'HelpText'},
46 'area': ('django.db.models.fields.IntegerField', [], {}),
47 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'helptext_build'", 'to': u"orm['orm.Build']"}),
48 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
49 'key': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
50 'text': ('django.db.models.fields.TextField', [], {})
51 },
52 u'orm.layer': {
53 'Meta': {'object_name': 'Layer'},
54 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
55 'layer_index_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
56 'local_path': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
57 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
58 },
59 u'orm.layer_version': {
60 'Meta': {'object_name': 'Layer_Version'},
61 'branch': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
62 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'layer_version_build'", 'to': u"orm['orm.Build']"}),
63 'commit': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
64 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
65 'layer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'layer_version_layer'", 'to': u"orm['orm.Layer']"}),
66 'priority': ('django.db.models.fields.IntegerField', [], {})
67 },
68 u'orm.logmessage': {
69 'Meta': {'object_name': 'LogMessage'},
70 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
71 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
72 'level': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
73 'lineno': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
74 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
75 'pathname': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
76 'task': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Task']", 'null': 'True', 'blank': 'True'})
77 },
78 u'orm.package': {
79 'Meta': {'object_name': 'Package'},
80 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
81 'description': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
82 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
83 'installed_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'}),
84 'installed_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
85 'license': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
86 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
87 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Recipe']", 'null': 'True'}),
88 'revision': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
89 'section': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
90 'size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
91 'summary': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
92 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
93 },
94 u'orm.package_dependency': {
95 'Meta': {'object_name': 'Package_Dependency'},
96 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
97 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_target'", 'to': u"orm['orm.Package']"}),
98 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
99 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_source'", 'to': u"orm['orm.Package']"}),
100 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']", 'null': 'True'})
101 },
102 u'orm.package_file': {
103 'Meta': {'object_name': 'Package_File'},
104 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
105 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'buildfilelist_package'", 'to': u"orm['orm.Package']"}),
106 'path': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
107 'size': ('django.db.models.fields.IntegerField', [], {})
108 },
109 u'orm.recipe': {
110 'Meta': {'object_name': 'Recipe'},
111 'bugtracker': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
112 'description': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
113 'file_path': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
114 'homepage': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
115 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
116 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'recipe_layer_version'", 'to': u"orm['orm.Layer_Version']"}),
117 'license': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
118 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
119 'section': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
120 'summary': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
121 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
122 },
123 u'orm.recipe_dependency': {
124 'Meta': {'object_name': 'Recipe_Dependency'},
125 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
126 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_depends'", 'to': u"orm['orm.Recipe']"}),
127 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
128 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_recipe'", 'to': u"orm['orm.Recipe']"})
129 },
130 u'orm.target': {
131 'Meta': {'object_name': 'Target'},
132 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
133 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
134 'image_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
135 'is_image': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
136 'license_manifest_path': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True'}),
137 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'})
138 },
139 u'orm.target_file': {
140 'Meta': {'object_name': 'Target_File'},
141 'directory': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'directory_set'", 'null': 'True', 'to': u"orm['orm.Target_File']"}),
142 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
143 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
144 'inodetype': ('django.db.models.fields.IntegerField', [], {}),
145 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
146 'path': ('django.db.models.fields.FilePathField', [], {'max_length': '100'}),
147 'permission': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
148 'size': ('django.db.models.fields.IntegerField', [], {}),
149 'sym_target': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'symlink_set'", 'null': 'True', 'to': u"orm['orm.Target_File']"}),
150 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
151 },
152 u'orm.target_image_file': {
153 'Meta': {'object_name': 'Target_Image_File'},
154 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '100'}),
155 'file_size': ('django.db.models.fields.IntegerField', [], {}),
156 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
157 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
158 },
159 u'orm.target_installed_package': {
160 'Meta': {'object_name': 'Target_Installed_Package'},
161 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
162 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'buildtargetlist_package'", 'to': u"orm['orm.Package']"}),
163 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
164 },
165 u'orm.task': {
166 'Meta': {'ordering': "('order', 'recipe')", 'unique_together': "(('build', 'recipe', 'task_name'),)", 'object_name': 'Task'},
167 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_build'", 'to': u"orm['orm.Build']"}),
168 'cpu_usage': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '6', 'decimal_places': '2'}),
169 'disk_io': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
170 'elapsed_time': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '6', 'decimal_places': '2'}),
171 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
172 'line_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
173 'logfile': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
174 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
175 'order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
176 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
177 'path_to_sstate_obj': ('django.db.models.fields.FilePathField', [], {'max_length': '500', 'blank': 'True'}),
178 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'build_recipe'", 'to': u"orm['orm.Recipe']"}),
179 'script_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
180 'source_url': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
181 'sstate_checksum': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
182 'sstate_result': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
183 'task_executed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
184 'task_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
185 'work_directory': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'})
186 },
187 u'orm.task_dependency': {
188 'Meta': {'object_name': 'Task_Dependency'},
189 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_depends'", 'to': u"orm['orm.Task']"}),
190 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
191 'task': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_task'", 'to': u"orm['orm.Task']"})
192 },
193 u'orm.variable': {
194 'Meta': {'object_name': 'Variable'},
195 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'variable_build'", 'to': u"orm['orm.Build']"}),
196 'changed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
197 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
198 'human_readable_name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
199 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
200 'variable_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
201 'variable_value': ('django.db.models.fields.TextField', [], {'blank': 'True'})
202 },
203 u'orm.variablehistory': {
204 'Meta': {'object_name': 'VariableHistory'},
205 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
206 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
207 'line_number': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
208 'operation': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
209 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
210 'variable': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'vhistory'", 'to': u"orm['orm.Variable']"})
211 }
212 }
213
214 complete_apps = ['orm'] \ No newline at end of file
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 9c15ebf12b..658e1d2cc7 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -175,9 +175,9 @@ class Task(models.Model):
175 return "Not Executed" 175 return "Not Executed"
176 176
177 def get_description(self): 177 def get_description(self):
178 variable = Variable.objects.filter(variable_name=self.task_name, build = self.build) 178 helptext = HelpText.objects.filter(key=self.task_name, area=HelpText.VARIABLE, build=self.build)
179 try: 179 try:
180 return variable[0].description 180 return helptext[0].text
181 except IndexError: 181 except IndexError:
182 return '' 182 return ''
183 183
@@ -343,6 +343,15 @@ class VariableHistory(models.Model):
343 line_number = models.IntegerField(null=True) 343 line_number = models.IntegerField(null=True)
344 operation = models.CharField(max_length=16) 344 operation = models.CharField(max_length=16)
345 345
346class HelpText(models.Model):
347 VARIABLE = 0
348 HELPTEXT_AREA = ((VARIABLE, 'variable'), )
349
350 build = models.ForeignKey(Build, related_name='helptext_build')
351 area = models.IntegerField(choices=HELPTEXT_AREA)
352 key = models.CharField(max_length=100)
353 text = models.TextField()
354
346class LogMessage(models.Model): 355class LogMessage(models.Model):
347 INFO = 0 356 INFO = 0
348 WARNING = 1 357 WARNING = 1