[bitbake-devel] [PATCH 5/8] bitbake: add -B option to bind with interface

Xu, Dongxiao dongxiao.xu at intel.com
Wed Jan 11 13:30:21 UTC 2012


Hi Richard,

> -----Original Message-----
> From: Richard Purdie [mailto:richard.purdie at linuxfoundation.org]
> Sent: Wednesday, January 11, 2012 7:38 PM
> To: Xu, Dongxiao
> Cc: bitbake-devel at lists.openembedded.org
> Subject: Re: [bitbake-devel] [PATCH 5/8] bitbake: add -B option to bind with
> interface
> 
> On Wed, 2012-01-11 at 11:03 +0800, Dongxiao Xu wrote:
> > When start bitbake as a server only process, we need to assign certain
> > interface to it.
> >
> > Signed-off-by: Dongxiao Xu <dongxiao.xu at intel.com>
> > ---
> >  bin/bitbake             |   15 ++++++++++-----
> >  lib/bb/server/xmlrpc.py |    6 +++---
> >  2 files changed, 13 insertions(+), 8 deletions(-)
> >
> > diff --git a/bin/bitbake b/bin/bitbake index c2e6822..6e661ce 100755
> > --- a/bin/bitbake
> > +++ b/bin/bitbake
> > @@ -168,6 +168,8 @@ Default BBFILES are the .bb files in the current
> directory.""")
> >      parser.add_option("", "--server-only", help = "Run bitbake without UI,
> the frontend can connect with bitbake server itself",
> >                 action = "store_true", dest = "server_only", default =
> > False)
> >
> > +    parser.add_option("-B", "--bind", help = "The name/address for the
> bitbake server to bind to",
> > +               action = "store", dest = "bind", default = False)
> >      options, args = parser.parse_args(sys.argv)
> >
> >      configuration = BBConfiguration(options) @@ -189,9 +191,6 @@
> > Default BBFILES are the .bb files in the current directory.""")
> >          sys.exit("FATAL: Invalid server type '%s' specified.\n"
> >                   "Valid interfaces: xmlrpc, process [default], none."
> > % servertype)
> >
> > -    if configuration.server_only and configuration.servertype != "xmlrpc":
> > -        sys.exit("FATAL: If '--server-only' is defined, we must set the
> servertype as 'xmlrpc'.\n")
> > -
> >      # Save a logfile for cooker into the current working directory. When the
> >      # server is daemonized this logfile will be truncated.
> >      cooker_logfile = os.path.join(os.getcwd(), "cooker.log") @@
> > -211,9 +210,15 @@ Default BBFILES are the .bb files in the current
> directory.""")
> >      # of the UIs (e.g. for DISPLAY, etc.)
> >      bb.utils.clean_environment()
> >
> > -    server = server.BitBakeServer()
> > +    if configuration.server_only:
> > +        if configuration.servertype != "xmlrpc":
> > +            sys.exit("FATAL: If '--server-only' is defined, we must set the
> servertype as 'xmlrpc'.\n")
> > +        server = server.BitBakeServer()
> > +        server.initServer((configuration.bind, 0))
> > +    else:
> > +        server = server.BitBakeServer()
> > +        server.initServer()
> 
> This looks like it will silently ignore configuration.bind in the non server-only case.
> Don't you need something like:
> 
> 
> +    if configuration.server_only:
> +        if configuration.servertype != "xmlrpc":
> +            sys.exit("FATAL: If '--server-only' is defined, we must set the
> servertype as 'xmlrpc'.\n")
> +        server = server.BitBakeServer()
> +        server.initServer((configuration.bind, 0))
> +    elif configuration.bind:
> +        server = server.BitBakeServer()
> +        server.initServer((configuration.bind, 0))
> +    else:
> +        server = server.BitBakeServer()
> +        server.initServer()
> 
> ?

I had a thought of this code piece, we may need the following code. For --server-only option, it requires --bind, while not vice versa.

@@ -189,8 +191,14 @@ Default BBFILES are the .bb files in the current directory.""")
         sys.exit("FATAL: Invalid server type '%s' specified.\n"
                  "Valid interfaces: xmlrpc, process [default], none." % servertype)

-    if configuration.server_only and configuration.servertype != "xmlrpc":
-        sys.exit("FATAL: If '--server-only' is defined, we must set the servertype as 'xmlrpc'.\n")
+    if configuration.server_only:
+        if configuration.servertype != "xmlrpc":
+            sys.exit("FATAL: If '--server-only' is defined, we must set the servertype as 'xmlrpc'.\n")
+        if not configuration.bind:
+            sys.exit("FATAL: The '--server-only' option requires a name/address to bind to with the -B option.\n")
+
+    if configuration.bind and configuration.servertype != "xmlrpc":
+        sys.exit("FATAL: If '-B' or '--bind' is defined, we must set the servertype as 'xmlrpc'.\n")

     # Save a logfile for cooker into the current working directory. When the
     # server is daemonized this logfile will be truncated.
@@ -212,8 +220,11 @@ Default BBFILES are the .bb files in the current directory.""")
     bb.utils.clean_environment()

     server = server.BitBakeServer()
+    if configuration.bind:
+        server.initServer((configuration.bind, 0))
+    else:
+        server.initServer()

-    server.initServer()
     idle = server.getServerIdleCB()

     cooker = bb.cooker.BBCooker(configuration, idle, initialenv)

> 
> Cheers,
> 
> Richard
> 



More information about the bitbake-devel mailing list