aboutsummaryrefslogtreecommitdiffstats
path: root/lib/toaster/orm/management/commands/lsupdates.py
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-07-21 14:43:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-25 09:23:19 +0100
commitf8f4cffe6fd371f3a7e63690c68f3fcb5dc1f297 (patch)
treec01addb896670fcccccda92a24fb5e4870a459ea /lib/toaster/orm/management/commands/lsupdates.py
parent6393dbf97d450d2521c0bc9429da0987bb7720ec (diff)
downloadbitbake-f8f4cffe6fd371f3a7e63690c68f3fcb5dc1f297.tar.gz
toaster: orm Remove the layerindex specific up_branch fields
We don't need to keep track of layerindex data in our database. And using branch==release is very confusing in the schema. Instead use the existing Release definition to keep track of which release a layer_version is for. Remove the Branch model and all references to it. Create a migration path to convert from up_branches to their corresponding releases. Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster/orm/management/commands/lsupdates.py')
-rw-r--r--lib/toaster/orm/management/commands/lsupdates.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/toaster/orm/management/commands/lsupdates.py b/lib/toaster/orm/management/commands/lsupdates.py
index 138b686eb..be63a8585 100644
--- a/lib/toaster/orm/management/commands/lsupdates.py
+++ b/lib/toaster/orm/management/commands/lsupdates.py
@@ -102,14 +102,24 @@ class Command(NoArgsCommand):
logger.info("Fetching metadata releases for %s",
" ".join(whitelist_branch_names))
- # keep a track of the id mappings so that layer_versions can be created
- # for these layers later on
+ branches_info = _get_json_response(apilinks['branches'] +
+ "?filter=name:%s"
+ % "OR".join(whitelist_branch_names))
+
+ # Map the layer index branches to toaster releases
+ li_branch_id_to_toaster_release = {}
+
+ total = len(branches_info)
+ for i, branch in enumerate(branches_info):
+ li_branch_id_to_toaster_release[branch['id']] = \
+ Release.objects.get(name=branch['name'])
+ self.mini_progress("Releases", i, total)
+
+ # keep a track of the layerindex (li) id mappings so that
+ # layer_versions can be created for these layers later on
li_layer_id_to_toaster_layer_id = {}
- # We may need this? TODO
- #branches_info = _get_json_response(apilinks['branches'] +
- # "?filter=name:%s"
- # % "OR".join(whitelist_branch_names))
+ logger.info("Fetching layers")
layers_info = _get_json_response(apilinks['layerItems'])
@@ -179,6 +189,7 @@ class Command(NoArgsCommand):
lbi['layer'])
continue
+ lv.release = li_branch_id_to_toaster_release[lbi['branch']]
lv.up_date = lbi['updated']
lv.commit = lbi['actual_branch']
lv.dirpath = lbi['vcs_subdir']