summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/orm/models.py34
1 files changed, 28 insertions, 6 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 77afe35861..1b3bb22e79 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -585,25 +585,48 @@ class LayerIndexLayerSource(LayerSource):
585 + "?filter=branch:%s" % "OR".join(map(lambda x: str(x.up_id), Branch.objects.filter(layer_source = self))) 585 + "?filter=branch:%s" % "OR".join(map(lambda x: str(x.up_id), Branch.objects.filter(layer_source = self)))
586 ) 586 )
587 for lbi in layerbranches_info: 587 for lbi in layerbranches_info:
588 lv, created = Layer_Version.objects.get_or_create(layer_source = self, up_id = lbi['id']) 588 lv, created = Layer_Version.objects.get_or_create(layer_source = self,
589 up_id = lbi['id'],
590 layer=Layer.objects.get(layer_source = self, up_id = lbi['layer'])
591 )
589 592
590 lv.up_date = lbi['updated'] 593 lv.up_date = lbi['updated']
591 lv.layer = Layer.objects.get(layer_source = self, up_id = lbi['layer'])
592 lv.up_branch = Branch.objects.get(layer_source = self, up_id = lbi['branch']) 594 lv.up_branch = Branch.objects.get(layer_source = self, up_id = lbi['branch'])
593 lv.branch = lbi['actual_branch'] 595 lv.branch = lbi['actual_branch']
594 lv.commit = lbi['vcs_last_rev'] 596 lv.commit = lbi['vcs_last_rev']
595 lv.dirpath = lbi['vcs_subdir'] 597 lv.dirpath = lbi['vcs_subdir']
596 lv.save() 598 lv.save()
597 599
600 # update layer dependencies
601 layerdependencies_info = _get_json_response(apilinks['layerDependencies'])
602 dependlist = {}
603 for ldi in layerdependencies_info:
604 try:
605 lv = Layer_Version.objects.get(layer_source = self, up_id = ldi['layerbranch'])
606 except Layer_Version.DoesNotExist as e:
607 continue
608
609 if lv not in dependlist:
610 dependlist[lv] = []
611 try:
612 dependlist[lv].append(Layer_Version.objects.get(layer_source = self, layer__up_id = ldi['dependency'], up_branch = lv.up_branch))
613 except Layer_Version.DoesNotExist as e:
614 print "Cannot find layer version ", self, ldi['dependency'], lv.up_branch
615 raise e
616
617 for lv in dependlist:
618 LayerVersionDependency.objects.filter(layer_version = lv).delete()
619 for lvd in dependlist[lv]:
620 LayerVersionDependency.objects.get_or_create(layer_version = lv, depends_on = lvd)
621
598 622
599 # update machines 623 # update machines
600 machines_info = _get_json_response(apilinks['machines'] 624 machines_info = _get_json_response(apilinks['machines']
601 + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self))) 625 + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self)))
602 ) 626 )
603 for mi in machines_info: 627 for mi in machines_info:
604 mo, created = Machine.objects.get_or_create(layer_source = self, up_id = mi['id']) 628 mo, created = Machine.objects.get_or_create(layer_source = self, up_id = mi['id'], layer_version = Layer_Version.objects.get(layer_source = self, up_id = mi['layerbranch']))
605 mo.up_date = mi['updated'] 629 mo.up_date = mi['updated']
606 mo.layer_version = Layer_Version.objects.get(layer_source = self, up_id = mi['layerbranch'])
607 mo.name = mi['name'] 630 mo.name = mi['name']
608 mo.description = mi['description'] 631 mo.description = mi['description']
609 mo.save() 632 mo.save()
@@ -613,10 +636,9 @@ class LayerIndexLayerSource(LayerSource):
613 + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self))) 636 + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self)))
614 ) 637 )
615 for ri in recipes_info: 638 for ri in recipes_info:
616 ro, created = Recipe.objects.get_or_create(layer_source = self, up_id = ri['id']) 639 ro, created = Recipe.objects.get_or_create(layer_source = self, up_id = ri['id'], layer_version = Layer_Version.objects.get(layer_source = self, up_id = mi['layerbranch']))
617 640
618 ro.up_date = ri['updated'] 641 ro.up_date = ri['updated']
619 ro.layer_version = Layer_Version.objects.get(layer_source = self, up_id = mi['layerbranch'])
620 642
621 ro.name = ri['pn'] 643 ro.name = ri['pn']
622 ro.version = ri['pv'] 644 ro.version = ri['pv']