All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] buildinfo command line fixes
@ 2015-10-13 22:11 Michael Wood
  2015-10-13 22:11 ` [PATCH] toaster: buildinfohelper Detect command line builds Michael Wood
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Wood @ 2015-10-13 22:11 UTC (permalink / raw)
  To: toaster

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(-)

-- 
2.1.4



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] toaster: buildinfohelper Detect command line builds
  2015-10-13 22:11 [PATCH] buildinfo command line fixes Michael Wood
@ 2015-10-13 22:11 ` Michael Wood
  2015-10-14  7:17   ` Smith, Elliot
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Wood @ 2015-10-13 22:11 UTC (permalink / raw)
  To: toaster

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.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
---
 bitbake/lib/bb/ui/buildinfohelper.py | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 67c239e..701efa2 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -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)
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] toaster: buildinfohelper Detect command line builds
  2015-10-13 22:11 ` [PATCH] toaster: buildinfohelper Detect command line builds Michael Wood
@ 2015-10-14  7:17   ` Smith, Elliot
  0 siblings, 0 replies; 5+ messages in thread
From: Smith, Elliot @ 2015-10-14  7:17 UTC (permalink / raw)
  To: Michael Wood; +Cc: toaster

[-- Attachment #1: Type: text/plain, Size: 4721 bytes --]

On 13 October 2015 at 23:11, Michael Wood <michael.g.wood@intel.com> wrote:

> 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


>
> Signed-off-by: Michael Wood <michael.g.wood@intel.com>
> ---
>  bitbake/lib/bb/ui/buildinfohelper.py | 34
> ++++++++++++++++++++++------------
>  1 file changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/bitbake/lib/bb/ui/buildinfohelper.py
> b/bitbake/lib/bb/ui/buildinfohelper.py
> index 67c239e..701efa2 100644
> --- a/bitbake/lib/bb/ui/buildinfohelper.py
> +++ b/bitbake/lib/bb/ui/buildinfohelper.py
> @@ -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)
> --
> 2.1.4
>
> --
> _______________________________________________
> toaster mailing list
> toaster@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/toaster
>



-- 
Elliot Smith
Software Engineer
Intel Open Source Technology Centre

[-- Attachment #2: Type: text/html, Size: 6440 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] toaster: buildinfohelper Detect command line builds
  2015-10-14  9:09 Elliot Smith
@ 2015-10-14  9:15 ` Smith, Elliot
  0 siblings, 0 replies; 5+ messages in thread
From: Smith, Elliot @ 2015-10-14  9:15 UTC (permalink / raw)
  To: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 5171 bytes --]

On 14 October 2015 at 10:09, Elliot Smith <elliot.smith@intel.com> wrote:

> From: Michael Wood <michael.g.wood@intel.com>
>
> 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.
>

I submitted this upstream as was (I decided toaster is probably OK as a
subject), and have added it to toaster-next.

Elliot


>
> Signed-off-by: Michael Wood <michael.g.wood@intel.com>
> Signed-off-by: Elliot Smith <elliot.smith@intel.com>
> ---
>  bitbake/lib/bb/ui/buildinfohelper.py | 34
> ++++++++++++++++++++++------------
>  1 file changed, 22 insertions(+), 12 deletions(-)
>
> diff --git a/bitbake/lib/bb/ui/buildinfohelper.py
> b/bitbake/lib/bb/ui/buildinfohelper.py
> index 2d76403..a8c884d 100644
> --- a/bitbake/lib/bb/ui/buildinfohelper.py
> +++ b/bitbake/lib/bb/ui/buildinfohelper.py
> @@ -298,9 +298,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
>
> @@ -333,14 +337,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)
>
> @@ -845,7 +855,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
> @@ -1067,7 +1077,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)
> --
> 1.9.3
>
> ---------------------------------------------------------------------
> Intel Corporation (UK) Limited
> Registered No. 1134945 (England)
> Registered Office: Pipers Way, Swindon SN3 1RJ
> VAT No: 860 2173 47
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
>


-- 
Elliot Smith
Software Engineer
Intel Open Source Technology Centre

[-- Attachment #2: Type: text/html, Size: 6843 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] toaster: buildinfohelper Detect command line builds
@ 2015-10-14  9:09 Elliot Smith
  2015-10-14  9:15 ` Smith, Elliot
  0 siblings, 1 reply; 5+ messages in thread
From: Elliot Smith @ 2015-10-14  9:09 UTC (permalink / raw)
  To: bitbake-devel

From: Michael Wood <michael.g.wood@intel.com>

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.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
---
 bitbake/lib/bb/ui/buildinfohelper.py | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 2d76403..a8c884d 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -298,9 +298,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
 
@@ -333,14 +337,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)
 
@@ -845,7 +855,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
@@ -1067,7 +1077,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)
-- 
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-10-14  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-13 22:11 [PATCH] buildinfo command line fixes Michael Wood
2015-10-13 22:11 ` [PATCH] toaster: buildinfohelper Detect command line builds Michael Wood
2015-10-14  7:17   ` Smith, Elliot
2015-10-14  9:09 Elliot Smith
2015-10-14  9:15 ` Smith, Elliot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.