summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDongxiao Xu <dongxiao.xu@intel.com>2012-02-23 21:47:17 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-23 22:52:16 +0000
commit19089aca83ce00a05dee60b2f40bad87c398fe39 (patch)
treeaa27a1b964ca89fa8669bbd17117f346e79cbef2
parentb70bcb353d576887e6b6c15e636d9102fe9b6799 (diff)
downloadpoky-19089aca83ce00a05dee60b2f40bad87c398fe39.tar.gz
bitbake: add -B option to bind with interface
When start bitbake as a server only process, we need to assign certain interface to it. (Bitbake rev: 95b97d2dc6466ea3d99371f5b5bd68f6f3c99074) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/bin/bitbake17
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py6
2 files changed, 17 insertions, 6 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 6da4980e5d..c06d4e8176 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -168,6 +168,8 @@ Default BBFILES are the .bb files in the current directory.""")
168 parser.add_option("", "--server-only", help = "Run bitbake without UI, the frontend can connect with bitbake server itself", 168 parser.add_option("", "--server-only", help = "Run bitbake without UI, the frontend can connect with bitbake server itself",
169 action = "store_true", dest = "server_only", default = False) 169 action = "store_true", dest = "server_only", default = False)
170 170
171 parser.add_option("-B", "--bind", help = "The name/address for the bitbake server to bind to",
172 action = "store", dest = "bind", default = False)
171 options, args = parser.parse_args(sys.argv) 173 options, args = parser.parse_args(sys.argv)
172 174
173 configuration = BBConfiguration(options) 175 configuration = BBConfiguration(options)
@@ -189,8 +191,14 @@ Default BBFILES are the .bb files in the current directory.""")
189 sys.exit("FATAL: Invalid server type '%s' specified.\n" 191 sys.exit("FATAL: Invalid server type '%s' specified.\n"
190 "Valid interfaces: xmlrpc, process [default], none." % servertype) 192 "Valid interfaces: xmlrpc, process [default], none." % servertype)
191 193
192 if configuration.server_only and configuration.servertype != "xmlrpc": 194 if configuration.server_only:
193 sys.exit("FATAL: If '--server-only' is defined, we must set the servertype as 'xmlrpc'.\n") 195 if configuration.servertype != "xmlrpc":
196 sys.exit("FATAL: If '--server-only' is defined, we must set the servertype as 'xmlrpc'.\n")
197 if not configuration.bind:
198 sys.exit("FATAL: The '--server-only' option requires a name/address to bind to with the -B option.\n")
199
200 if configuration.bind and configuration.servertype != "xmlrpc":
201 sys.exit("FATAL: If '-B' or '--bind' is defined, we must set the servertype as 'xmlrpc'.\n")
194 202
195 # Save a logfile for cooker into the current working directory. When the 203 # Save a logfile for cooker into the current working directory. When the
196 # server is daemonized this logfile will be truncated. 204 # server is daemonized this logfile will be truncated.
@@ -212,8 +220,11 @@ Default BBFILES are the .bb files in the current directory.""")
212 bb.utils.clean_environment() 220 bb.utils.clean_environment()
213 221
214 server = server.BitBakeServer() 222 server = server.BitBakeServer()
223 if configuration.bind:
224 server.initServer((configuration.bind, 0))
225 else:
226 server.initServer()
215 227
216 server.initServer()
217 idle = server.getServerIdleCB() 228 idle = server.getServerIdleCB()
218 229
219 cooker = bb.cooker.BBCooker(configuration, idle, initialenv) 230 cooker = bb.cooker.BBCooker(configuration, idle, initialenv)
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index b5980c6084..c53cee488a 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -163,7 +163,7 @@ class BitBakeXMLRPCServer(SimpleXMLRPCServer):
163 # remove this when you're done with debugging 163 # remove this when you're done with debugging
164 # allow_reuse_address = True 164 # allow_reuse_address = True
165 165
166 def __init__(self, interface = ("localhost", 0)): 166 def __init__(self, interface):
167 """ 167 """
168 Constructor 168 Constructor
169 """ 169 """
@@ -267,8 +267,8 @@ class BitBakeServerConnection():
267 pass 267 pass
268 268
269class BitBakeServer(object): 269class BitBakeServer(object):
270 def initServer(self): 270 def initServer(self, interface = ("localhost", 0)):
271 self.server = BitBakeXMLRPCServer() 271 self.server = BitBakeXMLRPCServer(interface)
272 272
273 def addcooker(self, cooker): 273 def addcooker(self, cooker):
274 self.cooker = cooker 274 self.cooker = cooker