summaryrefslogtreecommitdiffstats
path: root/bin/bitbake-prserv
diff options
context:
space:
mode:
authorLianhao Lu <lianhao.lu@intel.com>2011-05-27 14:31:45 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-27 17:19:19 +0100
commit4d0e79e5591ff58ce35c7fb96f6e9217ddc27466 (patch)
tree5669e116340c345ee477d195a965a48e639dde18 /bin/bitbake-prserv
parentece05edd7c214679ec4b9c44e185ffc366d95584 (diff)
downloadbitbake-contrib-4d0e79e5591ff58ce35c7fb96f6e9217ddc27466.tar.gz
bitbake-contrib-4d0e79e5591ff58ce35c7fb96f6e9217ddc27466.tar.bz2
bitbake-contrib-4d0e79e5591ff58ce35c7fb96f6e9217ddc27466.zip
Add PR service deamon to bitbake
Added the initial implementation of the server side PR service. Signed-off-by: Lianhao Lu <lianhao.lu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bin/bitbake-prserv')
-rwxr-xr-xbin/bitbake-prserv53
1 files changed, 53 insertions, 0 deletions
diff --git a/bin/bitbake-prserv b/bin/bitbake-prserv
new file mode 100755
index 0000000000..14073caf38
--- /dev/null
+++ b/bin/bitbake-prserv
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+import os
+import sys,logging
+import optparse
+
+sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)),'lib'))
+
+import prserv
+import prserv.serv
+
+__version__="1.0.0"
+
+PRHOST_DEFAULT=''
+PRPORT_DEFAULT=8585
+
+def main():
+ parser = optparse.OptionParser(
+ version="Bitbake PR Service Core version %s, %%prog version %s" % (prserv.__version__, __version__),
+ usage = "%prog [options]")
+
+ parser.add_option("-f", "--file", help="database filename(default prserv.db)", action="store",
+ dest="dbfile", type="string", default="prserv.db")
+ parser.add_option("-l", "--log", help="log filename(default prserv.log)", action="store",
+ dest="logfile", type="string", default="prserv.log")
+ parser.add_option("--loglevel", help="logging level, i.e. CRITICAL, ERROR, WARNING, INFO, DEBUG",
+ action = "store", type="string", dest="loglevel", default = "WARNING")
+ parser.add_option("--start", help="start daemon",
+ action="store_true", dest="start", default="True")
+ parser.add_option("--stop", help="stop daemon",
+ action="store_false", dest="start")
+ parser.add_option("--host", help="ip address to bind", action="store",
+ dest="host", type="string", default=PRHOST_DEFAULT)
+ parser.add_option("--port", help="port number(default 8585)", action="store",
+ dest="port", type="int", default=PRPORT_DEFAULT)
+
+ options, args = parser.parse_args(sys.argv)
+
+ prserv.init_logger(os.path.abspath(options.logfile),options.loglevel)
+
+ if options.start:
+ prserv.serv.start_daemon(options)
+ else:
+ prserv.serv.stop_daemon()
+
+if __name__ == "__main__":
+ try:
+ ret = main()
+ except Exception:
+ ret = 1
+ import traceback
+ traceback.print_exc(5)
+ sys.exit(ret)
+