diff options
author | Lianhao Lu <lianhao.lu@intel.com> | 2011-05-27 14:31:45 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-05-27 17:55:49 +0100 |
commit | ecdbd6ab03749f603ffbde2983b3e8ea3bbd73cd (patch) | |
tree | afa8913e66b049d40848020e3da257a2f52137e0 /bitbake/bin | |
parent | 859e21aac1584fe07e5cc7030e7f8918170291f9 (diff) | |
download | poky-ecdbd6ab03749f603ffbde2983b3e8ea3bbd73cd.tar.gz |
Add PR service deamon to bitbake
Added the initial implementation of the server side PR service.
(Bitbake rev: 4d0e79e5591ff58ce35c7fb96f6e9217ddc27466)
Signed-off-by: Lianhao Lu <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rw-r--r-- | bitbake/bin/bitbake-prserv | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/bitbake/bin/bitbake-prserv b/bitbake/bin/bitbake-prserv new file mode 100644 index 0000000000..14073caf38 --- /dev/null +++ b/bitbake/bin/bitbake-prserv | |||
@@ -0,0 +1,53 @@ | |||
1 | #!/usr/bin/env python | ||
2 | import os | ||
3 | import sys,logging | ||
4 | import optparse | ||
5 | |||
6 | sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)),'lib')) | ||
7 | |||
8 | import prserv | ||
9 | import prserv.serv | ||
10 | |||
11 | __version__="1.0.0" | ||
12 | |||
13 | PRHOST_DEFAULT='' | ||
14 | PRPORT_DEFAULT=8585 | ||
15 | |||
16 | def main(): | ||
17 | parser = optparse.OptionParser( | ||
18 | version="Bitbake PR Service Core version %s, %%prog version %s" % (prserv.__version__, __version__), | ||
19 | usage = "%prog [options]") | ||
20 | |||
21 | parser.add_option("-f", "--file", help="database filename(default prserv.db)", action="store", | ||
22 | dest="dbfile", type="string", default="prserv.db") | ||
23 | parser.add_option("-l", "--log", help="log filename(default prserv.log)", action="store", | ||
24 | dest="logfile", type="string", default="prserv.log") | ||
25 | parser.add_option("--loglevel", help="logging level, i.e. CRITICAL, ERROR, WARNING, INFO, DEBUG", | ||
26 | action = "store", type="string", dest="loglevel", default = "WARNING") | ||
27 | parser.add_option("--start", help="start daemon", | ||
28 | action="store_true", dest="start", default="True") | ||
29 | parser.add_option("--stop", help="stop daemon", | ||
30 | action="store_false", dest="start") | ||
31 | parser.add_option("--host", help="ip address to bind", action="store", | ||
32 | dest="host", type="string", default=PRHOST_DEFAULT) | ||
33 | parser.add_option("--port", help="port number(default 8585)", action="store", | ||
34 | dest="port", type="int", default=PRPORT_DEFAULT) | ||
35 | |||
36 | options, args = parser.parse_args(sys.argv) | ||
37 | |||
38 | prserv.init_logger(os.path.abspath(options.logfile),options.loglevel) | ||
39 | |||
40 | if options.start: | ||
41 | prserv.serv.start_daemon(options) | ||
42 | else: | ||
43 | prserv.serv.stop_daemon() | ||
44 | |||
45 | if __name__ == "__main__": | ||
46 | try: | ||
47 | ret = main() | ||
48 | except Exception: | ||
49 | ret = 1 | ||
50 | import traceback | ||
51 | traceback.print_exc(5) | ||
52 | sys.exit(ret) | ||
53 | |||