All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Make toasterui to work in build mode
@ 2016-02-25 14:44 Ed Bartosh
  2016-02-25 14:44 ` [PATCH 1/6] toasterui: reformat list of events Ed Bartosh
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Ed Bartosh @ 2016-02-25 14:44 UTC (permalink / raw)
  To: toaster

Hi,

This patchset is a preparation for the #7880 fix. As we're going to get rid of
running bitbake server we need toasterui to work in build mode, i.e. with
bitbake <target> -u toasterui.

If you want to test this functionality you can do the following:
 - start Toaster
 - kill bitbake server and observer processes
 - unset BBSERVER
 - run bitbake <target> -u toasterui

Expected outcome: you should see commandline build in UI without bitbake server
                  and observer running.

I've discovered nasty bug in handling setEventMask by bitbake server while
working on this. It causes ignoring of the event mask set by toasterui. The result
of this is that list of events in _ev_list variable is different from the actual
list of events processed by toasterui. Here is the difference:

-bb.command.CommandExit
+bb.event.BuildCompleted
+bb.event.BuildStarted
+bb.event.ConfigParsed
+bb.event.DepTreeGenerated
-bb.runqueue.runQueueExitWait
+bb.event.RecipeParsed
+bb.event.SanityCheck
+bb.event.SanityCheckPassed
+bb.event.TreeDataPreparationCompleted
+bb.event.TreeDataPreparationStarted
+bb.runqueue.runQueueTaskCompleted
+bb.runqueue.runQueueTaskSkipped
+bb.runqueue.sceneQueueTaskCompleted

The fix for this bug is also included in this patchset.

The following changes since commit 029cc9b513864376024cd5fcbb2724e618e92090:

  toaster: custom breadcrumb for the default project (2016-02-24 13:29:00 +0000)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib ed/toaster/toasterui-in-build-mode
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/toasterui-in-build-mode

Ed Bartosh (6):
  toasterui: reformat list of events
  toasterui: update list of events
  command: make setEventMask readonly
  toasterui: check if setEventMask succeeded
  toasterui: make toasterui to work in build mode
  toasterui: exit on final events

 bitbake/lib/bb/command.py      |  1 +
 bitbake/lib/bb/ui/toasterui.py | 76 ++++++++++++++++++++++++++++++++++--------
 2 files changed, 63 insertions(+), 14 deletions(-)

--
Regards,
Ed


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

* [PATCH 1/6] toasterui: reformat list of events
  2016-02-25 14:44 [PATCH 0/6] Make toasterui to work in build mode Ed Bartosh
@ 2016-02-25 14:44 ` Ed Bartosh
  2016-02-25 14:44 ` [PATCH 2/6] toasterui: update " Ed Bartosh
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2016-02-25 14:44 UTC (permalink / raw)
  To: toaster

Reformatted and reordered list of events to make changes
easily and see them clearly in the diffs.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/bb/ui/toasterui.py | 36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index 32b1889..377526e 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -92,15 +92,33 @@ def _close_build_log(build_log):
         build_log.close()
         logger.removeHandler(build_log)
 
-_evt_list = [ "bb.runqueue.runQueueExitWait", "bb.event.LogExecTTY", "logging.LogRecord",
-              "bb.build.TaskFailed", "bb.build.TaskBase", "bb.event.ParseStarted",
-              "bb.event.ParseProgress", "bb.event.ParseCompleted", "bb.event.CacheLoadStarted",
-              "bb.event.CacheLoadProgress", "bb.event.CacheLoadCompleted", "bb.command.CommandFailed",
-              "bb.command.CommandExit", "bb.command.CommandCompleted",  "bb.cooker.CookerExit",
-              "bb.event.MultipleProviders", "bb.event.NoProvider", "bb.runqueue.sceneQueueTaskStarted",
-              "bb.runqueue.runQueueTaskStarted", "bb.runqueue.runQueueTaskFailed", "bb.runqueue.sceneQueueTaskFailed",
-              "bb.event.BuildBase", "bb.build.TaskStarted", "bb.build.TaskSucceeded", "bb.build.TaskFailedSilent",
-              "bb.event.MetadataEvent"]
+_evt_list = [
+    "bb.build.TaskBase",
+    "bb.build.TaskFailed",
+    "bb.build.TaskFailedSilent",
+    "bb.build.TaskStarted",
+    "bb.build.TaskSucceeded",
+    "bb.command.CommandCompleted",
+    "bb.command.CommandExit",
+    "bb.command.CommandFailed",
+    "bb.cooker.CookerExit",
+    "bb.event.BuildBase",
+    "bb.event.CacheLoadCompleted",
+    "bb.event.CacheLoadProgress",
+    "bb.event.CacheLoadStarted",
+    "bb.event.LogExecTTY",
+    "bb.event.MetadataEvent",
+    "bb.event.MultipleProviders",
+    "bb.event.NoProvider",
+    "bb.event.ParseCompleted",
+    "bb.event.ParseProgress",
+    "bb.event.ParseStarted",
+    "bb.runqueue.runQueueExitWait",
+    "bb.runqueue.runQueueTaskFailed",
+    "bb.runqueue.runQueueTaskStarted",
+    "bb.runqueue.sceneQueueTaskFailed",
+    "bb.runqueue.sceneQueueTaskStarted",
+    "logging.LogRecord"]
 
 def main(server, eventHandler, params):
     # set to a logging.FileHandler instance when a build starts;
-- 
2.1.4



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

* [PATCH 2/6] toasterui: update list of events
  2016-02-25 14:44 [PATCH 0/6] Make toasterui to work in build mode Ed Bartosh
  2016-02-25 14:44 ` [PATCH 1/6] toasterui: reformat list of events Ed Bartosh
@ 2016-02-25 14:44 ` Ed Bartosh
  2016-02-25 14:44 ` [PATCH 3/6] command: make setEventMask readonly Ed Bartosh
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2016-02-25 14:44 UTC (permalink / raw)
  To: toaster

Removed events not used in the code from the list.
Added events that are used in the code.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/bb/ui/toasterui.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index 377526e..53b9d92 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -99,13 +99,16 @@ _evt_list = [
     "bb.build.TaskStarted",
     "bb.build.TaskSucceeded",
     "bb.command.CommandCompleted",
-    "bb.command.CommandExit",
     "bb.command.CommandFailed",
     "bb.cooker.CookerExit",
     "bb.event.BuildBase",
+    "bb.event.BuildCompleted",
+    "bb.event.BuildStarted",
     "bb.event.CacheLoadCompleted",
     "bb.event.CacheLoadProgress",
     "bb.event.CacheLoadStarted",
+    "bb.event.ConfigParsed",
+    "bb.event.DepTreeGenerated",
     "bb.event.LogExecTTY",
     "bb.event.MetadataEvent",
     "bb.event.MultipleProviders",
@@ -113,9 +116,16 @@ _evt_list = [
     "bb.event.ParseCompleted",
     "bb.event.ParseProgress",
     "bb.event.ParseStarted",
-    "bb.runqueue.runQueueExitWait",
+    "bb.event.RecipeParsed",
+    "bb.event.SanityCheck",
+    "bb.event.SanityCheckPassed",
+    "bb.event.TreeDataPreparationCompleted",
+    "bb.event.TreeDataPreparationStarted",
+    "bb.runqueue.runQueueTaskCompleted",
     "bb.runqueue.runQueueTaskFailed",
+    "bb.runqueue.runQueueTaskSkipped",
     "bb.runqueue.runQueueTaskStarted",
+    "bb.runqueue.sceneQueueTaskCompleted",
     "bb.runqueue.sceneQueueTaskFailed",
     "bb.runqueue.sceneQueueTaskStarted",
     "logging.LogRecord"]
-- 
2.1.4



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

* [PATCH 3/6] command: make setEventMask readonly
  2016-02-25 14:44 [PATCH 0/6] Make toasterui to work in build mode Ed Bartosh
  2016-02-25 14:44 ` [PATCH 1/6] toasterui: reformat list of events Ed Bartosh
  2016-02-25 14:44 ` [PATCH 2/6] toasterui: update " Ed Bartosh
@ 2016-02-25 14:44 ` Ed Bartosh
  2016-02-25 14:44 ` [PATCH 4/6] toasterui: check if setEventMask succeeded Ed Bartosh
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2016-02-25 14:44 UTC (permalink / raw)
  To: toaster

Executing setEventMask command when bitbake server is in readonly
mode causes runCommand to fail with the following error:
 'Not able to execute not readonly commands in readonly mode'

Set readonly attribute for setEventMask command to make it working
for Toaster UI. This should not do any harm as this command doesn't
influence cooker state.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/bb/command.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 74106d1..0559ffc 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -279,6 +279,7 @@ class CommandsSync:
         mask = params[3]
         return bb.event.set_UIHmask(handlerNum, llevel, debug_domains, mask)
     setEventMask.needconfig = False
+    setEventMask.readonly = True
 
     def setFeatures(self, command, params):
         """
-- 
2.1.4



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

* [PATCH 4/6] toasterui: check if setEventMask succeeded
  2016-02-25 14:44 [PATCH 0/6] Make toasterui to work in build mode Ed Bartosh
                   ` (2 preceding siblings ...)
  2016-02-25 14:44 ` [PATCH 3/6] command: make setEventMask readonly Ed Bartosh
@ 2016-02-25 14:44 ` Ed Bartosh
  2016-02-25 14:44 ` [PATCH 5/6] toasterui: make toasterui to work in build mode Ed Bartosh
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2016-02-25 14:44 UTC (permalink / raw)
  To: toaster

Currently toasterui ignores return value of setEventMask
command, which created confusing difference between set of
events set by this command and the real set used in the code.

Checked if setEventMask succeeded. Print error message and
exit if it's not.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/bb/ui/toasterui.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index 53b9d92..30e0cf8 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -154,8 +154,10 @@ def main(server, eventHandler, params):
     logger.addHandler(console)
     logger.setLevel(logging.INFO)
     llevel, debug_domains = bb.msg.constructLogOptions()
-    server.runCommand(["setEventMask", server.getEventHandle(), llevel, debug_domains, _evt_list])
-
+    result, error = server.runCommand(["setEventMask", server.getEventHandle(), llevel, debug_domains, _evt_list])
+    if not result or error:
+        logger.error("can't set event mask: %s", error)
+        return 1
 
     # verify and warn
     build_history_enabled = True
-- 
2.1.4



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

* [PATCH 5/6] toasterui: make toasterui to work in build mode
  2016-02-25 14:44 [PATCH 0/6] Make toasterui to work in build mode Ed Bartosh
                   ` (3 preceding siblings ...)
  2016-02-25 14:44 ` [PATCH 4/6] toasterui: check if setEventMask succeeded Ed Bartosh
@ 2016-02-25 14:44 ` Ed Bartosh
  2016-02-25 14:44 ` [PATCH 6/6] toasterui: exit on final events Ed Bartosh
  2016-02-26 11:17 ` [PATCH 0/6] Make toasterui to work in build mode Smith, Elliot
  6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2016-02-25 14:44 UTC (permalink / raw)
  To: toaster

Currently toasterui works only in observer mode. This is
artificial limitation which was made to support current toaster
design. As we decided to stop using bitbake server we'll
need to run toasterui also in build mode.

[YOCTO #7880]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/bb/ui/toasterui.py | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index 30e0cf8..f8fb211 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -168,8 +168,23 @@ def main(server, eventHandler, params):
         build_history_enabled = False
 
     if not params.observe_only:
-        logger.error("ToasterUI can only work in observer mode")
-        return 1
+        params.updateFromServer(server)
+        params.updateToServer(server, os.environ.copy())
+        cmdline = params.parseActions()
+        if not cmdline:
+            print("Nothing to do.  Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.")
+            return 1
+        if 'msg' in cmdline and cmdline['msg']:
+            logger.error(cmdline['msg'])
+            return 1
+
+        ret, error = server.runCommand(cmdline['action'])
+        if error:
+            logger.error("Command '%s' failed: %s" % (cmdline, error))
+            return 1
+        elif ret != True:
+            logger.error("Command '%s' failed: returned %s" % (cmdline, ret))
+            return 1
 
     # set to 1 when toasterui needs to shut down
     main.shutdown = 0
-- 
2.1.4



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

* [PATCH 6/6] toasterui: exit on final events
  2016-02-25 14:44 [PATCH 0/6] Make toasterui to work in build mode Ed Bartosh
                   ` (4 preceding siblings ...)
  2016-02-25 14:44 ` [PATCH 5/6] toasterui: make toasterui to work in build mode Ed Bartosh
@ 2016-02-25 14:44 ` Ed Bartosh
  2016-02-26 11:17 ` [PATCH 0/6] Make toasterui to work in build mode Smith, Elliot
  6 siblings, 0 replies; 8+ messages in thread
From: Ed Bartosh @ 2016-02-25 14:44 UTC (permalink / raw)
  To: toaster

Toasterui exits only if bitbake observer shuts down.
In build mode it should exit when build is done.

Made toasterui exit on bb.command.CommandCompleted,
bb.command.CommandFailed and bb.command.CommandExit events
when it's running in build mode.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/bb/ui/toasterui.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py
index f8fb211..757a89f 100644
--- a/bitbake/lib/bb/ui/toasterui.py
+++ b/bitbake/lib/bb/ui/toasterui.py
@@ -388,7 +388,10 @@ def main(server, eventHandler, params):
             if isinstance(event, (bb.command.CommandCompleted,
                                   bb.command.CommandFailed,
                                   bb.command.CommandExit)):
-                errorcode = 0
+                if params.observe_only:
+                    errorcode = 0
+                else:
+                    main.shutdown = 1
 
                 continue
 
-- 
2.1.4



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

* Re: [PATCH 0/6] Make toasterui to work in build mode
  2016-02-25 14:44 [PATCH 0/6] Make toasterui to work in build mode Ed Bartosh
                   ` (5 preceding siblings ...)
  2016-02-25 14:44 ` [PATCH 6/6] toasterui: exit on final events Ed Bartosh
@ 2016-02-26 11:17 ` Smith, Elliot
  6 siblings, 0 replies; 8+ messages in thread
From: Smith, Elliot @ 2016-02-26 11:17 UTC (permalink / raw)
  To: Ed Bartosh; +Cc: toaster

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

I saw these errors/warnings when I ran bitbake as you suggested (clean
build directory):

WARNING: buildhistory is not enabled. Please enable INHERIT +=
"buildhistory" to see image details.
ERROR: Layer version information not found; Check if the bitbake server was
configured to inherit toaster.bbclass.
WARNING: Unknown event: <bb.event.BuildStarted object at 0x2554150>
WARNING: Could not match layer version for recipe path
/home/ell/dev/toaster/poky/meta/ : []

But I only get these if I manually kill bitbake and unset BBSERVER; if I
just run Toaster as per usual, it works fine.

I can't see a reason why this shouldn't be merged, then, as it doesn't
affect Toaster's normal operation. However, I'd like Brian's opinion before
I submit the patches to bitbake-devel.

Elliot

On 25 February 2016 at 14:44, Ed Bartosh <ed.bartosh@linux.intel.com> wrote:

> Hi,
>
> This patchset is a preparation for the #7880 fix. As we're going to get
> rid of
> running bitbake server we need toasterui to work in build mode, i.e. with
> bitbake <target> -u toasterui.
>
> If you want to test this functionality you can do the following:
>  - start Toaster
>  - kill bitbake server and observer processes
>  - unset BBSERVER
>  - run bitbake <target> -u toasterui
>
> Expected outcome: you should see commandline build in UI without bitbake
> server
>                   and observer running.
>
> I've discovered nasty bug in handling setEventMask by bitbake server while
> working on this. It causes ignoring of the event mask set by toasterui.
> The result
> of this is that list of events in _ev_list variable is different from the
> actual
> list of events processed by toasterui. Here is the difference:
>
> -bb.command.CommandExit
> +bb.event.BuildCompleted
> +bb.event.BuildStarted
> +bb.event.ConfigParsed
> +bb.event.DepTreeGenerated
> -bb.runqueue.runQueueExitWait
> +bb.event.RecipeParsed
> +bb.event.SanityCheck
> +bb.event.SanityCheckPassed
> +bb.event.TreeDataPreparationCompleted
> +bb.event.TreeDataPreparationStarted
> +bb.runqueue.runQueueTaskCompleted
> +bb.runqueue.runQueueTaskSkipped
> +bb.runqueue.sceneQueueTaskCompleted
>
> The fix for this bug is also included in this patchset.
>
> The following changes since commit
> 029cc9b513864376024cd5fcbb2724e618e92090:
>
>   toaster: custom breadcrumb for the default project (2016-02-24 13:29:00
> +0000)
>
> are available in the git repository at:
>
>   git://git.yoctoproject.org/poky-contrib
> ed/toaster/toasterui-in-build-mode
>
> http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/toasterui-in-build-mode
>
> Ed Bartosh (6):
>   toasterui: reformat list of events
>   toasterui: update list of events
>   command: make setEventMask readonly
>   toasterui: check if setEventMask succeeded
>   toasterui: make toasterui to work in build mode
>   toasterui: exit on final events
>
>  bitbake/lib/bb/command.py      |  1 +
>  bitbake/lib/bb/ui/toasterui.py | 76
> ++++++++++++++++++++++++++++++++++--------
>  2 files changed, 63 insertions(+), 14 deletions(-)
>
> --
> Regards,
> Ed
> --
> _______________________________________________
> 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: 4574 bytes --]

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

end of thread, other threads:[~2016-02-26 11:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 14:44 [PATCH 0/6] Make toasterui to work in build mode Ed Bartosh
2016-02-25 14:44 ` [PATCH 1/6] toasterui: reformat list of events Ed Bartosh
2016-02-25 14:44 ` [PATCH 2/6] toasterui: update " Ed Bartosh
2016-02-25 14:44 ` [PATCH 3/6] command: make setEventMask readonly Ed Bartosh
2016-02-25 14:44 ` [PATCH 4/6] toasterui: check if setEventMask succeeded Ed Bartosh
2016-02-25 14:44 ` [PATCH 5/6] toasterui: make toasterui to work in build mode Ed Bartosh
2016-02-25 14:44 ` [PATCH 6/6] toasterui: exit on final events Ed Bartosh
2016-02-26 11:17 ` [PATCH 0/6] Make toasterui to work in build mode 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.