Skip to contentSkip to conversation

buildinfo command line fixes

PATCH New Michael Wood 2 participants 3 messages Oct 13, 2015 – Oct 14, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildinfo command line fixes

This patch is to go with work being done by Elliot and Ed to add the command line
builds mechanism to toaster. It allows the buildinfohelper to be the primary creator of the toaster data that we usually create from within toaster.

Michael Wood (1):
toaster: buildinfohelper Detect command line builds

 bitbake/lib/bb/ui/buildinfohelper.py | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 toaster: buildinfohelper Detect command line builds

When we're building using toaster as just a listener to bitbake (analysis mode) we need to handle the case where the toaster configuration data isn't present so we don't need to try and update the existing information.

---
 bitbake/lib/bb/ui/buildinfohelper.py | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)
bitbake/lib/bb/ui/buildinfohelper.py +22 -12
index 67c239e..701efa2 100644
@@ -297,9 +297,13 @@ class ORMWrapper(object):
                 break
 
 
-
-        if created and must_exist:
-            raise NotExisting("Recipe object created when expected to exist", recipe_information)
+        # If we're in analysis mode then we are wholly responsible for the data
+        # and therefore we return the 'real' recipe rather than the build
+        # history copy of the recipe.
+        if  recipe_information['layer_version'].build is not None and \
+            recipe_information['layer_version'].build.project == \
+                Project.objects.get_default_project():
+            return recipe
 
         return built_recipe
 
@@ -332,14 +336,20 @@ class ORMWrapper(object):
         assert 'priority' in layer_version_information
         assert 'local_path' in layer_version_information
 
+        # If we're doing a command line build then associate this new layer with the
+        # project to avoid it 'contaminating' toaster data
+        project = None
+        if build_obj.project == Project.objects.get_default_project():
+            project = build_obj.project
+
         layer_version_object, _ = Layer_Version.objects.get_or_create(
-                                    build = build_obj,
-                                    layer = layer_obj,
-                                    branch = layer_version_information['branch'],
-                                    commit = layer_version_information['commit'],
-                                    priority = layer_version_information['priority'],
-                                    local_path = layer_version_information['local_path'],
-                                    )
+                                  build = build_obj,
+                                  layer = layer_obj,
+                                  branch = layer_version_information['branch'],
+                                  commit = layer_version_information['commit'],
+                                  priority = layer_version_information['priority'],
+                                  local_path = layer_version_information['local_path'],
+                                  project=project)
 
         self.layer_version_objects.append(layer_version_object)
 
@@ -844,7 +854,7 @@ class BuildInfoHelper(object):
         logger.warn("Could not match layer version for recipe path %s : %s", path, self.orm_wrapper.layer_version_objects)
 
         #mockup the new layer
-        unknown_layer, _ = Layer.objects.get_or_create(name="__FIXME__unidentified_layer", layer_index_url="")
+        unknown_layer, _ = Layer.objects.get_or_create(name="Unidentified layer", layer_index_url="")
         unknown_layer_version_obj, _ = Layer_Version.objects.get_or_create(layer = unknown_layer, build = self.internal_state['build'])
 
         # append it so we don't run into this error again and again
@@ -1072,7 +1082,7 @@ class BuildInfoHelper(object):
             task_information['disk_io'] = taskstats['disk_io']
             if 'elapsed_time' in taskstats:
                 task_information['elapsed_time'] = taskstats['elapsed_time']
-            self.orm_wrapper.get_update_task_object(task_information, True)  # must exist
+            self.orm_wrapper.get_update_task_object(task_information)
 
     def update_and_store_task(self, event):
         assert 'taskfile' in vars(event)
Signature · 1 line
2.1.4
#2 lore raw

Re: [PATCH] toaster: buildinfohelper Detect command line builds

Quoted 5 lines · Michael Wood

When we're building using toaster as just a listener to bitbake (analysis mode) we need to handle the case where the toaster configuration data
isn't present so we don't need to try and update the existing information.

As this is in bitbake/lib/bb/ui, do we need a different subject line for the commit, instead of "toaster"?

Elliot

Quoted 103 lines
---
 bitbake/lib/bb/ui/buildinfohelper.py | 34
++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)
bitbake/lib/bb/ui/buildinfohelper.py +1 -3
index 67c239e..701efa2 100644
@@ -297,9 +297,13 @@ class ORMWrapper(object):
                 break
 
 
-
-        if created and must_exist:
-            raise NotExisting("Recipe object created when expected to
 exist", recipe_information)
+        # If we're in analysis mode then we are wholly responsible for

the data

bitbake/lib/bb/ui/buildinfohelper.py +7 -0
+        # and therefore we return the 'real' recipe rather than the build
+        # history copy of the recipe.
+        if  recipe_information['layer_version'].build is not None and \
+            recipe_information['layer_version'].build.project == \
+                Project.objects.get_default_project():
+            return recipe
 
         return built_recipe
@@ -332,14 +336,20 @@ class ORMWrapper(object):
         assert 'priority' in layer_version_information
         assert 'local_path' in layer_version_information
 
+        # If we're doing a command line build then associate this new

layer with the

bitbake/lib/bb/ui/buildinfohelper.py +5 -3
+        # project to avoid it 'contaminating' toaster data
+        project = None
+        if build_obj.project == Project.objects.get_default_project():
+            project = build_obj.project
+
         layer_version_object, _ = Layer_Version.objects.get_or_create(
-                                    build = build_obj,
-                                    layer = layer_obj,
-                                    branch =

layer_version_information['branch'],
- commit =
layer_version_information['commit'],
- priority =
layer_version_information['priority'],
- local_path =
layer_version_information['local_path'],

bitbake/lib/bb/ui/buildinfohelper.py +3 -1
-                                    )
+                                  build = build_obj,
+                                  layer = layer_obj,
+                                  branch =

layer_version_information['branch'],
+ commit =
layer_version_information['commit'],
+ priority =
layer_version_information['priority'],
+ local_path =
layer_version_information['local_path'],

bitbake/lib/bb/ui/buildinfohelper.py +2 -1
+                                  project=project)
 
         self.layer_version_objects.append(layer_version_object)
@@ -844,7 +854,7 @@ class BuildInfoHelper(object):
         logger.warn("Could not match layer version for recipe path %s :
 %s", path, self.orm_wrapper.layer_version_objects)
 
         #mockup the new layer
-        unknown_layer, _ =
 Layer.objects.get_or_create(name="__FIXME__unidentified_layer",
 layer_index_url="")
+        unknown_layer, _ = Layer.objects.get_or_create(name="Unidentified

layer", layer_index_url="")
unknown_layer_version_obj, _ =
Layer_Version.objects.get_or_create(layer = unknown_layer, build = self.internal_state['build'])

         # append it so we don't run into this error again and again
bitbake/lib/bb/ui/buildinfohelper.py +0 -0
@@ -1072,7 +1082,7 @@ class BuildInfoHelper(object):
             task_information['disk_io'] = taskstats['disk_io']
             if 'elapsed_time' in taskstats:
                 task_information['elapsed_time'] =

taskstats['elapsed_time']
- self.orm_wrapper.get_update_task_object(task_information,
True) # must exist
+ self.orm_wrapper.get_update_task_object(task_information)

def update_and_store_task(self, event):
assert 'taskfile' in vars(event)
--
2.1.4

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Signature · 3 lines
Elliot Smith
Software Engineer
Intel Open Source Technology Centre