Skip to contentSkip to conversation

Remove Toaster dependency on daemon

PATCH In review Randy Witt 2 participants 4 messages May 18, 2015 – May 19, 2015

lore
Share & tools
lore

Randy Witt

author
#0 lore raw

cover Remove Toaster dependency on daemon

The following changes since commit bc162d21dd148252efcf3ed771e04c791ef4d869:

bitbake: tests/parse: Add file missing from previous commit (2015-05-16 22:40:44 +0100)

are available in the git repository at:

[email protected]:poky-contrib rewitt/toaster

for you to fetch changes up to e5e8d341edd28007eac22381e336f8362d784530:

toaster: Remove dependency on daemon application (2015-05-18 15:01:42 -0700)

----------------------------------------------------------------
Randy Witt (2):
localhostbecontroller: Fix server search debug message
toaster: Remove dependency on daemon application

 bitbake/bin/toaster                                 |  5 -----
 .../lib/toaster/bldcontrol/localhostbecontroller.py | 21 ++++++++++++++-------
 2 files changed, 14 insertions(+), 12 deletions(-)
author
#1 lore raw

PATCH 1/2 localhostbecontroller: Fix server search debug message

When the output from the commands ran was redirected to "toaster_server.log" instead of the console, the debug message stating the port on which bitbake is running would no longer appear.

This change makes looks at "toaster_server.log" for the port rather than the _shellcmd output. This makes the debug message useful again.

---
 bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +5 -4
index 1bd5143..95ba481 100644
@@ -122,10 +122,11 @@ class LocalhostBEController(BuildEnvironmentController):
         port = "-1"
         logger.debug("localhostbecontroller: starting builder \n%s\n" % cmd)
         cmdoutput = self._shellcmd(cmd)
-        for i in cmdoutput.split("\n"):
-            if i.startswith("Bitbake server address"):
-                port = i.split(" ")[-1]
-                logger.debug("localhostbecontroller: Found bitbake server port %s" % port)
+        with open(self.be.builddir + "/toaster_server.log", "r") as f:
+            for i in f.readlines():
+                if i.startswith("Bitbake server address"):
+                    port = i.split(" ")[-1]
+                    logger.debug("localhostbecontroller: Found bitbake server port %s" % port)
 
         def _toaster_ui_started(filepath, filepos = 0):
             if not os.path.exists(filepath):
Signature · 1 line
1.9.3
author
#2 lore raw

PATCH 2/2 toaster: Remove dependency on daemon application

In reply to Randy Witt

The bitbake observer is now started using python subprocess. This should allow for toaster to run without installing the "daemon" application.

[Yocto #7271]

---
 bitbake/bin/toaster                                     |  5 -----
 bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 12 +++++++++---
 2 files changed, 9 insertions(+), 8 deletions(-)
bitbake/bin/toaster +0 -5
index f5ee68c..18eba8e 100755
@@ -183,11 +183,6 @@ if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then
         exit 1
     fi
 
-    if ! which daemon >/dev/null 2>&1; then
-        echo -e "Failed dependency; toaster needs the 'daemon' program in order to be able to start builds'. Please install the 'daemon' program from your distribution repositories or http://www.libslack.org/daemon/" 1>&2
-        exit 1
-    fi
-
     # Define a fake builddir where only the pid files are actually created. No real builds will take place here.
     BUILDDIR=/tmp/toaster_$$
     if [ -d "$BUILDDIR" ]; then
bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +9 -3
index 95ba481..dfe06f9 100644
@@ -117,10 +117,11 @@ class LocalhostBEController(BuildEnvironmentController):
                 f.seek(0, 2)    # jump to the end
                 toaster_ui_log_filelength = f.tell()
 
-        cmd = "bash -c \"source %s/oe-init-build-env %s 2>&1 >toaster_server.log && bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 2>&1 >toaster_server.log && DATABASE_URL=%s BBSERVER=0.0.0.0:-1 daemon -d -i -D %s -o toaster_ui.log -- %s --observe-only -u toasterui &\"" % (self.pokydirname, self.be.builddir,
-                self.dburl, self.be.builddir, own_bitbake)
+        cmd = "bash -c \"source %s/oe-init-build-env %s 2>&1 >toaster_server.log && bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 2>&1 >>toaster_server.log \"" % (self.pokydirname, self.be.builddir)
+
         port = "-1"
         logger.debug("localhostbecontroller: starting builder \n%s\n" % cmd)
+
         cmdoutput = self._shellcmd(cmd)
         with open(self.be.builddir + "/toaster_server.log", "r") as f:
             for i in f.readlines():
@@ -128,6 +129,10 @@ class LocalhostBEController(BuildEnvironmentController):
                     port = i.split(" ")[-1]
                     logger.debug("localhostbecontroller: Found bitbake server port %s" % port)
 
+        cmd = "bash -c \"source %s/oe-init-build-env-memres -1 %s && DATABASE_URL=%s %s --observe-only -u toasterui --remote-server=0.0.0.0:-1 -t xmlrpc\"" % (self.pokydirname, self.be.builddir, self.dburl, own_bitbake)
+        with open(toaster_ui_log_filepath, "a+") as f:
+            p = subprocess.Popen(cmd, cwd = self.be.builddir, shell=True, stdout=f, stderr=f)
+
         def _toaster_ui_started(filepath, filepos = 0):
             if not os.path.exists(filepath):
                 return False
@@ -148,8 +153,9 @@ class LocalhostBEController(BuildEnvironmentController):
             retries += 1
 
         if not started:
+            toaster_ui_log = open(os.path.join(self.be.builddir, "toaster_ui.log"), "r").read()
             toaster_server_log = open(os.path.join(self.be.builddir, "toaster_server.log"), "r").read()
-            raise BuildSetupException("localhostbecontroller: Bitbake server did not start in 5 seconds, aborting (Error: '%s' '%s')" % (cmdoutput, toaster_server_log))
+            raise BuildSetupException("localhostbecontroller: Bitbake server did not start in 5 seconds, aborting (Error: '%s' '%s')" % (toaster_ui_log, toaster_server_log))
 
         logger.debug("localhostbecontroller: Started bitbake server")
 
Signature · 1 line
1.9.3
#3 lore raw
In reply to Randy Witt

Randy, thanks for the patches. They work fine !

Can you please add [email protected] in CC for future patches ?

Cheers,
Alex

Quoted 31 lines · Randy Witt

The following changes since commit
bc162d21dd148252efcf3ed771e04c791ef4d869:

bitbake: tests/parse: Add file missing from previous commit (2015-05-16
22:40:44 +0100)

are available in the git repository at:

[email protected]:poky-contrib rewitt/toaster

for you to fetch changes up to e5e8d341edd28007eac22381e336f8362d784530:

toaster: Remove dependency on daemon application (2015-05-18 15:01:42
-0700)

----------------------------------------------------------------
Randy Witt (2):
localhostbecontroller: Fix server search debug message
toaster: Remove dependency on daemon application

 bitbake/bin/toaster                                 |  5 -----
 .../lib/toaster/bldcontrol/localhostbecontroller.py | 21
++++++++++++++-------
 2 files changed, 14 insertions(+), 12 deletions(-)

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel

Signature · 3 lines
Alex Damian
Yocto Project
SSG / OTC