diff options
author | Michael Wood <michael.g.wood@intel.com> | 2016-11-09 19:52:34 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-11-23 10:59:56 +0000 |
commit | dbf3a9fa8ee9bfb2887fb0e4808bd77eda5164e1 (patch) | |
tree | 48ce49ef7343a94228b404426256d0c649288a19 /bitbake | |
parent | f59ac87b464ed517d9b2d3920b8f245baa9e46ca (diff) | |
download | poky-dbf3a9fa8ee9bfb2887fb0e4808bd77eda5164e1.tar.gz |
bitbake: toaster: layerindex updater Take into account layers being predefined
As we can now provide layer definitions through fixtures we need to be
more clever how we update the metadata in the database to avoid
duplicate metadata being created. To do this we make more effort to
match existing data in the database and update only the fields which
will be better provided by the layer index.
This removes the need for us to special case layers which are provided
as part of poky such as openembedded-core or meta-poky which exist on
the layerindex but with different git urls.
(Bitbake rev: f981b68f66718d5b196684f4e378a5f195ff0337)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/orm/management/commands/lsupdates.py | 60 |
1 files changed, 19 insertions, 41 deletions
diff --git a/bitbake/lib/toaster/orm/management/commands/lsupdates.py b/bitbake/lib/toaster/orm/management/commands/lsupdates.py index 8ff120e0b0..688918e68c 100644 --- a/bitbake/lib/toaster/orm/management/commands/lsupdates.py +++ b/bitbake/lib/toaster/orm/management/commands/lsupdates.py | |||
@@ -154,41 +154,17 @@ class Command(NoArgsCommand): | |||
154 | 154 | ||
155 | total = len(layers_info) | 155 | total = len(layers_info) |
156 | for i, li in enumerate(layers_info): | 156 | for i, li in enumerate(layers_info): |
157 | # Special case for the openembedded-core layer | ||
158 | if li['name'] == oe_core_layer: | ||
159 | try: | ||
160 | # If we have an existing openembedded-core for example | ||
161 | # from the toasterconf.json augment the info using the | ||
162 | # layerindex rather than duplicate it | ||
163 | oe_core_l = Layer.objects.get(name=oe_core_layer) | ||
164 | # Take ownership of the layer as now coming from the | ||
165 | # layerindex | ||
166 | oe_core_l.summary = li['summary'] | ||
167 | oe_core_l.description = li['description'] | ||
168 | oe_core_l.vcs_web_url = li['vcs_web_url'] | ||
169 | oe_core_l.vcs_web_tree_base_url = \ | ||
170 | li['vcs_web_tree_base_url'] | ||
171 | oe_core_l.vcs_web_file_base_url = \ | ||
172 | li['vcs_web_file_base_url'] | ||
173 | |||
174 | oe_core_l.save() | ||
175 | li_layer_id_to_toaster_layer_id[li['id']] = oe_core_l.pk | ||
176 | self.mini_progress("layers", i, total) | ||
177 | continue | ||
178 | |||
179 | except Layer.DoesNotExist: | ||
180 | pass | ||
181 | |||
182 | try: | 157 | try: |
183 | l, created = Layer.objects.get_or_create(name=li['name'], | 158 | l, created = Layer.objects.get_or_create(name=li['name']) |
184 | vcs_url=li['vcs_url']) | ||
185 | l.up_date = li['updated'] | 159 | l.up_date = li['updated'] |
186 | l.vcs_url = li['vcs_url'] | ||
187 | l.vcs_web_url = li['vcs_web_url'] | ||
188 | l.vcs_web_tree_base_url = li['vcs_web_tree_base_url'] | ||
189 | l.vcs_web_file_base_url = li['vcs_web_file_base_url'] | ||
190 | l.summary = li['summary'] | 160 | l.summary = li['summary'] |
191 | l.description = li['description'] | 161 | l.description = li['description'] |
162 | |||
163 | if created: | ||
164 | l.vcs_url = li['vcs_url'] | ||
165 | l.vcs_web_url = li['vcs_web_url'] | ||
166 | l.vcs_web_tree_base_url = li['vcs_web_tree_base_url'] | ||
167 | l.vcs_web_file_base_url = li['vcs_web_file_base_url'] | ||
192 | l.save() | 168 | l.save() |
193 | except Layer.MultipleObjectsReturned: | 169 | except Layer.MultipleObjectsReturned: |
194 | logger.info("Skipped %s as we found multiple layers and " | 170 | logger.info("Skipped %s as we found multiple layers and " |
@@ -211,12 +187,14 @@ class Command(NoArgsCommand): | |||
211 | 187 | ||
212 | total = len(layerbranches_info) | 188 | total = len(layerbranches_info) |
213 | for i, lbi in enumerate(layerbranches_info): | 189 | for i, lbi in enumerate(layerbranches_info): |
190 | # release as defined by toaster map to layerindex branch | ||
191 | release = li_branch_id_to_toaster_release[lbi['branch']] | ||
214 | 192 | ||
215 | try: | 193 | try: |
216 | lv, created = Layer_Version.objects.get_or_create( | 194 | lv, created = Layer_Version.objects.get_or_create( |
217 | layer_source=LayerSource.TYPE_LAYERINDEX, | ||
218 | layer=Layer.objects.get( | 195 | layer=Layer.objects.get( |
219 | pk=li_layer_id_to_toaster_layer_id[lbi['layer']]) | 196 | pk=li_layer_id_to_toaster_layer_id[lbi['layer']]), |
197 | release=release | ||
220 | ) | 198 | ) |
221 | except KeyError: | 199 | except KeyError: |
222 | logger.warning( | 200 | logger.warning( |
@@ -224,11 +202,12 @@ class Command(NoArgsCommand): | |||
224 | lbi['layer']) | 202 | lbi['layer']) |
225 | continue | 203 | continue |
226 | 204 | ||
227 | lv.release = li_branch_id_to_toaster_release[lbi['branch']] | 205 | if created: |
228 | lv.up_date = lbi['updated'] | 206 | lv.release = li_branch_id_to_toaster_release[lbi['branch']] |
229 | lv.commit = lbi['actual_branch'] | 207 | lv.up_date = lbi['updated'] |
230 | lv.dirpath = lbi['vcs_subdir'] | 208 | lv.commit = lbi['actual_branch'] |
231 | lv.save() | 209 | lv.dirpath = lbi['vcs_subdir'] |
210 | lv.save() | ||
232 | 211 | ||
233 | li_layer_branch_id_to_toaster_lv_id[lbi['id']] =\ | 212 | li_layer_branch_id_to_toaster_lv_id[lbi['id']] =\ |
234 | lv.pk | 213 | lv.pk |
@@ -255,9 +234,8 @@ class Command(NoArgsCommand): | |||
255 | layer_id = li_layer_id_to_toaster_layer_id[ldi['dependency']] | 234 | layer_id = li_layer_id_to_toaster_layer_id[ldi['dependency']] |
256 | 235 | ||
257 | dependlist[lv].append( | 236 | dependlist[lv].append( |
258 | Layer_Version.objects.get( | 237 | Layer_Version.objects.get(layer__pk=layer_id, |
259 | layer_source=LayerSource.TYPE_LAYERINDEX, | 238 | release=lv.release)) |
260 | layer__pk=layer_id)) | ||
261 | 239 | ||
262 | except Layer_Version.DoesNotExist: | 240 | except Layer_Version.DoesNotExist: |
263 | logger.warning("Cannot find layer version (ls:%s)," | 241 | logger.warning("Cannot find layer version (ls:%s)," |