<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 14 October 2015 at 10:09, Elliot Smith <span dir="ltr">&lt;<a href="mailto:elliot.smith@intel.com" target="_blank">elliot.smith@intel.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Michael Wood &lt;<a href="mailto:michael.g.wood@intel.com">michael.g.wood@intel.com</a>&gt;<br>
<span class=""><br>
When we&#39;re building using toaster as just a listener to bitbake<br>
(analysis mode) we need to handle the case where the toaster configuration data<br>
isn&#39;t present so we don&#39;t need to try and update the existing information.<br></span></blockquote><div><br></div><div>I submitted this upstream as was (I decided toaster is probably OK as a subject), and have added it to toaster-next.</div><div><br></div><div>Elliot</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
<br>
</span>Signed-off-by: Michael Wood &lt;<a href="mailto:michael.g.wood@intel.com">michael.g.wood@intel.com</a>&gt;<br>
Signed-off-by: Elliot Smith &lt;<a href="mailto:elliot.smith@intel.com">elliot.smith@intel.com</a>&gt;<br>
<span class="">---<br>
 bitbake/lib/bb/ui/buildinfohelper.py | 34 ++++++++++++++++++++++------------<br>
 1 file changed, 22 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py<br>
</span>index 2d76403..a8c884d 100644<br>
--- a/bitbake/lib/bb/ui/buildinfohelper.py<br>
+++ b/bitbake/lib/bb/ui/buildinfohelper.py<br>
@@ -298,9 +298,13 @@ class ORMWrapper(object):<br>
<span class="">                 break<br>
<br>
<br>
-<br>
-        if created and must_exist:<br>
-            raise NotExisting(&quot;Recipe object created when expected to exist&quot;, recipe_information)<br>
+        # If we&#39;re in analysis mode then we are wholly responsible for the data<br>
+        # and therefore we return the &#39;real&#39; recipe rather than the build<br>
+        # history copy of the recipe.<br>
+        if  recipe_information[&#39;layer_version&#39;].build is not None and \<br>
+            recipe_information[&#39;layer_version&#39;].build.project == \<br>
+                Project.objects.get_default_project():<br>
+            return recipe<br>
<br>
         return built_recipe<br>
<br>
</span>@@ -333,14 +337,20 @@ class ORMWrapper(object):<br>
<span class="">         assert &#39;priority&#39; in layer_version_information<br>
         assert &#39;local_path&#39; in layer_version_information<br>
<br>
+        # If we&#39;re doing a command line build then associate this new layer with the<br>
+        # project to avoid it &#39;contaminating&#39; toaster data<br>
+        project = None<br>
+        if build_obj.project == Project.objects.get_default_project():<br>
+            project = build_obj.project<br>
+<br>
         layer_version_object, _ = Layer_Version.objects.get_or_create(<br>
-                                    build = build_obj,<br>
-                                    layer = layer_obj,<br>
-                                    branch = layer_version_information[&#39;branch&#39;],<br>
-                                    commit = layer_version_information[&#39;commit&#39;],<br>
-                                    priority = layer_version_information[&#39;priority&#39;],<br>
-                                    local_path = layer_version_information[&#39;local_path&#39;],<br>
-                                    )<br>
+                                  build = build_obj,<br>
+                                  layer = layer_obj,<br>
+                                  branch = layer_version_information[&#39;branch&#39;],<br>
+                                  commit = layer_version_information[&#39;commit&#39;],<br>
+                                  priority = layer_version_information[&#39;priority&#39;],<br>
+                                  local_path = layer_version_information[&#39;local_path&#39;],<br>
+                                  project=project)<br>
<br>
         self.layer_version_objects.append(layer_version_object)<br>
<br>
</span>@@ -845,7 +855,7 @@ class BuildInfoHelper(object):<br>
<span class="">         logger.warn(&quot;Could not match layer version for recipe path %s : %s&quot;, path, self.orm_wrapper.layer_version_objects)<br>
<br>
         #mockup the new layer<br>
-        unknown_layer, _ = Layer.objects.get_or_create(name=&quot;__FIXME__unidentified_layer&quot;, layer_index_url=&quot;&quot;)<br>
+        unknown_layer, _ = Layer.objects.get_or_create(name=&quot;Unidentified layer&quot;, layer_index_url=&quot;&quot;)<br>
         unknown_layer_version_obj, _ = Layer_Version.objects.get_or_create(layer = unknown_layer, build = self.internal_state[&#39;build&#39;])<br>
<br>
         # append it so we don&#39;t run into this error again and again<br>
</span>@@ -1067,7 +1077,7 @@ class BuildInfoHelper(object):<br>
<span class="">             task_information[&#39;disk_io&#39;] = taskstats[&#39;disk_io&#39;]<br>
             if &#39;elapsed_time&#39; in taskstats:<br>
                 task_information[&#39;elapsed_time&#39;] = taskstats[&#39;elapsed_time&#39;]<br>
-            self.orm_wrapper.get_update_task_object(task_information, True)  # must exist<br>
+            self.orm_wrapper.get_update_task_object(task_information)<br>
<br>
     def update_and_store_task(self, event):<br>
         assert &#39;taskfile&#39; in vars(event)<br>
--<br>
</span>1.9.3<br>
<br>
---------------------------------------------------------------------<br>
Intel Corporation (UK) Limited<br>
Registered No. 1134945 (England)<br>
Registered Office: Pipers Way, Swindon SN3 1RJ<br>
VAT No: 860 2173 47<br>
<br>
This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Elliot Smith<br>Software Engineer<br>Intel Open Source Technology Centre</div></div></div>
</div></div>