summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/orm
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2015-09-02 17:25:08 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-03 16:52:48 +0100
commit214ba674d057107688a281c542c21170657175e1 (patch)
treed99f0583a932d930e948c119d03bbf898550a82b /bitbake/lib/toaster/orm
parent5b26bbdfe17d36fbdbdeefe99c9054e7657b74fb (diff)
downloadpoky-214ba674d057107688a281c542c21170657175e1.tar.gz
bitbake: toaster: Improve how default project is identified and fetched
Command line builds are associated with a "default project" (as we currently require a build to have a project). This acts as a container for builds initiated outside Toaster. Currently, this project is marked as the default by its ID being 0. However, this doesn't work with MySQL, as MySQL won't allow 0 in a foreign key which references an autoincrement field. Instead, use an is_default field to track the default Project for builds initiated outside Toaster. Add a method to fetch this default project, rather than fetching a project with a magic ID. Add this default project in a migration, rather than as a side effect of a get_or_create() style method. Also ensure that builds always have a project explicitly assigned to avoid any magic with a build's project foreign key defaulting to 0 (as it no longer does). [YOCTO #7932] (Bitbake rev: 71b709a1bbc26d89d61873763b467d21e625b274) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/orm')
-rw-r--r--bitbake/lib/toaster/orm/migrations/0025_auto__add_field_project_is_default.py346
-rw-r--r--bitbake/lib/toaster/orm/migrations/0026_set_default_project.py374
-rw-r--r--bitbake/lib/toaster/orm/models.py18
3 files changed, 733 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/orm/migrations/0025_auto__add_field_project_is_default.py b/bitbake/lib/toaster/orm/migrations/0025_auto__add_field_project_is_default.py
new file mode 100644
index 0000000000..e76990d7a5
--- /dev/null
+++ b/bitbake/lib/toaster/orm/migrations/0025_auto__add_field_project_is_default.py
@@ -0,0 +1,346 @@
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 # work-around for http://south.aeracode.org/ticket/578:
12 # SQLite boolean fields aren't set to the correct default value
13 # (needs to be 0 or 1, rather than True or False)
14 default = False
15 if db.backend_name == 'sqlite3':
16 default = 0
17
18 # Adding field 'Project.is_default'
19 db.add_column(u'orm_project', 'is_default',
20 self.gf('django.db.models.fields.BooleanField')(default=default),
21 keep_default=False)
22
23
24 def backwards(self, orm):
25 # Deleting field 'Project.is_default'
26 db.delete_column(u'orm_project', 'is_default')
27
28
29 models = {
30 u'orm.bitbakeversion': {
31 'Meta': {'object_name': 'BitbakeVersion'},
32 'branch': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
33 'dirpath': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
34 'giturl': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
35 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
36 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'})
37 },
38 u'orm.branch': {
39 'Meta': {'unique_together': "(('layer_source', 'name'), ('layer_source', 'up_id'))", 'object_name': 'Branch'},
40 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
41 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'True', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
42 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
43 'short_description': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
44 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
45 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
46 },
47 u'orm.build': {
48 'Meta': {'object_name': 'Build'},
49 'bitbake_version': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
50 'build_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
51 'completed_on': ('django.db.models.fields.DateTimeField', [], {}),
52 'cooker_log_path': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
53 'distro': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
54 'distro_version': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
55 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
56 'machine': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
57 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
58 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}),
59 'started_on': ('django.db.models.fields.DateTimeField', [], {})
60 },
61 u'orm.buildartifact': {
62 'Meta': {'object_name': 'BuildArtifact'},
63 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
64 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '100'}),
65 'file_size': ('django.db.models.fields.IntegerField', [], {}),
66 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
67 },
68 u'orm.helptext': {
69 'Meta': {'object_name': 'HelpText'},
70 'area': ('django.db.models.fields.IntegerField', [], {}),
71 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'helptext_build'", 'to': u"orm['orm.Build']"}),
72 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
73 'key': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
74 'text': ('django.db.models.fields.TextField', [], {})
75 },
76 u'orm.layer': {
77 'Meta': {'unique_together': "(('layer_source', 'up_id'), ('layer_source', 'name'))", 'object_name': 'Layer'},
78 'description': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'}),
79 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
80 'layer_index_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
81 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
82 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
83 'summary': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'}),
84 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
85 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'}),
86 'vcs_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'}),
87 'vcs_web_file_base_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'}),
88 'vcs_web_tree_base_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'}),
89 'vcs_web_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'})
90 },
91 u'orm.layer_version': {
92 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'Layer_Version'},
93 'branch': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
94 'build': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'layer_version_build'", 'null': 'True', 'to': u"orm['orm.Build']"}),
95 'commit': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
96 'dirpath': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True'}),
97 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
98 'layer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'layer_version_layer'", 'to': u"orm['orm.Layer']"}),
99 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
100 'local_path': ('django.db.models.fields.FilePathField', [], {'default': "'/'", 'max_length': '1024'}),
101 'priority': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
102 'project': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.Project']", 'null': 'True'}),
103 'up_branch': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.Branch']", 'null': 'True'}),
104 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
105 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
106 },
107 u'orm.layersource': {
108 'Meta': {'unique_together': "(('sourcetype', 'apiurl'),)", 'object_name': 'LayerSource'},
109 'apiurl': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True'}),
110 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
111 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '63'}),
112 'sourcetype': ('django.db.models.fields.IntegerField', [], {})
113 },
114 u'orm.layerversiondependency': {
115 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'LayerVersionDependency'},
116 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'dependees'", 'to': u"orm['orm.Layer_Version']"}),
117 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
118 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
119 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'dependencies'", 'to': u"orm['orm.Layer_Version']"}),
120 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
121 },
122 u'orm.logmessage': {
123 'Meta': {'object_name': 'LogMessage'},
124 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
125 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
126 'level': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
127 'lineno': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
128 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
129 'pathname': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
130 'task': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Task']", 'null': 'True', 'blank': 'True'})
131 },
132 u'orm.machine': {
133 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'Machine'},
134 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
135 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
136 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
137 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Layer_Version']"}),
138 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
139 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
140 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
141 },
142 u'orm.package': {
143 'Meta': {'object_name': 'Package'},
144 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
145 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
146 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
147 'installed_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'}),
148 'installed_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
149 'license': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
150 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
151 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Recipe']", 'null': 'True'}),
152 'revision': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
153 'section': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
154 'size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
155 'summary': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
156 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
157 },
158 u'orm.package_dependency': {
159 'Meta': {'object_name': 'Package_Dependency'},
160 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
161 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_target'", 'to': u"orm['orm.Package']"}),
162 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
163 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_source'", 'to': u"orm['orm.Package']"}),
164 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']", 'null': 'True'})
165 },
166 u'orm.package_file': {
167 'Meta': {'object_name': 'Package_File'},
168 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
169 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'buildfilelist_package'", 'to': u"orm['orm.Package']"}),
170 'path': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
171 'size': ('django.db.models.fields.IntegerField', [], {})
172 },
173 u'orm.project': {
174 'Meta': {'object_name': 'Project'},
175 'bitbake_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.BitbakeVersion']", 'null': 'True'}),
176 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
177 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
178 'is_default': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
179 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
180 'release': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Release']", 'null': 'True'}),
181 'short_description': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
182 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
183 'user_id': ('django.db.models.fields.IntegerField', [], {'null': 'True'})
184 },
185 u'orm.projectlayer': {
186 'Meta': {'unique_together': "(('project', 'layercommit'),)", 'object_name': 'ProjectLayer'},
187 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
188 'layercommit': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Layer_Version']", 'null': 'True'}),
189 'optional': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
190 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"})
191 },
192 u'orm.projecttarget': {
193 'Meta': {'object_name': 'ProjectTarget'},
194 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
195 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}),
196 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
197 'task': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'})
198 },
199 u'orm.projectvariable': {
200 'Meta': {'object_name': 'ProjectVariable'},
201 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
202 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
203 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}),
204 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'})
205 },
206 u'orm.recipe': {
207 'Meta': {'unique_together': "(('layer_version', 'file_path', 'pathflags'),)", 'object_name': 'Recipe'},
208 'bugtracker': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
209 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
210 'file_path': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
211 'homepage': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
212 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
213 'is_image': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
214 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
215 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'recipe_layer_version'", 'to': u"orm['orm.Layer_Version']"}),
216 'license': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
217 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
218 'pathflags': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
219 'section': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
220 'summary': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
221 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
222 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'}),
223 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
224 },
225 u'orm.recipe_dependency': {
226 'Meta': {'object_name': 'Recipe_Dependency'},
227 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
228 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_depends'", 'to': u"orm['orm.Recipe']"}),
229 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
230 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_recipe'", 'to': u"orm['orm.Recipe']"})
231 },
232 u'orm.release': {
233 'Meta': {'object_name': 'Release'},
234 'bitbake_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.BitbakeVersion']"}),
235 'branch_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50'}),
236 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
237 'helptext': ('django.db.models.fields.TextField', [], {'null': 'True'}),
238 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
239 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'})
240 },
241 u'orm.releasedefaultlayer': {
242 'Meta': {'object_name': 'ReleaseDefaultLayer'},
243 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
244 'layer_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'}),
245 'release': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Release']"})
246 },
247 u'orm.releaselayersourcepriority': {
248 'Meta': {'unique_together': "(('release', 'layer_source'),)", 'object_name': 'ReleaseLayerSourcePriority'},
249 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
250 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.LayerSource']"}),
251 'priority': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
252 'release': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Release']"})
253 },
254 u'orm.target': {
255 'Meta': {'object_name': 'Target'},
256 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
257 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
258 'image_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
259 'is_image': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
260 'license_manifest_path': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True'}),
261 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
262 'task': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'})
263 },
264 u'orm.target_file': {
265 'Meta': {'object_name': 'Target_File'},
266 'directory': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'directory_set'", 'null': 'True', 'to': u"orm['orm.Target_File']"}),
267 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
268 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
269 'inodetype': ('django.db.models.fields.IntegerField', [], {}),
270 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
271 'path': ('django.db.models.fields.FilePathField', [], {'max_length': '100'}),
272 'permission': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
273 'size': ('django.db.models.fields.IntegerField', [], {}),
274 'sym_target': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'symlink_set'", 'null': 'True', 'to': u"orm['orm.Target_File']"}),
275 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
276 },
277 u'orm.target_image_file': {
278 'Meta': {'object_name': 'Target_Image_File'},
279 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '254'}),
280 'file_size': ('django.db.models.fields.IntegerField', [], {}),
281 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
282 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
283 },
284 u'orm.target_installed_package': {
285 'Meta': {'object_name': 'Target_Installed_Package'},
286 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
287 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'buildtargetlist_package'", 'to': u"orm['orm.Package']"}),
288 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
289 },
290 u'orm.task': {
291 'Meta': {'ordering': "('order', 'recipe')", 'unique_together': "(('build', 'recipe', 'task_name'),)", 'object_name': 'Task'},
292 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_build'", 'to': u"orm['orm.Build']"}),
293 'cpu_usage': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '2'}),
294 'disk_io': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
295 'elapsed_time': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '2'}),
296 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
297 'line_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
298 'logfile': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
299 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
300 'order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
301 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
302 'path_to_sstate_obj': ('django.db.models.fields.FilePathField', [], {'max_length': '500', 'blank': 'True'}),
303 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tasks'", 'to': u"orm['orm.Recipe']"}),
304 'script_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
305 'source_url': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
306 'sstate_checksum': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
307 'sstate_result': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
308 'task_executed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
309 'task_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
310 'work_directory': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'})
311 },
312 u'orm.task_dependency': {
313 'Meta': {'object_name': 'Task_Dependency'},
314 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_depends'", 'to': u"orm['orm.Task']"}),
315 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
316 'task': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_task'", 'to': u"orm['orm.Task']"})
317 },
318 u'orm.toastersetting': {
319 'Meta': {'object_name': 'ToasterSetting'},
320 'helptext': ('django.db.models.fields.TextField', [], {}),
321 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
322 'name': ('django.db.models.fields.CharField', [], {'max_length': '63'}),
323 'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
324 },
325 u'orm.variable': {
326 'Meta': {'object_name': 'Variable'},
327 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'variable_build'", 'to': u"orm['orm.Build']"}),
328 'changed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
329 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
330 'human_readable_name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
331 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
332 'variable_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
333 'variable_value': ('django.db.models.fields.TextField', [], {'blank': 'True'})
334 },
335 u'orm.variablehistory': {
336 'Meta': {'object_name': 'VariableHistory'},
337 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
338 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
339 'line_number': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
340 'operation': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
341 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
342 'variable': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'vhistory'", 'to': u"orm['orm.Variable']"})
343 }
344 }
345
346 complete_apps = ['orm']
diff --git a/bitbake/lib/toaster/orm/migrations/0026_set_default_project.py b/bitbake/lib/toaster/orm/migrations/0026_set_default_project.py
new file mode 100644
index 0000000000..6240abd854
--- /dev/null
+++ b/bitbake/lib/toaster/orm/migrations/0026_set_default_project.py
@@ -0,0 +1,374 @@
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# data-only migration to set the is_default field correctly
8# across all projects, so it has the correct value on a single
9# record only; this will add or amend default project (marked with
10# is_default = True)
11class Migration(SchemaMigration):
12
13 no_dry_run = True
14
15 # work-around for http://south.aeracode.org/ticket/578:
16 # SQLite boolean fields aren't set to the correct default value
17 # when added to existing records (value needs to be 0 or 1, rather
18 # than True or False), so manually update that field for all
19 # existing records
20 def _sqlite_update_all_projects_is_default(self, orm):
21 if db.backend_name == 'sqlite3':
22 for project in orm.Project.objects.all():
23 project.is_default = 0
24 project.save()
25
26 def forwards(self, orm):
27 # fix is_default field
28 self._sqlite_update_all_projects_is_default(orm)
29
30 # now create or modify the default project
31 project = None
32
33 # check for existing default project with ID 0 which has
34 # already been added in code
35 projects = orm.Project.objects.filter(pk = 0)
36
37 if len(projects) == 1:
38 project = projects[0]
39 else:
40 # create default project
41 options = {
42 "name": "Command line builds",
43 "short_description": "Project for builds started outside Toaster"
44 }
45 project = orm.Project.objects.create(**options)
46
47 project.is_default = True
48 project.save()
49
50 def backwards(self, orm):
51 # don't do anything when reversing this migration, as we can safely
52 # keep any generated default project which has builds attached;
53 # it's just that the old code won't use that project as the
54 # container for any new builds, as it doesn't have an ID of 0
55 pass
56
57 models = {
58 u'orm.bitbakeversion': {
59 'Meta': {'object_name': 'BitbakeVersion'},
60 'branch': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
61 'dirpath': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
62 'giturl': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
63 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
64 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'})
65 },
66 u'orm.branch': {
67 'Meta': {'unique_together': "(('layer_source', 'name'), ('layer_source', 'up_id'))", 'object_name': 'Branch'},
68 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
69 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'True', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
70 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
71 'short_description': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
72 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
73 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
74 },
75 u'orm.build': {
76 'Meta': {'object_name': 'Build'},
77 'bitbake_version': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
78 'build_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
79 'completed_on': ('django.db.models.fields.DateTimeField', [], {}),
80 'cooker_log_path': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
81 'distro': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
82 'distro_version': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
83 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
84 'machine': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
85 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
86 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}),
87 'started_on': ('django.db.models.fields.DateTimeField', [], {})
88 },
89 u'orm.buildartifact': {
90 'Meta': {'object_name': 'BuildArtifact'},
91 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
92 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '100'}),
93 'file_size': ('django.db.models.fields.IntegerField', [], {}),
94 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
95 },
96 u'orm.helptext': {
97 'Meta': {'object_name': 'HelpText'},
98 'area': ('django.db.models.fields.IntegerField', [], {}),
99 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'helptext_build'", 'to': u"orm['orm.Build']"}),
100 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
101 'key': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
102 'text': ('django.db.models.fields.TextField', [], {})
103 },
104 u'orm.layer': {
105 'Meta': {'unique_together': "(('layer_source', 'up_id'), ('layer_source', 'name'))", 'object_name': 'Layer'},
106 'description': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'}),
107 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
108 'layer_index_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
109 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
110 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
111 'summary': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'}),
112 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
113 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'}),
114 'vcs_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'}),
115 'vcs_web_file_base_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'}),
116 'vcs_web_tree_base_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'}),
117 'vcs_web_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'})
118 },
119 u'orm.layer_version': {
120 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'Layer_Version'},
121 'branch': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
122 'build': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'layer_version_build'", 'null': 'True', 'to': u"orm['orm.Build']"}),
123 'commit': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
124 'dirpath': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True'}),
125 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
126 'layer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'layer_version_layer'", 'to': u"orm['orm.Layer']"}),
127 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
128 'local_path': ('django.db.models.fields.FilePathField', [], {'default': "'/'", 'max_length': '1024'}),
129 'priority': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
130 'project': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.Project']", 'null': 'True'}),
131 'up_branch': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.Branch']", 'null': 'True'}),
132 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
133 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
134 },
135 u'orm.layersource': {
136 'Meta': {'unique_together': "(('sourcetype', 'apiurl'),)", 'object_name': 'LayerSource'},
137 'apiurl': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True'}),
138 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
139 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '63'}),
140 'sourcetype': ('django.db.models.fields.IntegerField', [], {})
141 },
142 u'orm.layerversiondependency': {
143 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'LayerVersionDependency'},
144 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'dependees'", 'to': u"orm['orm.Layer_Version']"}),
145 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
146 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
147 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'dependencies'", 'to': u"orm['orm.Layer_Version']"}),
148 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
149 },
150 u'orm.logmessage': {
151 'Meta': {'object_name': 'LogMessage'},
152 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
153 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
154 'level': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
155 'lineno': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
156 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
157 'pathname': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
158 'task': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Task']", 'null': 'True', 'blank': 'True'})
159 },
160 u'orm.machine': {
161 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'Machine'},
162 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
163 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
164 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
165 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Layer_Version']"}),
166 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
167 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
168 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
169 },
170 u'orm.package': {
171 'Meta': {'object_name': 'Package'},
172 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
173 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
174 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
175 'installed_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'}),
176 'installed_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
177 'license': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
178 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
179 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Recipe']", 'null': 'True'}),
180 'revision': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
181 'section': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
182 'size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
183 'summary': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
184 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
185 },
186 u'orm.package_dependency': {
187 'Meta': {'object_name': 'Package_Dependency'},
188 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
189 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_target'", 'to': u"orm['orm.Package']"}),
190 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
191 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_source'", 'to': u"orm['orm.Package']"}),
192 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']", 'null': 'True'})
193 },
194 u'orm.package_file': {
195 'Meta': {'object_name': 'Package_File'},
196 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
197 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'buildfilelist_package'", 'to': u"orm['orm.Package']"}),
198 'path': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
199 'size': ('django.db.models.fields.IntegerField', [], {})
200 },
201 u'orm.project': {
202 'Meta': {'object_name': 'Project'},
203 'bitbake_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.BitbakeVersion']", 'null': 'True'}),
204 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
205 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
206 'is_default': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
207 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
208 'release': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Release']", 'null': 'True'}),
209 'short_description': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
210 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
211 'user_id': ('django.db.models.fields.IntegerField', [], {'null': 'True'})
212 },
213 u'orm.projectlayer': {
214 'Meta': {'unique_together': "(('project', 'layercommit'),)", 'object_name': 'ProjectLayer'},
215 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
216 'layercommit': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Layer_Version']", 'null': 'True'}),
217 'optional': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
218 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"})
219 },
220 u'orm.projecttarget': {
221 'Meta': {'object_name': 'ProjectTarget'},
222 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
223 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}),
224 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
225 'task': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'})
226 },
227 u'orm.projectvariable': {
228 'Meta': {'object_name': 'ProjectVariable'},
229 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
230 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
231 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}),
232 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'})
233 },
234 u'orm.recipe': {
235 'Meta': {'unique_together': "(('layer_version', 'file_path', 'pathflags'),)", 'object_name': 'Recipe'},
236 'bugtracker': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
237 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
238 'file_path': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
239 'homepage': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
240 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
241 'is_image': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
242 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
243 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'recipe_layer_version'", 'to': u"orm['orm.Layer_Version']"}),
244 'license': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
245 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
246 'pathflags': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
247 'section': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
248 'summary': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
249 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
250 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'}),
251 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
252 },
253 u'orm.recipe_dependency': {
254 'Meta': {'object_name': 'Recipe_Dependency'},
255 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
256 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_depends'", 'to': u"orm['orm.Recipe']"}),
257 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
258 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_recipe'", 'to': u"orm['orm.Recipe']"})
259 },
260 u'orm.release': {
261 'Meta': {'object_name': 'Release'},
262 'bitbake_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.BitbakeVersion']"}),
263 'branch_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50'}),
264 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
265 'helptext': ('django.db.models.fields.TextField', [], {'null': 'True'}),
266 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
267 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'})
268 },
269 u'orm.releasedefaultlayer': {
270 'Meta': {'object_name': 'ReleaseDefaultLayer'},
271 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
272 'layer_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'}),
273 'release': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Release']"})
274 },
275 u'orm.releaselayersourcepriority': {
276 'Meta': {'unique_together': "(('release', 'layer_source'),)", 'object_name': 'ReleaseLayerSourcePriority'},
277 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
278 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.LayerSource']"}),
279 'priority': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
280 'release': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Release']"})
281 },
282 u'orm.target': {
283 'Meta': {'object_name': 'Target'},
284 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
285 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
286 'image_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
287 'is_image': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
288 'license_manifest_path': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True'}),
289 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
290 'task': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'})
291 },
292 u'orm.target_file': {
293 'Meta': {'object_name': 'Target_File'},
294 'directory': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'directory_set'", 'null': 'True', 'to': u"orm['orm.Target_File']"}),
295 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
296 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
297 'inodetype': ('django.db.models.fields.IntegerField', [], {}),
298 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
299 'path': ('django.db.models.fields.FilePathField', [], {'max_length': '100'}),
300 'permission': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
301 'size': ('django.db.models.fields.IntegerField', [], {}),
302 'sym_target': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'symlink_set'", 'null': 'True', 'to': u"orm['orm.Target_File']"}),
303 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
304 },
305 u'orm.target_image_file': {
306 'Meta': {'object_name': 'Target_Image_File'},
307 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '254'}),
308 'file_size': ('django.db.models.fields.IntegerField', [], {}),
309 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
310 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
311 },
312 u'orm.target_installed_package': {
313 'Meta': {'object_name': 'Target_Installed_Package'},
314 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
315 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'buildtargetlist_package'", 'to': u"orm['orm.Package']"}),
316 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
317 },
318 u'orm.task': {
319 'Meta': {'ordering': "('order', 'recipe')", 'unique_together': "(('build', 'recipe', 'task_name'),)", 'object_name': 'Task'},
320 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_build'", 'to': u"orm['orm.Build']"}),
321 'cpu_usage': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '2'}),
322 'disk_io': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
323 'elapsed_time': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '2'}),
324 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
325 'line_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
326 'logfile': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
327 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
328 'order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
329 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
330 'path_to_sstate_obj': ('django.db.models.fields.FilePathField', [], {'max_length': '500', 'blank': 'True'}),
331 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tasks'", 'to': u"orm['orm.Recipe']"}),
332 'script_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
333 'source_url': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
334 'sstate_checksum': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
335 'sstate_result': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
336 'task_executed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
337 'task_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
338 'work_directory': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'})
339 },
340 u'orm.task_dependency': {
341 'Meta': {'object_name': 'Task_Dependency'},
342 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_depends'", 'to': u"orm['orm.Task']"}),
343 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
344 'task': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_task'", 'to': u"orm['orm.Task']"})
345 },
346 u'orm.toastersetting': {
347 'Meta': {'object_name': 'ToasterSetting'},
348 'helptext': ('django.db.models.fields.TextField', [], {}),
349 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
350 'name': ('django.db.models.fields.CharField', [], {'max_length': '63'}),
351 'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
352 },
353 u'orm.variable': {
354 'Meta': {'object_name': 'Variable'},
355 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'variable_build'", 'to': u"orm['orm.Build']"}),
356 'changed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
357 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
358 'human_readable_name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
359 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
360 'variable_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
361 'variable_value': ('django.db.models.fields.TextField', [], {'blank': 'True'})
362 },
363 u'orm.variablehistory': {
364 'Meta': {'object_name': 'VariableHistory'},
365 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
366 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
367 'line_number': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
368 'operation': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
369 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
370 'variable': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'vhistory'", 'to': u"orm['orm.Variable']"})
371 }
372 }
373
374 complete_apps = ['orm']
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 58f76a8342..e4d2e87ae9 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -94,11 +94,15 @@ class ProjectManager(models.Manager):
94 def create(self, *args, **kwargs): 94 def create(self, *args, **kwargs):
95 raise Exception("Invalid call to Project.objects.create. Use Project.objects.create_project() to create a project") 95 raise Exception("Invalid call to Project.objects.create. Use Project.objects.create_project() to create a project")
96 96
97 def get_or_create(self, **kwargs): 97 # return single object with is_default = True
98 # allow project creation for default data 98 def get_default_project(self):
99 if 'pk' in kwargs and kwargs['pk'] == 0: 99 projects = super(ProjectManager, self).filter(is_default = True)
100 return super(ProjectManager, self).get_or_create(**kwargs) 100 if len(projects) > 1:
101 raise Exception("Invalid call to Project.objects.get_or_create. Use Project.objects.create_project() to create a project") 101 raise Exception("Inconsistent project data: multiple " +
102 "default projects (i.e. with is_default=True)")
103 elif len(projects) < 1:
104 raise Exception("Inconsistent project data: no default project found")
105 return projects[0]
102 106
103class Project(models.Model): 107class Project(models.Model):
104 search_allowed_fields = ['name', 'short_description', 'release__name', 'release__branch_name'] 108 search_allowed_fields = ['name', 'short_description', 'release__name', 'release__branch_name']
@@ -115,6 +119,10 @@ class Project(models.Model):
115 user_id = models.IntegerField(null = True) 119 user_id = models.IntegerField(null = True)
116 objects = ProjectManager() 120 objects = ProjectManager()
117 121
122 # set to True for the project which is the default container
123 # for builds initiated by the command line etc.
124 is_default = models.BooleanField(default = False)
125
118 def __unicode__(self): 126 def __unicode__(self):
119 return "%s (Release %s, BBV %s)" % (self.name, self.release, self.bitbake_version) 127 return "%s (Release %s, BBV %s)" % (self.name, self.release, self.bitbake_version)
120 128