summaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/bin')
-rw-r--r--bitbake/bin/bitbake-prserv53
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
2import os
3import sys,logging
4import optparse
5
6sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)),'lib'))
7
8import prserv
9import prserv.serv
10
11__version__="1.0.0"
12
13PRHOST_DEFAULT=''
14PRPORT_DEFAULT=8585
15
16def 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
45if __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