summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r--bitbake/lib/toaster/orm/management/__init__.py0
-rw-r--r--bitbake/lib/toaster/orm/management/commands/__init__.py0
-rw-r--r--bitbake/lib/toaster/orm/management/commands/lsupdates.py12
-rw-r--r--bitbake/lib/toaster/orm/migrations/0013_auto__add_release__add_layerversiondependency__add_unique_layerversion.py710
-rw-r--r--bitbake/lib/toaster/orm/models.py377
-rw-r--r--bitbake/lib/toaster/orm/tests.py33
-rw-r--r--bitbake/lib/toaster/toastermain/settings.py2
7 files changed, 1096 insertions, 38 deletions
diff --git a/bitbake/lib/toaster/orm/management/__init__.py b/bitbake/lib/toaster/orm/management/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/orm/management/__init__.py
diff --git a/bitbake/lib/toaster/orm/management/commands/__init__.py b/bitbake/lib/toaster/orm/management/commands/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/orm/management/commands/__init__.py
diff --git a/bitbake/lib/toaster/orm/management/commands/lsupdates.py b/bitbake/lib/toaster/orm/management/commands/lsupdates.py
new file mode 100644
index 0000000000..75e9513fca
--- /dev/null
+++ b/bitbake/lib/toaster/orm/management/commands/lsupdates.py
@@ -0,0 +1,12 @@
1from django.core.management.base import NoArgsCommand, CommandError
2from orm.models import LayerSource
3import os
4
5class Command(NoArgsCommand):
6 args = ""
7 help = "Updates locally cached information from all LayerSources"
8
9
10 def handle_noargs(self, **options):
11 for ls in LayerSource.objects.all():
12 ls.update()
diff --git a/bitbake/lib/toaster/orm/migrations/0013_auto__add_release__add_layerversiondependency__add_unique_layerversion.py b/bitbake/lib/toaster/orm/migrations/0013_auto__add_release__add_layerversiondependency__add_unique_layerversion.py
new file mode 100644
index 0000000000..7c954e6bef
--- /dev/null
+++ b/bitbake/lib/toaster/orm/migrations/0013_auto__add_release__add_layerversiondependency__add_unique_layerversion.py
@@ -0,0 +1,710 @@
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 'Release'
12 db.create_table(u'orm_release', (
13 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14 ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=32)),
15 ('description', self.gf('django.db.models.fields.CharField')(max_length=255)),
16 ('bitbake_version', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.BitbakeVersion'])),
17 ('branch', self.gf('django.db.models.fields.CharField')(max_length=32)),
18 ))
19 db.send_create_signal(u'orm', ['Release'])
20
21 # Adding model 'LayerVersionDependency'
22 db.create_table(u'orm_layerversiondependency', (
23 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
24 ('layer_source', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['orm.LayerSource'], null=True)),
25 ('up_id', self.gf('django.db.models.fields.IntegerField')(default=None, null=True)),
26 ('layer_version', self.gf('django.db.models.fields.related.ForeignKey')(related_name='dependencies', to=orm['orm.Layer_Version'])),
27 ('depends_on', self.gf('django.db.models.fields.related.ForeignKey')(related_name='dependees', to=orm['orm.Layer_Version'])),
28 ))
29 db.send_create_signal(u'orm', ['LayerVersionDependency'])
30
31 # Adding unique constraint on 'LayerVersionDependency', fields ['layer_source', 'up_id']
32 db.create_unique(u'orm_layerversiondependency', ['layer_source_id', 'up_id'])
33
34 # Adding model 'ToasterSetting'
35 db.create_table(u'orm_toastersetting', (
36 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
37 ('name', self.gf('django.db.models.fields.CharField')(max_length=63)),
38 ('helptext', self.gf('django.db.models.fields.TextField')()),
39 ('value', self.gf('django.db.models.fields.CharField')(max_length=255)),
40 ))
41 db.send_create_signal(u'orm', ['ToasterSetting'])
42
43 # Adding model 'Machine'
44 db.create_table(u'orm_machine', (
45 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
46 ('layer_source', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['orm.LayerSource'], null=True)),
47 ('up_id', self.gf('django.db.models.fields.IntegerField')(default=None, null=True)),
48 ('up_date', self.gf('django.db.models.fields.DateTimeField')(default=None, null=True)),
49 ('layer_version', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Layer_Version'])),
50 ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
51 ('description', self.gf('django.db.models.fields.CharField')(max_length=255)),
52 ))
53 db.send_create_signal(u'orm', ['Machine'])
54
55 # Adding unique constraint on 'Machine', fields ['layer_source', 'up_id']
56 db.create_unique(u'orm_machine', ['layer_source_id', 'up_id'])
57
58 # Adding model 'ReleaseDefaultLayer'
59 db.create_table(u'orm_releasedefaultlayer', (
60 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
61 ('release', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Release'])),
62 ('layer', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Layer'])),
63 ))
64 db.send_create_signal(u'orm', ['ReleaseDefaultLayer'])
65
66 # Adding model 'BitbakeVersion'
67 db.create_table(u'orm_bitbakeversion', (
68 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
69 ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=32)),
70 ('giturl', self.gf('django.db.models.fields.URLField')(max_length=200)),
71 ('branch', self.gf('django.db.models.fields.CharField')(max_length=32)),
72 ('dirpath', self.gf('django.db.models.fields.CharField')(max_length=255)),
73 ))
74 db.send_create_signal(u'orm', ['BitbakeVersion'])
75
76 # Adding model 'Branch'
77 db.create_table(u'orm_branch', (
78 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
79 ('layer_source', self.gf('django.db.models.fields.related.ForeignKey')(default=True, to=orm['orm.LayerSource'], null=True)),
80 ('up_id', self.gf('django.db.models.fields.IntegerField')(default=None, null=True)),
81 ('up_date', self.gf('django.db.models.fields.DateTimeField')(default=None, null=True)),
82 ('name', self.gf('django.db.models.fields.CharField')(max_length=50)),
83 ('bitbake_branch', self.gf('django.db.models.fields.CharField')(max_length=50, blank=True)),
84 ('short_description', self.gf('django.db.models.fields.CharField')(max_length=50, blank=True)),
85 ))
86 db.send_create_signal(u'orm', ['Branch'])
87
88 # Adding unique constraint on 'Branch', fields ['layer_source', 'name']
89 db.create_unique(u'orm_branch', ['layer_source_id', 'name'])
90
91 # Adding unique constraint on 'Branch', fields ['layer_source', 'up_id']
92 db.create_unique(u'orm_branch', ['layer_source_id', 'up_id'])
93
94 # Adding model 'ToasterSettingDefaultLayer'
95 db.create_table(u'orm_toastersettingdefaultlayer', (
96 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
97 ('layer_version', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Layer_Version'])),
98 ))
99 db.send_create_signal(u'orm', ['ToasterSettingDefaultLayer'])
100
101 # Adding model 'LayerSource'
102 db.create_table(u'orm_layersource', (
103 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
104 ('name', self.gf('django.db.models.fields.CharField')(max_length=63)),
105 ('sourcetype', self.gf('django.db.models.fields.IntegerField')()),
106 ('apiurl', self.gf('django.db.models.fields.CharField')(default=None, max_length=255, null=True)),
107 ))
108 db.send_create_signal(u'orm', ['LayerSource'])
109
110 # Adding unique constraint on 'LayerSource', fields ['sourcetype', 'apiurl']
111 db.create_unique(u'orm_layersource', ['sourcetype', 'apiurl'])
112
113 # Deleting field 'ProjectLayer.name'
114 db.delete_column(u'orm_projectlayer', 'name')
115
116 # Deleting field 'ProjectLayer.dirpath'
117 db.delete_column(u'orm_projectlayer', 'dirpath')
118
119 # Deleting field 'ProjectLayer.commit'
120 db.delete_column(u'orm_projectlayer', 'commit')
121
122 # Deleting field 'ProjectLayer.giturl'
123 db.delete_column(u'orm_projectlayer', 'giturl')
124
125 # Adding field 'ProjectLayer.layercommit'
126 db.add_column(u'orm_projectlayer', 'layercommit',
127 self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Layer_Version'], null=True),
128 keep_default=False)
129
130 # Adding field 'Layer_Version.layer_source'
131 db.add_column(u'orm_layer_version', 'layer_source',
132 self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['orm.LayerSource'], null=True),
133 keep_default=False)
134
135 # Adding field 'Layer_Version.up_id'
136 db.add_column(u'orm_layer_version', 'up_id',
137 self.gf('django.db.models.fields.IntegerField')(default=None, null=True),
138 keep_default=False)
139
140 # Adding field 'Layer_Version.up_date'
141 db.add_column(u'orm_layer_version', 'up_date',
142 self.gf('django.db.models.fields.DateTimeField')(default=None, null=True),
143 keep_default=False)
144
145 # Adding field 'Layer_Version.up_branch'
146 db.add_column(u'orm_layer_version', 'up_branch',
147 self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['orm.Branch'], null=True),
148 keep_default=False)
149
150 # Adding field 'Layer_Version.dirpath'
151 db.add_column(u'orm_layer_version', 'dirpath',
152 self.gf('django.db.models.fields.CharField')(default=None, max_length=255, null=True),
153 keep_default=False)
154
155
156 # Changing field 'Layer_Version.build'
157 db.alter_column(u'orm_layer_version', 'build_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['orm.Build']))
158
159 # Changing field 'Layer_Version.branch'
160 db.alter_column(u'orm_layer_version', 'branch', self.gf('django.db.models.fields.CharField')(max_length=80))
161 # Adding unique constraint on 'Layer_Version', fields ['layer_source', 'up_id']
162 db.create_unique(u'orm_layer_version', ['layer_source_id', 'up_id'])
163
164 # Adding field 'Recipe.layer_source'
165 db.add_column(u'orm_recipe', 'layer_source',
166 self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['orm.LayerSource'], null=True),
167 keep_default=False)
168
169 # Adding field 'Recipe.up_id'
170 db.add_column(u'orm_recipe', 'up_id',
171 self.gf('django.db.models.fields.IntegerField')(default=None, null=True),
172 keep_default=False)
173
174 # Adding field 'Recipe.up_date'
175 db.add_column(u'orm_recipe', 'up_date',
176 self.gf('django.db.models.fields.DateTimeField')(default=None, null=True),
177 keep_default=False)
178
179 # Adding field 'Layer.layer_source'
180 db.add_column(u'orm_layer', 'layer_source',
181 self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['orm.LayerSource'], null=True),
182 keep_default=False)
183
184 # Adding field 'Layer.up_id'
185 db.add_column(u'orm_layer', 'up_id',
186 self.gf('django.db.models.fields.IntegerField')(default=None, null=True),
187 keep_default=False)
188
189 # Adding field 'Layer.up_date'
190 db.add_column(u'orm_layer', 'up_date',
191 self.gf('django.db.models.fields.DateTimeField')(default=None, null=True),
192 keep_default=False)
193
194 # Adding field 'Layer.vcs_url'
195 db.add_column(u'orm_layer', 'vcs_url',
196 self.gf('django.db.models.fields.URLField')(default=None, max_length=200, null=True),
197 keep_default=False)
198
199 # Adding field 'Layer.vcs_web_file_base_url'
200 db.add_column(u'orm_layer', 'vcs_web_file_base_url',
201 self.gf('django.db.models.fields.URLField')(default=None, max_length=200, null=True),
202 keep_default=False)
203
204 # Adding field 'Layer.summary'
205 db.add_column(u'orm_layer', 'summary',
206 self.gf('django.db.models.fields.CharField')(default=None, max_length=200, null=True),
207 keep_default=False)
208
209 # Adding field 'Layer.description'
210 db.add_column(u'orm_layer', 'description',
211 self.gf('django.db.models.fields.TextField')(default=None, null=True),
212 keep_default=False)
213
214
215 # Changing field 'Layer.local_path'
216 db.alter_column(u'orm_layer', 'local_path', self.gf('django.db.models.fields.FilePathField')(max_length=255, null=True))
217 # Adding unique constraint on 'Layer', fields ['layer_source', 'up_id']
218 db.create_unique(u'orm_layer', ['layer_source_id', 'up_id'])
219
220 # Adding unique constraint on 'Layer', fields ['layer_source', 'name']
221 db.create_unique(u'orm_layer', ['layer_source_id', 'name'])
222
223 # Deleting field 'Project.branch'
224 db.delete_column(u'orm_project', 'branch')
225
226 # Adding field 'Project.bitbake_version'
227 db.add_column(u'orm_project', 'bitbake_version',
228 self.gf('django.db.models.fields.related.ForeignKey')(default=-1, to=orm['orm.BitbakeVersion']),
229 keep_default=False)
230
231 # Adding field 'Project.release'
232 db.add_column(u'orm_project', 'release',
233 self.gf('django.db.models.fields.related.ForeignKey')(default=-1, to=orm['orm.Release']),
234 keep_default=False)
235
236
237 def backwards(self, orm):
238 # Removing unique constraint on 'Layer', fields ['layer_source', 'name']
239 db.delete_unique(u'orm_layer', ['layer_source_id', 'name'])
240
241 # Removing unique constraint on 'Layer', fields ['layer_source', 'up_id']
242 db.delete_unique(u'orm_layer', ['layer_source_id', 'up_id'])
243
244 # Removing unique constraint on 'Layer_Version', fields ['layer_source', 'up_id']
245 db.delete_unique(u'orm_layer_version', ['layer_source_id', 'up_id'])
246
247 # Removing unique constraint on 'LayerSource', fields ['sourcetype', 'apiurl']
248 db.delete_unique(u'orm_layersource', ['sourcetype', 'apiurl'])
249
250 # Removing unique constraint on 'Branch', fields ['layer_source', 'up_id']
251 db.delete_unique(u'orm_branch', ['layer_source_id', 'up_id'])
252
253 # Removing unique constraint on 'Branch', fields ['layer_source', 'name']
254 db.delete_unique(u'orm_branch', ['layer_source_id', 'name'])
255
256 # Removing unique constraint on 'Machine', fields ['layer_source', 'up_id']
257 db.delete_unique(u'orm_machine', ['layer_source_id', 'up_id'])
258
259 # Removing unique constraint on 'LayerVersionDependency', fields ['layer_source', 'up_id']
260 db.delete_unique(u'orm_layerversiondependency', ['layer_source_id', 'up_id'])
261
262 # Deleting model 'Release'
263 db.delete_table(u'orm_release')
264
265 # Deleting model 'LayerVersionDependency'
266 db.delete_table(u'orm_layerversiondependency')
267
268 # Deleting model 'ToasterSetting'
269 db.delete_table(u'orm_toastersetting')
270
271 # Deleting model 'Machine'
272 db.delete_table(u'orm_machine')
273
274 # Deleting model 'ReleaseDefaultLayer'
275 db.delete_table(u'orm_releasedefaultlayer')
276
277 # Deleting model 'BitbakeVersion'
278 db.delete_table(u'orm_bitbakeversion')
279
280 # Deleting model 'Branch'
281 db.delete_table(u'orm_branch')
282
283 # Deleting model 'ToasterSettingDefaultLayer'
284 db.delete_table(u'orm_toastersettingdefaultlayer')
285
286 # Deleting model 'LayerSource'
287 db.delete_table(u'orm_layersource')
288
289
290 # User chose to not deal with backwards NULL issues for 'ProjectLayer.name'
291 raise RuntimeError("Cannot reverse this migration. 'ProjectLayer.name' and its values cannot be restored.")
292
293 # The following code is provided here to aid in writing a correct migration # Adding field 'ProjectLayer.name'
294 db.add_column(u'orm_projectlayer', 'name',
295 self.gf('django.db.models.fields.CharField')(max_length=100),
296 keep_default=False)
297
298
299 # User chose to not deal with backwards NULL issues for 'ProjectLayer.dirpath'
300 raise RuntimeError("Cannot reverse this migration. 'ProjectLayer.dirpath' and its values cannot be restored.")
301
302 # The following code is provided here to aid in writing a correct migration # Adding field 'ProjectLayer.dirpath'
303 db.add_column(u'orm_projectlayer', 'dirpath',
304 self.gf('django.db.models.fields.CharField')(max_length=254),
305 keep_default=False)
306
307
308 # User chose to not deal with backwards NULL issues for 'ProjectLayer.commit'
309 raise RuntimeError("Cannot reverse this migration. 'ProjectLayer.commit' and its values cannot be restored.")
310
311 # The following code is provided here to aid in writing a correct migration # Adding field 'ProjectLayer.commit'
312 db.add_column(u'orm_projectlayer', 'commit',
313 self.gf('django.db.models.fields.CharField')(max_length=254),
314 keep_default=False)
315
316
317 # User chose to not deal with backwards NULL issues for 'ProjectLayer.giturl'
318 raise RuntimeError("Cannot reverse this migration. 'ProjectLayer.giturl' and its values cannot be restored.")
319
320 # The following code is provided here to aid in writing a correct migration # Adding field 'ProjectLayer.giturl'
321 db.add_column(u'orm_projectlayer', 'giturl',
322 self.gf('django.db.models.fields.CharField')(max_length=254),
323 keep_default=False)
324
325 # Deleting field 'ProjectLayer.layercommit'
326 db.delete_column(u'orm_projectlayer', 'layercommit_id')
327
328 # Deleting field 'Layer_Version.layer_source'
329 db.delete_column(u'orm_layer_version', 'layer_source_id')
330
331 # Deleting field 'Layer_Version.up_id'
332 db.delete_column(u'orm_layer_version', 'up_id')
333
334 # Deleting field 'Layer_Version.up_date'
335 db.delete_column(u'orm_layer_version', 'up_date')
336
337 # Deleting field 'Layer_Version.up_branch'
338 db.delete_column(u'orm_layer_version', 'up_branch_id')
339
340 # Deleting field 'Layer_Version.dirpath'
341 db.delete_column(u'orm_layer_version', 'dirpath')
342
343
344 # User chose to not deal with backwards NULL issues for 'Layer_Version.build'
345 raise RuntimeError("Cannot reverse this migration. 'Layer_Version.build' and its values cannot be restored.")
346
347 # The following code is provided here to aid in writing a correct migration
348 # Changing field 'Layer_Version.build'
349 db.alter_column(u'orm_layer_version', 'build_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['orm.Build']))
350
351 # Changing field 'Layer_Version.branch'
352 db.alter_column(u'orm_layer_version', 'branch', self.gf('django.db.models.fields.CharField')(max_length=50))
353 # Deleting field 'Recipe.layer_source'
354 db.delete_column(u'orm_recipe', 'layer_source_id')
355
356 # Deleting field 'Recipe.up_id'
357 db.delete_column(u'orm_recipe', 'up_id')
358
359 # Deleting field 'Recipe.up_date'
360 db.delete_column(u'orm_recipe', 'up_date')
361
362 # Deleting field 'Layer.layer_source'
363 db.delete_column(u'orm_layer', 'layer_source_id')
364
365 # Deleting field 'Layer.up_id'
366 db.delete_column(u'orm_layer', 'up_id')
367
368 # Deleting field 'Layer.up_date'
369 db.delete_column(u'orm_layer', 'up_date')
370
371 # Deleting field 'Layer.vcs_url'
372 db.delete_column(u'orm_layer', 'vcs_url')
373
374 # Deleting field 'Layer.vcs_web_file_base_url'
375 db.delete_column(u'orm_layer', 'vcs_web_file_base_url')
376
377 # Deleting field 'Layer.summary'
378 db.delete_column(u'orm_layer', 'summary')
379
380 # Deleting field 'Layer.description'
381 db.delete_column(u'orm_layer', 'description')
382
383
384 # User chose to not deal with backwards NULL issues for 'Layer.local_path'
385 raise RuntimeError("Cannot reverse this migration. 'Layer.local_path' and its values cannot be restored.")
386
387 # The following code is provided here to aid in writing a correct migration
388 # Changing field 'Layer.local_path'
389 db.alter_column(u'orm_layer', 'local_path', self.gf('django.db.models.fields.FilePathField')(max_length=255))
390
391 # User chose to not deal with backwards NULL issues for 'Project.branch'
392 raise RuntimeError("Cannot reverse this migration. 'Project.branch' and its values cannot be restored.")
393
394 # The following code is provided here to aid in writing a correct migration # Adding field 'Project.branch'
395 db.add_column(u'orm_project', 'branch',
396 self.gf('django.db.models.fields.CharField')(max_length=50),
397 keep_default=False)
398
399 # Deleting field 'Project.bitbake_version'
400 db.delete_column(u'orm_project', 'bitbake_version_id')
401
402 # Deleting field 'Project.release'
403 db.delete_column(u'orm_project', 'release_id')
404
405
406 models = {
407 u'orm.bitbakeversion': {
408 'Meta': {'object_name': 'BitbakeVersion'},
409 'branch': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
410 'dirpath': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
411 'giturl': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
412 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
413 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'})
414 },
415 u'orm.branch': {
416 'Meta': {'unique_together': "(('layer_source', 'name'), ('layer_source', 'up_id'))", 'object_name': 'Branch'},
417 'bitbake_branch': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
418 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
419 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'True', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
420 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
421 'short_description': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
422 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
423 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
424 },
425 u'orm.build': {
426 'Meta': {'object_name': 'Build'},
427 'bitbake_version': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
428 'build_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
429 'completed_on': ('django.db.models.fields.DateTimeField', [], {}),
430 'cooker_log_path': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
431 'distro': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
432 'distro_version': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
433 'errors_no': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
434 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
435 'machine': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
436 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
437 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']", 'null': 'True'}),
438 'started_on': ('django.db.models.fields.DateTimeField', [], {}),
439 'timespent': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
440 'warnings_no': ('django.db.models.fields.IntegerField', [], {'default': '0'})
441 },
442 u'orm.helptext': {
443 'Meta': {'object_name': 'HelpText'},
444 'area': ('django.db.models.fields.IntegerField', [], {}),
445 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'helptext_build'", 'to': u"orm['orm.Build']"}),
446 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
447 'key': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
448 'text': ('django.db.models.fields.TextField', [], {})
449 },
450 u'orm.layer': {
451 'Meta': {'unique_together': "(('layer_source', 'up_id'), ('layer_source', 'name'))", 'object_name': 'Layer'},
452 'description': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'}),
453 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
454 'layer_index_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
455 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
456 'local_path': ('django.db.models.fields.FilePathField', [], {'default': 'None', 'max_length': '255', 'null': 'True'}),
457 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
458 'summary': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '200', 'null': 'True'}),
459 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
460 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'}),
461 'vcs_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'}),
462 'vcs_web_file_base_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'})
463 },
464 u'orm.layer_version': {
465 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'Layer_Version'},
466 'branch': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
467 'build': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'layer_version_build'", 'null': 'True', 'to': u"orm['orm.Build']"}),
468 'commit': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
469 'dirpath': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True'}),
470 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
471 'layer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'layer_version_layer'", 'to': u"orm['orm.Layer']"}),
472 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
473 'priority': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
474 'up_branch': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.Branch']", 'null': 'True'}),
475 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
476 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
477 },
478 u'orm.layersource': {
479 'Meta': {'unique_together': "(('sourcetype', 'apiurl'),)", 'object_name': 'LayerSource'},
480 'apiurl': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True'}),
481 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
482 'name': ('django.db.models.fields.CharField', [], {'max_length': '63'}),
483 'sourcetype': ('django.db.models.fields.IntegerField', [], {})
484 },
485 u'orm.layerversiondependency': {
486 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'LayerVersionDependency'},
487 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'dependees'", 'to': u"orm['orm.Layer_Version']"}),
488 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
489 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
490 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'dependencies'", 'to': u"orm['orm.Layer_Version']"}),
491 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
492 },
493 u'orm.logmessage': {
494 'Meta': {'object_name': 'LogMessage'},
495 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
496 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
497 'level': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
498 'lineno': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
499 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
500 'pathname': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
501 'task': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Task']", 'null': 'True', 'blank': 'True'})
502 },
503 u'orm.machine': {
504 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'Machine'},
505 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
506 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
507 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
508 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Layer_Version']"}),
509 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
510 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
511 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
512 },
513 u'orm.package': {
514 'Meta': {'object_name': 'Package'},
515 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
516 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
517 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
518 'installed_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'}),
519 'installed_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
520 'license': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
521 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
522 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Recipe']", 'null': 'True'}),
523 'revision': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
524 'section': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
525 'size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
526 'summary': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
527 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
528 },
529 u'orm.package_dependency': {
530 'Meta': {'object_name': 'Package_Dependency'},
531 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
532 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_target'", 'to': u"orm['orm.Package']"}),
533 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
534 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_source'", 'to': u"orm['orm.Package']"}),
535 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']", 'null': 'True'})
536 },
537 u'orm.package_file': {
538 'Meta': {'object_name': 'Package_File'},
539 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
540 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'buildfilelist_package'", 'to': u"orm['orm.Package']"}),
541 'path': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
542 'size': ('django.db.models.fields.IntegerField', [], {})
543 },
544 u'orm.project': {
545 'Meta': {'object_name': 'Project'},
546 'bitbake_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.BitbakeVersion']"}),
547 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
548 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
549 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
550 'release': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Release']"}),
551 'short_description': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
552 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
553 'user_id': ('django.db.models.fields.IntegerField', [], {'null': 'True'})
554 },
555 u'orm.projectlayer': {
556 'Meta': {'object_name': 'ProjectLayer'},
557 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
558 'layercommit': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Layer_Version']", 'null': 'True'}),
559 'optional': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
560 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"})
561 },
562 u'orm.projecttarget': {
563 'Meta': {'object_name': 'ProjectTarget'},
564 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
565 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}),
566 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
567 'task': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'})
568 },
569 u'orm.projectvariable': {
570 'Meta': {'object_name': 'ProjectVariable'},
571 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
572 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
573 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}),
574 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'})
575 },
576 u'orm.recipe': {
577 'Meta': {'object_name': 'Recipe'},
578 'bugtracker': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
579 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
580 'file_path': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
581 'homepage': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
582 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
583 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
584 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'recipe_layer_version'", 'to': u"orm['orm.Layer_Version']"}),
585 'license': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
586 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
587 'section': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
588 'summary': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
589 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
590 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'}),
591 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
592 },
593 u'orm.recipe_dependency': {
594 'Meta': {'object_name': 'Recipe_Dependency'},
595 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
596 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_depends'", 'to': u"orm['orm.Recipe']"}),
597 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
598 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_recipe'", 'to': u"orm['orm.Recipe']"})
599 },
600 u'orm.release': {
601 'Meta': {'object_name': 'Release'},
602 'bitbake_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.BitbakeVersion']"}),
603 'branch': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
604 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
605 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
606 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'})
607 },
608 u'orm.releasedefaultlayer': {
609 'Meta': {'object_name': 'ReleaseDefaultLayer'},
610 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
611 'layer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Layer']"}),
612 'release': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Release']"})
613 },
614 u'orm.target': {
615 'Meta': {'object_name': 'Target'},
616 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
617 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
618 'image_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
619 'is_image': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
620 'license_manifest_path': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True'}),
621 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'})
622 },
623 u'orm.target_file': {
624 'Meta': {'object_name': 'Target_File'},
625 'directory': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'directory_set'", 'null': 'True', 'to': u"orm['orm.Target_File']"}),
626 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
627 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
628 'inodetype': ('django.db.models.fields.IntegerField', [], {}),
629 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
630 'path': ('django.db.models.fields.FilePathField', [], {'max_length': '100'}),
631 'permission': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
632 'size': ('django.db.models.fields.IntegerField', [], {}),
633 'sym_target': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'symlink_set'", 'null': 'True', 'to': u"orm['orm.Target_File']"}),
634 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
635 },
636 u'orm.target_image_file': {
637 'Meta': {'object_name': 'Target_Image_File'},
638 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '254'}),
639 'file_size': ('django.db.models.fields.IntegerField', [], {}),
640 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
641 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
642 },
643 u'orm.target_installed_package': {
644 'Meta': {'object_name': 'Target_Installed_Package'},
645 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
646 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'buildtargetlist_package'", 'to': u"orm['orm.Package']"}),
647 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
648 },
649 u'orm.task': {
650 'Meta': {'ordering': "('order', 'recipe')", 'unique_together': "(('build', 'recipe', 'task_name'),)", 'object_name': 'Task'},
651 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_build'", 'to': u"orm['orm.Build']"}),
652 'cpu_usage': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '6', 'decimal_places': '2'}),
653 'disk_io': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
654 'elapsed_time': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '6', 'decimal_places': '2'}),
655 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
656 'line_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
657 'logfile': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
658 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
659 'order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
660 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
661 'path_to_sstate_obj': ('django.db.models.fields.FilePathField', [], {'max_length': '500', 'blank': 'True'}),
662 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'build_recipe'", 'to': u"orm['orm.Recipe']"}),
663 'script_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
664 'source_url': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
665 'sstate_checksum': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
666 'sstate_result': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
667 'task_executed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
668 'task_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
669 'work_directory': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'})
670 },
671 u'orm.task_dependency': {
672 'Meta': {'object_name': 'Task_Dependency'},
673 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_depends'", 'to': u"orm['orm.Task']"}),
674 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
675 'task': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_task'", 'to': u"orm['orm.Task']"})
676 },
677 u'orm.toastersetting': {
678 'Meta': {'object_name': 'ToasterSetting'},
679 'helptext': ('django.db.models.fields.TextField', [], {}),
680 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
681 'name': ('django.db.models.fields.CharField', [], {'max_length': '63'}),
682 'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
683 },
684 u'orm.toastersettingdefaultlayer': {
685 'Meta': {'object_name': 'ToasterSettingDefaultLayer'},
686 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
687 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Layer_Version']"})
688 },
689 u'orm.variable': {
690 'Meta': {'object_name': 'Variable'},
691 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'variable_build'", 'to': u"orm['orm.Build']"}),
692 'changed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
693 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
694 'human_readable_name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
695 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
696 'variable_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
697 'variable_value': ('django.db.models.fields.TextField', [], {'blank': 'True'})
698 },
699 u'orm.variablehistory': {
700 'Meta': {'object_name': 'VariableHistory'},
701 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
702 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
703 'line_number': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
704 'operation': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
705 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
706 'variable': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'vhistory'", 'to': u"orm['orm.Variable']"})
707 }
708 }
709
710 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 f19a4370c8..5a6dcd72f6 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -22,30 +22,33 @@
22from django.db import models 22from django.db import models
23from django.db.models import F 23from django.db.models import F
24from django.utils.encoding import python_2_unicode_compatible 24from django.utils.encoding import python_2_unicode_compatible
25from django.utils import timezone
26
27class ToasterSetting(models.Model):
28 name = models.CharField(max_length=63)
29 helptext = models.TextField()
30 value = models.CharField(max_length=255)
31
32class ToasterSettingDefaultLayer(models.Model):
33 layer_version = models.ForeignKey('Layer_Version')
25 34
26class ProjectManager(models.Manager): 35class ProjectManager(models.Manager):
27 def create_project(self, name, branch, short_description): 36 def create_project(self, name, release):
28 prj = self.model(name = name, branch = branch, short_description = short_description) 37 prj = self.model(name = name, bitbake_version = release.bitbake_version, release = release)
29 prj.save() 38 prj.save()
30 39
31 # create default variables 40 for defaultconf in ToasterSetting.objects.filter(name__startswith="DEFCONF_"):
32 ProjectVariable.objects.create(project = prj, name = "MACHINE", value = "qemux86") 41 name = defaultconf.name[8:]
33 ProjectVariable.objects.create(project = prj, name = "DISTRO", value = "poky") 42 ProjectVariable.objects.create( project = prj,
34 43 name = name,
35 # create default layers 44 value = defaultconf.value)
36 ProjectLayer.objects.create(project = prj, 45
37 name = "meta", 46 for layer in map(lambda x: x.layer, ReleaseDefaultLayer.objects.filter(release = release)):
38 giturl = "git://git.yoctoproject.org/poky", 47 for branches in Branch.objects.filter(name = release.branch):
39 commit = branch, 48 for lv in Layer_Version.objects.filter(layer = layer, up_branch = branches ):
40 dirpath = "meta", 49 ProjectLayer.objects.create( project = prj,
41 optional = False) 50 layercommit = lv,
42 51 optional = False )
43 ProjectLayer.objects.create(project = prj,
44 name = "meta-yocto",
45 giturl = "git://git.yoctoproject.org/poky",
46 commit = branch,
47 dirpath = "meta-yocto",
48 optional = False)
49 52
50 return prj 53 return prj
51 54
@@ -57,8 +60,9 @@ class ProjectManager(models.Manager):
57 60
58class Project(models.Model): 61class Project(models.Model):
59 name = models.CharField(max_length=100) 62 name = models.CharField(max_length=100)
60 branch = models.CharField(max_length=50)
61 short_description = models.CharField(max_length=50, blank=True) 63 short_description = models.CharField(max_length=50, blank=True)
64 bitbake_version = models.ForeignKey('BitbakeVersion')
65 release = models.ForeignKey("Release")
62 created = models.DateTimeField(auto_now_add = True) 66 created = models.DateTimeField(auto_now_add = True)
63 updated = models.DateTimeField(auto_now = True) 67 updated = models.DateTimeField(auto_now = True)
64 # This is a horrible hack; since Toaster has no "User" model available when 68 # This is a horrible hack; since Toaster has no "User" model available when
@@ -70,10 +74,16 @@ class Project(models.Model):
70 74
71 75
72 def schedule_build(self): 76 def schedule_build(self):
73 from bldcontrol.models import BuildRequest, BRTarget, BRLayer, BRVariable 77 from bldcontrol.models import BuildRequest, BRTarget, BRLayer, BRVariable, BRBitbake
74 br = BuildRequest.objects.create(project = self) 78 br = BuildRequest.objects.create(project = self)
79
80 BRBitbake.objects.create(req = br,
81 giturl = self.bitbake_version.giturl,
82 commit = self.bitbake_version.branch,
83 dirpath = self.bitbake_version.dirpath)
84
75 for l in self.projectlayer_set.all(): 85 for l in self.projectlayer_set.all():
76 BRLayer.objects.create(req = br, name = l.name, giturl = l.giturl, commit = l.commit, dirpath = l.dirpath) 86 BRLayer.objects.create(req = br, name = l.layercommit.layer.name, giturl = l.layercommit.layer.vcs_url, commit = l.layercommit.commit, dirpath = l.layercommit.dirpath)
77 for t in self.projecttarget_set.all(): 87 for t in self.projecttarget_set.all():
78 BRTarget.objects.create(req = br, target = t.target, task = t.task) 88 BRTarget.objects.create(req = br, target = t.target, task = t.task)
79 for v in self.projectvariable_set.all(): 89 for v in self.projectvariable_set.all():
@@ -83,7 +93,6 @@ class Project(models.Model):
83 br.save() 93 br.save()
84 return br 94 return br
85 95
86
87class Build(models.Model): 96class Build(models.Model):
88 SUCCEEDED = 0 97 SUCCEEDED = 0
89 FAILED = 1 98 FAILED = 1
@@ -359,8 +368,13 @@ class Package_File(models.Model):
359 368
360class Recipe(models.Model): 369class Recipe(models.Model):
361 search_allowed_fields = ['name', 'version', 'file_path', 'section', 'license', 'layer_version__layer__name', 'layer_version__branch', 'layer_version__commit', 'layer_version__layer__local_path'] 370 search_allowed_fields = ['name', 'version', 'file_path', 'section', 'license', 'layer_version__layer__name', 'layer_version__branch', 'layer_version__commit', 'layer_version__layer__local_path']
362 name = models.CharField(max_length=100, blank=True) 371
363 version = models.CharField(max_length=100, blank=True) 372 layer_source = models.ForeignKey('LayerSource', default = None, null = True) # from where did we get this recipe
373 up_id = models.IntegerField(null = True, default = None) # id of entry in the source
374 up_date = models.DateTimeField(null = True, default = None)
375
376 name = models.CharField(max_length=100, blank=True) # pn
377 version = models.CharField(max_length=100, blank=True) # pv
364 layer_version = models.ForeignKey('Layer_Version', related_name='recipe_layer_version') 378 layer_version = models.ForeignKey('Layer_Version', related_name='recipe_layer_version')
365 summary = models.CharField(max_length=100, blank=True) 379 summary = models.CharField(max_length=100, blank=True)
366 description = models.TextField(blank=True) 380 description = models.TextField(blank=True)
@@ -370,6 +384,9 @@ class Recipe(models.Model):
370 bugtracker = models.URLField(blank=True) 384 bugtracker = models.URLField(blank=True)
371 file_path = models.FilePathField(max_length=255) 385 file_path = models.FilePathField(max_length=255)
372 386
387 def __unicode__(self):
388 return "Recipe " + self.name + ":" + self.version
389
373class Recipe_DependencyManager(models.Manager): 390class Recipe_DependencyManager(models.Manager):
374 use_for_related_fields = True 391 use_for_related_fields = True
375 392
@@ -389,27 +406,311 @@ class Recipe_Dependency(models.Model):
389 dep_type = models.IntegerField(choices=DEPENDS_TYPE) 406 dep_type = models.IntegerField(choices=DEPENDS_TYPE)
390 objects = Recipe_DependencyManager() 407 objects = Recipe_DependencyManager()
391 408
392class ProjectLayer(models.Model):
393 project = models.ForeignKey(Project)
394 name = models.CharField(max_length = 100)
395 giturl = models.CharField(max_length = 254)
396 commit = models.CharField(max_length = 254)
397 dirpath = models.CharField(max_length = 254)
398 optional = models.BooleanField(default = True)
399 409
410class Machine(models.Model):
411 layer_source = models.ForeignKey('LayerSource', default = None, null = True) # from where did we get this machine
412 up_id = models.IntegerField(null = True, default = None) # id of entry in the source
413 up_date = models.DateTimeField(null = True, default = None)
414
415 layer_version = models.ForeignKey('Layer_Version')
416 name = models.CharField(max_length=255)
417 description = models.CharField(max_length=255)
418
419 def __unicode__(self):
420 return "Machine " + self.name + "(" + self.description + ")"
421
422 class Meta:
423 unique_together = ("layer_source", "up_id")
424
425
426from django.db.models.base import ModelBase
427
428class InheritanceMetaclass(ModelBase):
429 def __call__(cls, *args, **kwargs):
430 obj = super(InheritanceMetaclass, cls).__call__(*args, **kwargs)
431 return obj.get_object()
432
433
434class LayerSource(models.Model):
435 __metaclass__ = InheritanceMetaclass
436
437 class Meta:
438 unique_together = (('sourcetype', 'apiurl'), )
439
440 TYPE_LOCAL = 0
441 TYPE_LAYERINDEX = 1
442 SOURCE_TYPE = (
443 (TYPE_LOCAL, "local"),
444 (TYPE_LAYERINDEX, "layerindex"),
445 )
446
447 name = models.CharField(max_length=63)
448 sourcetype = models.IntegerField(choices=SOURCE_TYPE)
449 apiurl = models.CharField(max_length=255, null=True, default=None)
450
451 def save(self, *args, **kwargs):
452 if isinstance(self, LocalLayerSource):
453 self.sourcetype = LayerSource.TYPE_LOCAL
454 elif isinstance(self, LayerIndexLayerSource):
455 self.sourcetype = LayerSource.TYPE_LAYERINDEX
456 elif self.sourcetype == None:
457 raise Exception("Invalid LayerSource type")
458 return super(LayerSource, self).save(*args, **kwargs)
459
460 def get_object(self):
461 if self.sourcetype is not None:
462 if self.sourcetype == LayerSource.TYPE_LOCAL:
463 self.__class__ = LocalLayerSource
464 if self.sourcetype == LayerSource.TYPE_LAYERINDEX:
465 self.__class__ = LayerIndexLayerSource
466 return self
467
468 return "LS " + self.sourcetype + " " + self.name
469
470
471class LocalLayerSource(LayerSource):
472 class Meta(LayerSource._meta.__class__):
473 proxy = True
474
475 def __init__(self, *args, **kwargs):
476 super(LocalLayerSource, self).__init__(args, kwargs)
477 self.sourcetype = LayerSource.TYPE_LOCAL
478
479 def update(self):
480 '''
481 Fetches layer, recipe and machine information from local repository
482 '''
483 pass
484
485class LayerIndexLayerSource(LayerSource):
486 class Meta(LayerSource._meta.__class__):
487 proxy = True
488
489 def __init__(self, *args, **kwargs):
490 super(LayerIndexLayerSource, self).__init__(args, kwargs)
491 self.sourcetype = LayerSource.TYPE_LAYERINDEX
492
493 def update(self):
494 '''
495 Fetches layer, recipe and machine information from remote repository
496 '''
497 assert self.apiurl is not None
498
499 def _get_json_response(apiurl = self.apiurl):
500 import httplib, urlparse, json
501 parsedurl = urlparse.urlparse(apiurl)
502 (host, port) = parsedurl.netloc.split(":")
503 if port is None:
504 port = 80
505 else:
506 port = int(port)
507 #print "-- connect to: http://%s:%s%s?%s" % (host, port, parsedurl.path, parsedurl.query)
508 conn = httplib.HTTPConnection(host, port)
509 conn.request("GET", parsedurl.path + "?" + parsedurl.query)
510 r = conn.getresponse()
511 if r.status != 200:
512 raise Exception("Failed to read " + parsedurl.path + ": %d %s" % (r.status, r.reason))
513 return json.loads(r.read())
514
515 # verify we can get the basic api
516 try:
517 apilinks = _get_json_response()
518 except:
519 print "EE: could not connect to %s, skipping update" % self.apiurl
520 return
521
522 # update branches; only those that we already have names listed in the database
523 whitelist_branch_names = self.branchnames.split(",")
524
525 branches_info = _get_json_response(apilinks['branches']
526 + "?filter=name:%s" % "OR".join(whitelist_branch_names))
527 for bi in branches_info:
528 try:
529 b = Branch.objects.get(layer_source = self, name = bi['name'])
530 b.up_id = bi['id']
531 b.up_date = bi['updated']
532 b.name = bi['name']
533 b.bitbake_branch = bi['bitbake_branch']
534 b.short_description = bi['short_description']
535 b.save()
536 except Branch.DoesNotExist:
537 b = Branch.objects.create(
538 layer_source = self,
539 up_id = bi['id'],
540 up_date = bi['updated'],
541 name = bi['name'],
542 bitbake_branch = bi['bitbake_branch'],
543 short_description = bi['short_description']
544 )
545
546 # update layers
547 layers_info = _get_json_response(apilinks['layerItems'])
548 for li in layers_info:
549 try:
550 l = Layer.objects.get(layer_source = self,
551 up_id = li['id'])
552 l.update(
553 up_date = li['updated'],
554 name = li['name'],
555 vcs_url = li['vcs_url'],
556 vcs_web_file_base_url = li['vcs_url'],
557 summary = li['summary'],
558 description = li['description'])
559 except Layer.DoesNotExist:
560 Layer.objects.create(layer_source = self,
561 up_id = li['id'],
562 up_date = li['updated'],
563 name = li['name'],
564 vcs_url = li['vcs_url'],
565 vcs_web_file_base_url = li['vcs_url'],
566 summary = li['summary'],
567 description = li['description']
568 )
569
570 # update layerbranches/layer_versions
571 layerbranches_info = _get_json_response(apilinks['layerBranches']
572 + "?filter=branch:%s" % "OR".join(map(lambda x: str(x.up_id), Branch.objects.filter(layer_source = self)))
573 )
574 for lbi in layerbranches_info:
575 Layer_Version.objects.get_or_create(layer_source = self,
576 up_id = lbi['id'],
577 up_date = lbi['updated'],
578 layer = Layer.objects.get(layer_source = self, up_id = lbi['layer']),
579 up_branch = Branch.objects.get(layer_source = self, up_id = lbi['branch']),
580 branch = lbi['actual_branch'],
581 commit = lbi['vcs_last_rev'],
582 dirpath = lbi['vcs_subdir'])
583
584 # update machines
585 machines_info = _get_json_response(apilinks['machines']
586 + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self)))
587 )
588 for mi in machines_info:
589 Machine.objects.get_or_create(layer_source = self,
590 up_id = mi['id'],
591 up_date = mi['updated'],
592 layer_version = Layer_Version.objects.get(layer_source = self, up_id = mi['layerbranch']),
593 name = mi['name'],
594 description = mi['description'])
595
596 # update recipes; paginate by layer version / layer branch
597 recipes_info = _get_json_response(apilinks['recipes']
598 + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self)))
599 )
600 for ri in recipes_info:
601 Recipe.objects.get_or_create(layer_source = self,
602 up_id = ri['id'],
603 up_date = ri['updated'],
604 layer_version = Layer_Version.objects.get(layer_source = self, up_id = mi['layerbranch']),
605
606 name = ri['pn'],
607 version = ri['pv'],
608 summary = ri['summary'],
609 description = ri['description'],
610 section = ri['section'],
611 license = ri['license'],
612 homepage = ri['homepage'],
613 bugtracker = ri['bugtracker'],
614 file_path = ri['filepath'] + ri['filename']
615 )
616
617 pass
618
619class BitbakeVersion(models.Model):
620 name = models.CharField(max_length=32, unique = True)
621 giturl = models.URLField()
622 branch = models.CharField(max_length=32)
623 dirpath = models.CharField(max_length=255)
624
625
626class Release(models.Model):
627 name = models.CharField(max_length=32, unique = True)
628 description = models.CharField(max_length=255)
629 bitbake_version = models.ForeignKey(BitbakeVersion)
630 branch = models.CharField(max_length=32)
631
632
633class ReleaseDefaultLayer(models.Model):
634 release = models.ForeignKey(Release)
635 layer = models.ForeignKey('Layer')
636
637
638# Branch class is synced with layerindex.Branch, branches can only come from remote layer indexes
639class Branch(models.Model):
640 layer_source = models.ForeignKey('LayerSource', null = True, default = True)
641 up_id = models.IntegerField(null = True, default = None) # id of branch in the source
642 up_date = models.DateTimeField(null = True, default = None)
643
644 name = models.CharField(max_length=50)
645 bitbake_branch = models.CharField(max_length=50, blank=True)
646 short_description = models.CharField(max_length=50, blank=True)
647
648 class Meta:
649 verbose_name_plural = "Branches"
650 unique_together = (('layer_source', 'name'),('layer_source', 'up_id'))
651
652 def __unicode__(self):
653 return self.name
654
655
656# Layer class synced with layerindex.LayerItem
400class Layer(models.Model): 657class Layer(models.Model):
658 layer_source = models.ForeignKey(LayerSource, null = True, default = None) # from where did we got this layer
659 up_id = models.IntegerField(null = True, default = None) # id of layer in the remote source
660 up_date = models.DateTimeField(null = True, default = None)
661
401 name = models.CharField(max_length=100) 662 name = models.CharField(max_length=100)
402 local_path = models.FilePathField(max_length=255) 663 local_path = models.FilePathField(max_length=255, null = True, default = None)
403 layer_index_url = models.URLField() 664 layer_index_url = models.URLField()
665 vcs_url = models.URLField(default = None, null = True)
666 vcs_web_file_base_url = models.URLField(null = True, default = None)
667
668 summary = models.CharField(max_length=200, help_text='One-line description of the layer', null = True, default = None)
669 description = models.TextField(null = True, default = None)
670
671 def __unicode__(self):
672 return "L " + self.name
673
674 class Meta:
675 unique_together = (("layer_source", "up_id"), ("layer_source", "name"))
404 676
405 677
678# LayerCommit class is synced with layerindex.LayerBranch
406class Layer_Version(models.Model): 679class Layer_Version(models.Model):
407 build = models.ForeignKey(Build, related_name='layer_version_build') 680 search_allowed_fields = ["layer__name", "layer__summary",]
681 build = models.ForeignKey(Build, related_name='layer_version_build', default = None, null = True)
408 layer = models.ForeignKey(Layer, related_name='layer_version_layer') 682 layer = models.ForeignKey(Layer, related_name='layer_version_layer')
409 branch = models.CharField(max_length=50)
410 commit = models.CharField(max_length=100)
411 priority = models.IntegerField()
412 683
684 layer_source = models.ForeignKey(LayerSource, null = True, default = None) # from where did we get this Layer Version
685 up_id = models.IntegerField(null = True, default = None) # id of layerbranch in the remote source
686 up_date = models.DateTimeField(null = True, default = None)
687 up_branch = models.ForeignKey(Branch, null = True, default = None)
688
689 branch = models.CharField(max_length=80) # LayerBranch.actual_branch
690 commit = models.CharField(max_length=100) # LayerBranch.vcs_last_rev
691 dirpath = models.CharField(max_length=255, null = True, default = None) # LayerBranch.vcs_subdir
692 priority = models.IntegerField(default = 0) # if -1, this is a default layer
693
694 def __unicode__(self):
695 return "LV " + str(self.layer) + " " + self.commit
696
697 class Meta:
698 unique_together = ("layer_source", "up_id")
699
700class LayerVersionDependency(models.Model):
701 layer_source = models.ForeignKey(LayerSource, null = True, default = None) # from where did we got this layer
702 up_id = models.IntegerField(null = True, default = None) # id of layerbranch in the remote source
703
704 layer_version = models.ForeignKey(Layer_Version, related_name="dependencies")
705 depends_on = models.ForeignKey(Layer_Version, related_name="dependees")
706
707 class Meta:
708 unique_together = ("layer_source", "up_id")
709
710class ProjectLayer(models.Model):
711 project = models.ForeignKey(Project)
712 layercommit = models.ForeignKey(Layer_Version, null=True)
713 optional = models.BooleanField(default = True)
413 714
414class ProjectVariable(models.Model): 715class ProjectVariable(models.Model):
415 project = models.ForeignKey(Project) 716 project = models.ForeignKey(Project)
diff --git a/bitbake/lib/toaster/orm/tests.py b/bitbake/lib/toaster/orm/tests.py
new file mode 100644
index 0000000000..f2f561bff9
--- /dev/null
+++ b/bitbake/lib/toaster/orm/tests.py
@@ -0,0 +1,33 @@
1from django.test import TestCase
2from orm.models import LocalLayerSource, LayerIndexLayerSource, LayerSource
3from orm.models import Branch
4
5class LayerSourceVerifyInheritanceSaveLoad(TestCase):
6 def test_object_creation(self):
7 lls = LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "")
8 lils = LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LAYERINDEX, apiurl = "")
9
10 print LayerSource.objects.all()
11
12 self.assertTrue(True in map(lambda x: isinstance(x, LocalLayerSource), LayerSource.objects.all()))
13 self.assertTrue(True in map(lambda x: isinstance(x, LayerIndexLayerSource), LayerSource.objects.all()))
14
15 def test_duplicate_error(self):
16 def duplicate():
17 LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "")
18 LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "")
19
20 self.assertRaises(Exception, duplicate)
21
22
23
24class LILSUpdateTestCase(TestCase):
25 def test_update(self):
26 lils = LayerSource.objects.create(name = "b1", sourcetype = LayerSource.TYPE_LAYERINDEX, apiurl = "http://adamian-desk.local:8080/layerindex/api/")
27 lils.update()
28
29 # run second update
30 # lils.update()
31
32 # print vars(lils)
33 #print map(lambda x: vars(x), Branch.objects.all())
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index a8b3e3a485..1dab25aa6b 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -245,6 +245,8 @@ INSTALLED_APPS = (
245 'bldcontrol', 245 'bldcontrol',
246) 246)
247 247
248SOUTH_TESTS_MIGRATE = False
249
248# if we run in managed mode, we need user support 250# if we run in managed mode, we need user support
249if MANAGED: 251if MANAGED:
250 INSTALLED_APPS = ('django.contrib.auth', 252 INSTALLED_APPS = ('django.contrib.auth',