Message ID | 15703ec8d9b0560b0db97069426c1916e3896a63.1325840050.git.dongxiao.xu@intel.com |
---|---|
State | New |
Headers | show |
diff --git a/bin/bitbake b/bin/bitbake index c2e6822..4bf1335 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 = "Bind bitbake server with certain address", + 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,17 @@ 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") + if not configuration.bind: + sys.exit("FATAL: If '--server-only' is defined, we need to bind the server with certain address'.\n") + server = server.BitBakeServer() + server.initServer((configuration.bind, 0)) + else: + server = server.BitBakeServer() + server.initServer() - server.initServer() idle = server.getServerIdleCB() cooker = bb.cooker.BBCooker(configuration, idle, initialenv) diff --git a/lib/bb/server/xmlrpc.py b/lib/bb/server/xmlrpc.py index b5980c6..c53cee4 100644 --- a/lib/bb/server/xmlrpc.py +++ b/lib/bb/server/xmlrpc.py @@ -163,7 +163,7 @@ class BitBakeXMLRPCServer(SimpleXMLRPCServer): # remove this when you're done with debugging # allow_reuse_address = True - def __init__(self, interface = ("localhost", 0)): + def __init__(self, interface): """ Constructor """ @@ -267,8 +267,8 @@ class BitBakeServerConnection(): pass class BitBakeServer(object): - def initServer(self): - self.server = BitBakeXMLRPCServer() + def initServer(self, interface = ("localhost", 0)): + self.server = BitBakeXMLRPCServer(interface) def addcooker(self, cooker): self.cooker = cooker
On Fri, 2012-01-06 at 17:02 +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@intel.com> > --- > bin/bitbake | 17 ++++++++++++----- > lib/bb/server/xmlrpc.py | 6 +++--- > 2 files changed, 15 insertions(+), 8 deletions(-) > > diff --git a/bin/bitbake b/bin/bitbake > index c2e6822..4bf1335 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 = "Bind bitbake server with certain address", I find these help messages confusing. How about "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,17 @@ 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") > + if not configuration.bind: > + sys.exit("FATAL: If '--server-only' is defined, we need to bind the server with certain address'.\n") How about "FATAL: The '--server-only' option requires a name/address to bind to with the --bind option"? To be honest, I'd also expect --bind to work without --server-only, defaulting to "localhost" if it wasn't set but using the address/name specified if it was. The usecase would be to attach a secondary UI to the bitbake server during the build process for monitoring/control purposes. Cheers, Richard
> -----Original Message----- > From: Richard Purdie [mailto:richard.purdie@linuxfoundation.org] > Sent: Friday, January 06, 2012 11:51 PM > To: Xu, Dongxiao > Cc: bitbake-devel@lists.openembedded.org > Subject: Re: [bitbake-devel] [PATCH 12/16] bitbake: add -B option to bind with > interface > > On Fri, 2012-01-06 at 17:02 +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@intel.com> > > --- > > bin/bitbake | 17 ++++++++++++----- > > lib/bb/server/xmlrpc.py | 6 +++--- > > 2 files changed, 15 insertions(+), 8 deletions(-) > > > > diff --git a/bin/bitbake b/bin/bitbake index c2e6822..4bf1335 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 = "Bind bitbake server > > + with certain address", > > I find these help messages confusing. How about "The name/address for the > bitbake server to bind to"? Yes, I think your suggestion is better. > > > + 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,17 @@ 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") > > + if not configuration.bind: > > + sys.exit("FATAL: If '--server-only' is defined, we need > > + to bind the server with certain address'.\n") > > How about "FATAL: The '--server-only' option requires a name/address to bind to > with the --bind option"? > > To be honest, I'd also expect --bind to work without --server-only, defaulting to > "localhost" if it wasn't set but using the address/name specified if it was. The > usecase would be to attach a secondary UI to the bitbake server during the > build process for monitoring/control purposes. Yes, I can remove that limitation. I Will revise this patch and send out again. Thanks, Dongxiao > > Cheers, > > Richard > >
When start bitbake as a server only process, we need to assign certain interface to it. Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> --- bin/bitbake | 17 ++++++++++++----- lib/bb/server/xmlrpc.py | 6 +++--- 2 files changed, 15 insertions(+), 8 deletions(-)