diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-09-23 16:48:52 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-10-30 13:39:49 +0000 |
commit | 1a463ab98ec1220b22a721a1f88ff5af61c33dc3 (patch) | |
tree | 873e4f21bc8b61e27d3c2a2f46215e42794b4131 /bitbake/lib/toaster | |
parent | b27fc6f18f66fcb738b3aed2c278986f79de8413 (diff) | |
download | ast2050-yocto-poky-1a463ab98ec1220b22a721a1f88ff5af61c33dc3.zip ast2050-yocto-poky-1a463ab98ec1220b22a721a1f88ff5af61c33dc3.tar.gz |
bitbake: toaster: fix layer source update code
We fix problems in the layer source update code related to
non-null field restrictions.
We add missing layer dependency update.
(Bitbake rev: e1169127405ce10a044ac9cdf4a892838a99d01f)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 77afe35..1b3bb22 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py @@ -585,25 +585,48 @@ class LayerIndexLayerSource(LayerSource): + "?filter=branch:%s" % "OR".join(map(lambda x: str(x.up_id), Branch.objects.filter(layer_source = self))) ) for lbi in layerbranches_info: - lv, created = Layer_Version.objects.get_or_create(layer_source = self, up_id = lbi['id']) + lv, created = Layer_Version.objects.get_or_create(layer_source = self, + up_id = lbi['id'], + layer=Layer.objects.get(layer_source = self, up_id = lbi['layer']) + ) lv.up_date = lbi['updated'] - lv.layer = Layer.objects.get(layer_source = self, up_id = lbi['layer']) lv.up_branch = Branch.objects.get(layer_source = self, up_id = lbi['branch']) lv.branch = lbi['actual_branch'] lv.commit = lbi['vcs_last_rev'] lv.dirpath = lbi['vcs_subdir'] lv.save() + # update layer dependencies + layerdependencies_info = _get_json_response(apilinks['layerDependencies']) + dependlist = {} + for ldi in layerdependencies_info: + try: + lv = Layer_Version.objects.get(layer_source = self, up_id = ldi['layerbranch']) + except Layer_Version.DoesNotExist as e: + continue + + if lv not in dependlist: + dependlist[lv] = [] + try: + dependlist[lv].append(Layer_Version.objects.get(layer_source = self, layer__up_id = ldi['dependency'], up_branch = lv.up_branch)) + except Layer_Version.DoesNotExist as e: + print "Cannot find layer version ", self, ldi['dependency'], lv.up_branch + raise e + + for lv in dependlist: + LayerVersionDependency.objects.filter(layer_version = lv).delete() + for lvd in dependlist[lv]: + LayerVersionDependency.objects.get_or_create(layer_version = lv, depends_on = lvd) + # update machines machines_info = _get_json_response(apilinks['machines'] + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self))) ) for mi in machines_info: - mo, created = Machine.objects.get_or_create(layer_source = self, up_id = mi['id']) + 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'])) mo.up_date = mi['updated'] - mo.layer_version = Layer_Version.objects.get(layer_source = self, up_id = mi['layerbranch']) mo.name = mi['name'] mo.description = mi['description'] mo.save() @@ -613,10 +636,9 @@ class LayerIndexLayerSource(LayerSource): + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self))) ) for ri in recipes_info: - ro, created = Recipe.objects.get_or_create(layer_source = self, up_id = ri['id']) + 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'])) ro.up_date = ri['updated'] - ro.layer_version = Layer_Version.objects.get(layer_source = self, up_id = mi['layerbranch']) ro.name = ri['pn'] ro.version = ri['pv'] |