summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-11-24 12:52:49 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-11-28 14:02:58 +0000
commit4c82dfbb70477c3b48327f235de62ec7ce203c11 (patch)
tree363a4ab8cf66ee88ec82fbafaa701282426f052a /bitbake
parent152e2d9cc533c70cf3172c165d00ee177fb4aa78 (diff)
downloadpoky-4c82dfbb70477c3b48327f235de62ec7ce203c11.tar.gz
bitbake: toastergui: update layer search criteria
In order to accomodate the designs around imported layer, we add a "project" field for in the layer versions. The field must be set if and only if the layer is manually imported in the project. This will prevent information leakage between different projects. The views have been updated to perform relevant layer queries in a single location. (Bitbake rev: e1f7ec868b0702dfd27d5708581c134aaa6f4ae8) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/orm/migrations/0018_auto__add_field_layer_version_project.py331
-rw-r--r--bitbake/lib/toaster/orm/models.py4
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py59
3 files changed, 371 insertions, 23 deletions
diff --git a/bitbake/lib/toaster/orm/migrations/0018_auto__add_field_layer_version_project.py b/bitbake/lib/toaster/orm/migrations/0018_auto__add_field_layer_version_project.py
new file mode 100644
index 0000000000..7284bb8429
--- /dev/null
+++ b/bitbake/lib/toaster/orm/migrations/0018_auto__add_field_layer_version_project.py
@@ -0,0 +1,331 @@
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 field 'Layer_Version.project'
12 db.add_column(u'orm_layer_version', 'project',
13 self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['orm.Project'], null=True),
14 keep_default=False)
15
16
17 def backwards(self, orm):
18 # Deleting field 'Layer_Version.project'
19 db.delete_column(u'orm_layer_version', 'project_id')
20
21
22 models = {
23 u'orm.bitbakeversion': {
24 'Meta': {'object_name': 'BitbakeVersion'},
25 'branch': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
26 'dirpath': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
27 'giturl': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
28 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
29 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'})
30 },
31 u'orm.branch': {
32 'Meta': {'unique_together': "(('layer_source', 'name'), ('layer_source', 'up_id'))", 'object_name': 'Branch'},
33 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
34 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'True', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
35 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
36 'short_description': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
37 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
38 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
39 },
40 u'orm.build': {
41 'Meta': {'object_name': 'Build'},
42 'bitbake_version': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
43 'build_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
44 'completed_on': ('django.db.models.fields.DateTimeField', [], {}),
45 'cooker_log_path': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
46 'distro': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
47 'distro_version': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
48 'errors_no': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
49 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
50 'machine': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
51 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
52 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']", 'null': 'True'}),
53 'started_on': ('django.db.models.fields.DateTimeField', [], {}),
54 'timespent': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
55 'warnings_no': ('django.db.models.fields.IntegerField', [], {'default': '0'})
56 },
57 u'orm.helptext': {
58 'Meta': {'object_name': 'HelpText'},
59 'area': ('django.db.models.fields.IntegerField', [], {}),
60 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'helptext_build'", 'to': u"orm['orm.Build']"}),
61 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
62 'key': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
63 'text': ('django.db.models.fields.TextField', [], {})
64 },
65 u'orm.layer': {
66 'Meta': {'unique_together': "(('layer_source', 'up_id'), ('layer_source', 'name'))", 'object_name': 'Layer'},
67 'description': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'}),
68 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
69 'layer_index_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
70 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
71 'local_path': ('django.db.models.fields.FilePathField', [], {'default': 'None', 'max_length': '255', 'null': 'True'}),
72 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
73 'summary': ('django.db.models.fields.TextField', [], {'default': 'None', 'null': 'True'}),
74 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
75 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'}),
76 'vcs_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'}),
77 'vcs_web_file_base_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'}),
78 'vcs_web_tree_base_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'}),
79 'vcs_web_url': ('django.db.models.fields.URLField', [], {'default': 'None', 'max_length': '200', 'null': 'True'})
80 },
81 u'orm.layer_version': {
82 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'Layer_Version'},
83 'branch': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
84 'build': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'layer_version_build'", 'null': 'True', 'to': u"orm['orm.Build']"}),
85 'commit': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
86 'dirpath': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True'}),
87 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
88 'layer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'layer_version_layer'", 'to': u"orm['orm.Layer']"}),
89 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
90 'priority': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
91 'project': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.Project']", 'null': 'True'}),
92 'up_branch': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.Branch']", 'null': 'True'}),
93 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
94 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
95 },
96 u'orm.layersource': {
97 'Meta': {'unique_together': "(('sourcetype', 'apiurl'),)", 'object_name': 'LayerSource'},
98 'apiurl': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '255', 'null': 'True'}),
99 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
100 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '63'}),
101 'sourcetype': ('django.db.models.fields.IntegerField', [], {})
102 },
103 u'orm.layerversiondependency': {
104 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'LayerVersionDependency'},
105 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'dependees'", 'to': u"orm['orm.Layer_Version']"}),
106 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
107 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
108 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'dependencies'", 'to': u"orm['orm.Layer_Version']"}),
109 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
110 },
111 u'orm.logmessage': {
112 'Meta': {'object_name': 'LogMessage'},
113 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
114 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
115 'level': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
116 'lineno': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
117 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
118 'pathname': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
119 'task': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Task']", 'null': 'True', 'blank': 'True'})
120 },
121 u'orm.machine': {
122 'Meta': {'unique_together': "(('layer_source', 'up_id'),)", 'object_name': 'Machine'},
123 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
124 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
125 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
126 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Layer_Version']"}),
127 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
128 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
129 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'})
130 },
131 u'orm.package': {
132 'Meta': {'object_name': 'Package'},
133 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
134 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
135 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
136 'installed_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'}),
137 'installed_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
138 'license': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
139 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
140 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Recipe']", 'null': 'True'}),
141 'revision': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
142 'section': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
143 'size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
144 'summary': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
145 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
146 },
147 u'orm.package_dependency': {
148 'Meta': {'object_name': 'Package_Dependency'},
149 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
150 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_target'", 'to': u"orm['orm.Package']"}),
151 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
152 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_source'", 'to': u"orm['orm.Package']"}),
153 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']", 'null': 'True'})
154 },
155 u'orm.package_file': {
156 'Meta': {'object_name': 'Package_File'},
157 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
158 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'buildfilelist_package'", 'to': u"orm['orm.Package']"}),
159 'path': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
160 'size': ('django.db.models.fields.IntegerField', [], {})
161 },
162 u'orm.project': {
163 'Meta': {'object_name': 'Project'},
164 'bitbake_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.BitbakeVersion']"}),
165 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
166 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
167 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
168 'release': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Release']"}),
169 'short_description': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
170 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
171 'user_id': ('django.db.models.fields.IntegerField', [], {'null': 'True'})
172 },
173 u'orm.projectlayer': {
174 'Meta': {'unique_together': "(('project', 'layercommit'),)", 'object_name': 'ProjectLayer'},
175 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
176 'layercommit': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Layer_Version']", 'null': 'True'}),
177 'optional': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
178 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"})
179 },
180 u'orm.projecttarget': {
181 'Meta': {'object_name': 'ProjectTarget'},
182 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
183 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}),
184 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
185 'task': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'})
186 },
187 u'orm.projectvariable': {
188 'Meta': {'object_name': 'ProjectVariable'},
189 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
190 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
191 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}),
192 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'})
193 },
194 u'orm.recipe': {
195 'Meta': {'unique_together': "(('layer_version', 'file_path'),)", 'object_name': 'Recipe'},
196 'bugtracker': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
197 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
198 'file_path': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
199 'homepage': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
200 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
201 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': u"orm['orm.LayerSource']", 'null': 'True'}),
202 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'recipe_layer_version'", 'to': u"orm['orm.Layer_Version']"}),
203 'license': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
204 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
205 'section': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
206 'summary': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
207 'up_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
208 'up_id': ('django.db.models.fields.IntegerField', [], {'default': 'None', 'null': 'True'}),
209 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
210 },
211 u'orm.recipe_dependency': {
212 'Meta': {'object_name': 'Recipe_Dependency'},
213 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
214 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_depends'", 'to': u"orm['orm.Recipe']"}),
215 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
216 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_recipe'", 'to': u"orm['orm.Recipe']"})
217 },
218 u'orm.release': {
219 'Meta': {'object_name': 'Release'},
220 'bitbake_version': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.BitbakeVersion']"}),
221 'branch_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50'}),
222 'description': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
223 'helptext': ('django.db.models.fields.TextField', [], {'null': 'True'}),
224 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
225 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'})
226 },
227 u'orm.releasedefaultlayer': {
228 'Meta': {'object_name': 'ReleaseDefaultLayer'},
229 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
230 'layer_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'}),
231 'release': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Release']"})
232 },
233 u'orm.releaselayersourcepriority': {
234 'Meta': {'unique_together': "(('release', 'layer_source'),)", 'object_name': 'ReleaseLayerSourcePriority'},
235 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
236 'layer_source': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.LayerSource']"}),
237 'priority': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
238 'release': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Release']"})
239 },
240 u'orm.target': {
241 'Meta': {'object_name': 'Target'},
242 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
243 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
244 'image_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
245 'is_image': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
246 'license_manifest_path': ('django.db.models.fields.CharField', [], {'max_length': '500', 'null': 'True'}),
247 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'})
248 },
249 u'orm.target_file': {
250 'Meta': {'object_name': 'Target_File'},
251 'directory': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'directory_set'", 'null': 'True', 'to': u"orm['orm.Target_File']"}),
252 'group': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
253 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
254 'inodetype': ('django.db.models.fields.IntegerField', [], {}),
255 'owner': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
256 'path': ('django.db.models.fields.FilePathField', [], {'max_length': '100'}),
257 'permission': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
258 'size': ('django.db.models.fields.IntegerField', [], {}),
259 'sym_target': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'symlink_set'", 'null': 'True', 'to': u"orm['orm.Target_File']"}),
260 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
261 },
262 u'orm.target_image_file': {
263 'Meta': {'object_name': 'Target_Image_File'},
264 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '254'}),
265 'file_size': ('django.db.models.fields.IntegerField', [], {}),
266 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
267 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
268 },
269 u'orm.target_installed_package': {
270 'Meta': {'object_name': 'Target_Installed_Package'},
271 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
272 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'buildtargetlist_package'", 'to': u"orm['orm.Package']"}),
273 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
274 },
275 u'orm.task': {
276 'Meta': {'ordering': "('order', 'recipe')", 'unique_together': "(('build', 'recipe', 'task_name'),)", 'object_name': 'Task'},
277 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_build'", 'to': u"orm['orm.Build']"}),
278 'cpu_usage': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '6', 'decimal_places': '2'}),
279 'disk_io': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
280 'elapsed_time': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '6', 'decimal_places': '2'}),
281 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
282 'line_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
283 'logfile': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
284 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
285 'order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
286 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
287 'path_to_sstate_obj': ('django.db.models.fields.FilePathField', [], {'max_length': '500', 'blank': 'True'}),
288 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'build_recipe'", 'to': u"orm['orm.Recipe']"}),
289 'script_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
290 'source_url': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
291 'sstate_checksum': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
292 'sstate_result': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
293 'task_executed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
294 'task_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
295 'work_directory': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'})
296 },
297 u'orm.task_dependency': {
298 'Meta': {'object_name': 'Task_Dependency'},
299 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_depends'", 'to': u"orm['orm.Task']"}),
300 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
301 'task': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_task'", 'to': u"orm['orm.Task']"})
302 },
303 u'orm.toastersetting': {
304 'Meta': {'object_name': 'ToasterSetting'},
305 'helptext': ('django.db.models.fields.TextField', [], {}),
306 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
307 'name': ('django.db.models.fields.CharField', [], {'max_length': '63'}),
308 'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
309 },
310 u'orm.variable': {
311 'Meta': {'object_name': 'Variable'},
312 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'variable_build'", 'to': u"orm['orm.Build']"}),
313 'changed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
314 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
315 'human_readable_name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
316 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
317 'variable_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
318 'variable_value': ('django.db.models.fields.TextField', [], {'blank': 'True'})
319 },
320 u'orm.variablehistory': {
321 'Meta': {'object_name': 'VariableHistory'},
322 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
323 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
324 'line_number': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
325 'operation': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
326 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
327 'variable': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'vhistory'", 'to': u"orm['orm.Variable']"})
328 }
329 }
330
331 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 99cc695012..364b215814 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -843,6 +843,8 @@ class Layer_Version(models.Model):
843 dirpath = models.CharField(max_length=255, null = True, default = None) # LayerBranch.vcs_subdir 843 dirpath = models.CharField(max_length=255, null = True, default = None) # LayerBranch.vcs_subdir
844 priority = models.IntegerField(default = 0) # if -1, this is a default layer 844 priority = models.IntegerField(default = 0) # if -1, this is a default layer
845 845
846 project = models.ForeignKey('Project', null = True, default = None) # Set if this layer is project-specific; always set for imported layers, and project-set branches
847
846 # code lifted, with adaptations, from the layerindex-web application https://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/ 848 # code lifted, with adaptations, from the layerindex-web application https://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/
847 def _handle_url_path(self, base_url, path): 849 def _handle_url_path(self, base_url, path):
848 import re 850 import re
@@ -902,7 +904,7 @@ class Layer_Version(models.Model):
902 return sorted( 904 return sorted(
903 Layer_Version.objects.filter( layer__name = self.layer.name, up_branch__name = self.up_branch.name ), 905 Layer_Version.objects.filter( layer__name = self.layer.name, up_branch__name = self.up_branch.name ),
904 key = lambda x: _get_ls_priority(x.layer_source), 906 key = lambda x: _get_ls_priority(x.layer_source),
905 reverse = False) 907 reverse = True)
906 908
907 909
908 def __unicode__(self): 910 def __unicode__(self):
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index a0dcf8797a..11c373a84d 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -1935,7 +1935,21 @@ if toastermain.settings.MANAGED:
1935 1935
1936 raise Exception("Invalid HTTP method for this page") 1936 raise Exception("Invalid HTTP method for this page")
1937 1937
1938 # returns a queryset of compatible layers for a project
1939 def _compatible_layerversions_for_project(prj, release = None, layer_name = None):
1940 if release == None:
1941 release = prj.release
1942 # layers on the same branch or layers specifically set for this project
1943 return Layer_Version.objects.filter((Q(up_branch__name = release.branch_name) & Q(project = None)) | Q(project = prj))
1938 1944
1945
1946 # returns the equivalence group for all the layers currently set in the project
1947 def _project_equivalent_layerversions(prj):
1948 return reduce(lambda x, y: list(x) + list(y),
1949 # take all equivalent layers for each entry
1950 map(lambda x: x.layercommit.get_equivalents_wpriority(prj), prj.projectlayer_set.all()) , [])
1951
1952 # returns a list for most recent builds; for use in the Project page, xhr_ updates, and other places, as needed
1939 def _project_recent_build_list(prj): 1953 def _project_recent_build_list(prj):
1940 return map(lambda x: { 1954 return map(lambda x: {
1941 "id": x.pk, 1955 "id": x.pk,
@@ -2101,7 +2115,7 @@ if toastermain.settings.MANAGED:
2101 for i in prj.projectlayer_set.all(): 2115 for i in prj.projectlayer_set.all():
2102 # find and add a similarly-named layer on the new branch 2116 # find and add a similarly-named layer on the new branch
2103 try: 2117 try:
2104 lv = Layer_Version.objects.filter(layer__name = i.layercommit.layer.name, up_branch__name = prj.release.branch_name)[0].get_equivalents_wpriority(prj)[0] 2118 lv = _compatible_layerversions_for_project(prj).filter(layer__name = i.layer.name).get_equivalents_wpriority(prj)[0]
2105 ProjectLayer.objects.get_or_create(project = prj, layercommit = lv) 2119 ProjectLayer.objects.get_or_create(project = prj, layercommit = lv)
2106 except IndexError: 2120 except IndexError:
2107 pass 2121 pass
@@ -2140,30 +2154,32 @@ if toastermain.settings.MANAGED:
2140 else: 2154 else:
2141 raise Exception("No valid project selected") 2155 raise Exception("No valid project selected")
2142 2156
2143 # returns layers for current project release that are not in the project set 2157
2158 def _lv_to_dict(x):
2159 return {"id": x.pk, "name": x.layer.name,
2160 "detail": "(" + x.layer.vcs_url + (")" if x.up_branch == None else " | "+x.up_branch.name+")"),
2161 "giturl": x.layer.vcs_url, "layerdetailurl" : reverse('layerdetails', args=(x.pk,))}
2162
2163
2164 # returns layers for current project release that are not in the project set, matching the name
2144 if request.GET['type'] == "layers": 2165 if request.GET['type'] == "layers":
2145 queryset_all = Layer_Version.objects.filter(layer__name__icontains=request.GET.get('value','')) 2166 queryset_all = _compatible_layerversions_for_project(prj).filter(layer__name__icontains=request.GET.get('value',''))
2146 queryset_all = queryset_all.filter(up_branch__name= prj.release.branch_name).exclude(pk__in = [x.id for x in reduce(lambda x, y: list(x) + list(y), map(lambda x: x.layercommit.get_equivalents_wpriority(prj), prj.projectlayer_set.all()))]) 2167
2168 queryset_all = queryset_all.exclude(pk__in = [x.id for x in _project_equivalent_layerversions(prj)])
2147 2169
2148 queryset_all = set([x.get_equivalents_wpriority(prj)[0] for x in queryset_all[:8]]) 2170 queryset_all = set([x.get_equivalents_wpriority(prj)[0] for x in queryset_all[:8]])
2149 2171
2150 return HttpResponse(jsonfilter( { "error":"ok", 2172 return HttpResponse(jsonfilter( { "error":"ok", "list" : map( _lv_to_dict, queryset_all) }), content_type = "application/json")
2151 "list" : map( lambda x: {"id": x.pk, "name": "%s" % (x.layer.name, ), "detail": "(" + x.layer.vcs_url + (")" if x.up_branch == None else " | "+x.up_branch.name+")")},
2152 queryset_all)
2153 }), content_type = "application/json")
2154 2173
2155 2174
2156 # returns layer dependencies for a layer, excluding current project layers 2175 # returns layer dependencies for a layer, excluding current project layers
2157 if request.GET['type'] == "layerdeps": 2176 if request.GET['type'] == "layerdeps":
2158 queryset_all = LayerVersionDependency.objects.filter(layer_version_id = request.GET['value']) 2177 queryset_all = LayerVersionDependency.objects.filter(layer_version_id = request.GET['value'])
2159 queryset_all = queryset_all.exclude(depends_on__in = reduce(lambda x, y: list(x) + list(y), map(lambda x: x.layercommit.get_equivalents_wpriority(prj), prj.projectlayer_set.all()))) 2178 queryset_all = queryset_all.exclude(depends_on__in = _project_equivalent_layerversions(prj))
2160 queryset_all.order_by("-up_id"); 2179 queryset_all.order_by("-up_id");
2161 2180
2162 return HttpResponse(jsonfilter( { "error":"ok", 2181 return HttpResponse(jsonfilter( { "error":"ok",
2163 "list" : map( 2182 "list" : map( _lv_to_dict, map(lambda x: x.depends_on.get_equivalents_wpriority(prj)[0], queryset_all))
2164 lambda x: {"id": x.pk, "name": x.layer.name, "detail": "(" + x.layer.layer_source.name + (")" if x.up_branch == None else " | "+x.up_branch.name+")"),
2165 "giturl": x.layer.vcs_url, "layerdetailurl" : reverse('layerdetails', args=(x.pk,))},
2166 map(lambda x: x.depends_on.get_equivalents_wpriority(prj)[0], queryset_all))
2167 }), content_type = "application/json") 2183 }), content_type = "application/json")
2168 2184
2169 2185
@@ -2174,20 +2190,20 @@ if toastermain.settings.MANAGED:
2174 2190
2175 retval = [] 2191 retval = []
2176 for i in prj.projectlayer_set.all(): 2192 for i in prj.projectlayer_set.all():
2177 lv = Layer_Version.objects.filter(layer__name = i.layercommit.layer.name, up_branch__name = Release.objects.get(pk=request.GET['value']).branch_name) 2193 lv = _compatible_layerversions_for_project(prj, release = Release.objects.get(pk=request.GET['value']))
2178 if lv.count() < 1: # there is no layer_version with the new release id, and the same name 2194 # there is no layer_version with the new release id, and the same name
2195 if lv.count() < 1:
2179 retval.append(i) 2196 retval.append(i)
2180 2197
2181 return HttpResponse(jsonfilter( {"error":"ok", 2198 return HttpResponse(jsonfilter( {"error":"ok",
2182 "list": map( 2199 "list" : map( _lv_to_dict, map(lambda x: x.layercommit, retval ))
2183 lambda x: {"id": x.layercommit.pk, "name": x.layercommit.layer.name, "detail": "(" + x.layercommit.layer.layer_source.name + (")" if x.layercommit.up_branch == None else " | "+x.layercommit.up_branch.name+")")}, 2200 }), content_type = "application/json")
2184 retval) }), content_type = "application/json")
2185 2201
2186 2202
2187 # returns targets provided by current project layers 2203 # returns targets provided by current project layers
2188 if request.GET['type'] == "targets": 2204 if request.GET['type'] == "targets":
2189 queryset_all = Recipe.objects.all() 2205 queryset_all = Recipe.objects.all()
2190 queryset_all = queryset_all.filter(layer_version__in = reduce(lambda x, y: list(x) + list(y), map(lambda x: x.layercommit.get_equivalents_wpriority(prj), ProjectLayer.objects.filter(project = prj)))) 2206 queryset_all = queryset_all.filter(layer_version__in = reduce(lambda x, y: list(x) + list(y), map(lambda x: x.layercommit.get_equivalents_wpriority(prj), prj.projectlayer_set.all()), []))
2191 return HttpResponse(jsonfilter({ "error":"ok", 2207 return HttpResponse(jsonfilter({ "error":"ok",
2192 "list" : map ( lambda x: {"id": x.pk, "name": x.name, "detail":"[" + x.layer_version.layer.name+ (" | " + x.layer_version.up_branch.name + "]" if x.layer_version.up_branch is not None else "]")}, 2208 "list" : map ( lambda x: {"id": x.pk, "name": x.name, "detail":"[" + x.layer_version.layer.name+ (" | " + x.layer_version.up_branch.name + "]" if x.layer_version.up_branch is not None else "]")},
2193 queryset_all.filter(name__icontains=request.GET.get('value',''))[:8]), 2209 queryset_all.filter(name__icontains=request.GET.get('value',''))[:8]),
@@ -2243,10 +2259,9 @@ if toastermain.settings.MANAGED:
2243 # for that object type. copypasta for all needed table searches 2259 # for that object type. copypasta for all needed table searches
2244 (filter_string, search_term, ordering_string) = _search_tuple(request, Layer_Version) 2260 (filter_string, search_term, ordering_string) = _search_tuple(request, Layer_Version)
2245 2261
2246 queryset_all = Layer_Version.objects.all()
2247
2248 prj = Project.objects.get(pk = request.session['project_id']) 2262 prj = Project.objects.get(pk = request.session['project_id'])
2249 queryset_all = queryset_all.filter(up_branch__name = prj.release.branch_name) 2263
2264 queryset_all = _compatible_layerversions_for_project(prj)
2250 2265
2251 queryset_all = _get_queryset(Layer_Version, queryset_all, filter_string, search_term, ordering_string, '-layer__name') 2266 queryset_all = _get_queryset(Layer_Version, queryset_all, filter_string, search_term, ordering_string, '-layer__name')
2252 2267