summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/orm/models.py21
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py22
2 files changed, 17 insertions, 26 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index b25910aaac..f07fedaf02 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -195,23 +195,6 @@ class Project(models.Model):
195 except (Variable.DoesNotExist,IndexError): 195 except (Variable.DoesNotExist,IndexError):
196 return( "not_found" ) 196 return( "not_found" )
197 197
198 # returns a queryset of compatible layers for a project
199 def compatible_layerversions(self, release = None, layer_name = None):
200 logger.warning("This function is deprecated")
201 if release == None:
202 release = self.release
203 # layers on the same branch or layers specifically set for this project
204 queryset = Layer_Version.objects.filter(((Q(up_branch__name = release.branch_name) & Q(project = None)) | Q(project = self)) & Q(build__isnull=True))
205
206 if layer_name is not None:
207 # we select only a layer name
208 queryset = queryset.filter(layer__name = layer_name)
209
210 # order by layer version priority
211 queryset = queryset.filter(Q(layer_source=None) | Q(layer_source__releaselayersourcepriority__release = release)).select_related('layer_source', 'layer', 'up_branch', "layer_source__releaselayersourcepriority__priority").order_by("-layer_source__releaselayersourcepriority__priority")
212
213 return queryset
214
215 def get_all_compatible_layer_versions(self): 198 def get_all_compatible_layer_versions(self):
216 """ Returns Queryset of all Layer_Versions which are compatible with 199 """ Returns Queryset of all Layer_Versions which are compatible with
217 this project""" 200 this project"""
@@ -1184,7 +1167,9 @@ class Layer_Version(models.Model):
1184 return self._handle_url_path(self.layer.vcs_web_tree_base_url, '') 1167 return self._handle_url_path(self.layer.vcs_web_tree_base_url, '')
1185 1168
1186 def get_equivalents_wpriority(self, project): 1169 def get_equivalents_wpriority(self, project):
1187 return project.compatible_layerversions(layer_name = self.layer.name) 1170 layer_versions = project.get_all_compatible_layer_versions()
1171 filtered = layer_versions.filter(layer__name = self.layer.name)
1172 return filtered.order_by("-layer_source__releaselayersourcepriority__priority")
1188 1173
1189 def get_vcs_reference(self): 1174 def get_vcs_reference(self):
1190 if self.branch is not None and len(self.branch) > 0: 1175 if self.branch is not None and len(self.branch) > 0:
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 16f27b8022..bd334b9f80 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2264,16 +2264,17 @@ if True:
2264 prj.bitbake_version = prj.release.bitbake_version 2264 prj.bitbake_version = prj.release.bitbake_version
2265 prj.save() 2265 prj.save()
2266 # we need to change the layers 2266 # we need to change the layers
2267 for i in prj.projectlayer_set.all(): 2267 for project in prj.projectlayer_set.all():
2268 # find and add a similarly-named layer on the new branch 2268 # find and add a similarly-named layer on the new branch
2269 try: 2269 try:
2270 lv = prj.compatible_layerversions(layer_name = i.layercommit.layer.name)[0] 2270 layer_versions = prj.get_all_compatible_layer_versions()
2271 ProjectLayer.objects.get_or_create(project = prj, layercommit = lv) 2271 layer_versions = layer_versions.filter(layer__name = project.layercommit.layer.name)
2272 ProjectLayer.objects.get_or_create(project = prj, layercommit = layer_versions.first())
2272 except IndexError: 2273 except IndexError:
2273 pass 2274 pass
2274 finally: 2275 finally:
2275 # get rid of the old entry 2276 # get rid of the old entry
2276 i.delete() 2277 project.delete()
2277 2278
2278 if 'machineName' in request.POST: 2279 if 'machineName' in request.POST:
2279 machinevar = prj.projectvariable_set.get(name="MACHINE") 2280 machinevar = prj.projectvariable_set.get(name="MACHINE")
@@ -2383,12 +2384,17 @@ if True:
2383 2384
2384 retval = [] 2385 retval = []
2385 2386
2386 for i in prj.projectlayer_set.all(): 2387 for project in prj.projectlayer_set.all():
2387 lv = prj.compatible_layerversions(release = Release.objects.get(pk=new_release_id)).filter(layer__name = i.layercommit.layer.name) 2388 release = Release.objects.get(pk = new_release_id)
2389
2390 layer_versions = prj.get_all_compatible_layer_versions()
2391 layer_versions = layer_versions.filter(release = release)
2392 layer_versions = layer_versions.filter(layer__name = project.layercommit.layer.name)
2393
2388 # there is no layer_version with the new release id, 2394 # there is no layer_version with the new release id,
2389 # and the same name 2395 # and the same name
2390 if lv.count() < 1: 2396 if layer_versions.count() < 1:
2391 retval.append(i) 2397 retval.append(project)
2392 2398
2393 return response({"error":"ok", 2399 return response({"error":"ok",
2394 "rows" : map( _lv_to_dict(prj), 2400 "rows" : map( _lv_to_dict(prj),