diff options
Diffstat (limited to 'bitbake/lib/bb/ui/uihelper.py')
| -rw-r--r-- | bitbake/lib/bb/ui/uihelper.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/uihelper.py b/bitbake/lib/bb/ui/uihelper.py index 617d60db82..bbf5135b70 100644 --- a/bitbake/lib/bb/ui/uihelper.py +++ b/bitbake/lib/bb/ui/uihelper.py | |||
| @@ -40,3 +40,45 @@ class BBUIHelper: | |||
| 40 | def getTasks(self): | 40 | def getTasks(self): |
| 41 | self.needUpdate = False | 41 | self.needUpdate = False |
| 42 | return (self.running_tasks, self.failed_tasks) | 42 | return (self.running_tasks, self.failed_tasks) |
| 43 | |||
| 44 | def findServerDetails(self): | ||
| 45 | import sys | ||
| 46 | import optparse | ||
| 47 | from bb.server.xmlrpc import BitbakeServerInfo, BitBakeServerConnection | ||
| 48 | host = "" | ||
| 49 | port = 0 | ||
| 50 | bind = "" | ||
| 51 | parser = optparse.OptionParser( | ||
| 52 | usage = """%prog -H host -P port -B bindaddr""") | ||
| 53 | |||
| 54 | parser.add_option("-H", "--host", help = "Bitbake server's IP address", | ||
| 55 | action = "store", dest = "host", default = None) | ||
| 56 | |||
| 57 | parser.add_option("-P", "--port", help = "Bitbake server's Port number", | ||
| 58 | action = "store", dest = "port", default = None) | ||
| 59 | |||
| 60 | parser.add_option("-B", "--bind", help = "Hob2 local bind address", | ||
| 61 | action = "store", dest = "bind", default = None) | ||
| 62 | |||
| 63 | options, args = parser.parse_args(sys.argv) | ||
| 64 | for key, val in options.__dict__.items(): | ||
| 65 | if key == 'host' and val: | ||
| 66 | host = val | ||
| 67 | elif key == 'port' and val: | ||
| 68 | port = int(val) | ||
| 69 | elif key == 'bind' and val: | ||
| 70 | bind = val | ||
| 71 | |||
| 72 | if not host or not port or not bind: | ||
| 73 | parser.print_usage() | ||
| 74 | sys.exit(1) | ||
| 75 | |||
| 76 | serverinfo = BitbakeServerInfo(host, port) | ||
| 77 | clientinfo = (bind, 0) | ||
| 78 | connection = BitBakeServerConnection(serverinfo, clientinfo) | ||
| 79 | |||
| 80 | server = connection.connection | ||
| 81 | eventHandler = connection.events | ||
| 82 | |||
| 83 | return server, eventHandler, host, bind | ||
| 84 | |||
