From 30a9bc6c92a8920d6e9c4a4b93b83bdbe5d48e78 Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Tue, 10 Jan 2012 14:13:49 +0800 Subject: bitbake/PRservice: Added no_hist mode and export/import. [YOCTO #1556] 1. Added the package_arch into the index to the DB table. Because the change in PACKAGE_ARCH will results in different checksum, and it is better to have seperate PR value domains for differnt PACKAGE_ARCH of the same pakcage. 2. Changed the PR service to operate in no history mode. In this mode, the for a given query tuple (version, pkgarch, checksum), the returned value will be the largest among all the values of the same (version, pkgarch). This means the PR value returned can NOT be decremented. 3. Added export function. For each (version, pkgarch) tuple, only the record with the maximum value will be exported. 4. Added import function. The record will only be imported if the imported value is larger than the value stored in the DB with the same (version, pkgarch, checksum) tuple. (Bitbake rev: 379567ee879dcdc09a51f7f1212bde1076147a6f) Signed-off-by: Lianhao Lu Signed-off-by: Richard Purdie --- bitbake/bin/bitbake-prserv | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'bitbake/bin') diff --git a/bitbake/bin/bitbake-prserv b/bitbake/bin/bitbake-prserv index 14073caf38..a7ab55f736 100644 --- a/bitbake/bin/bitbake-prserv +++ b/bitbake/bin/bitbake-prserv @@ -16,31 +16,34 @@ PRPORT_DEFAULT=8585 def main(): parser = optparse.OptionParser( version="Bitbake PR Service Core version %s, %%prog version %s" % (prserv.__version__, __version__), - usage = "%prog [options]") + usage = "%prog < --start | --stop > [options]") - parser.add_option("-f", "--file", help="database filename(default prserv.db)", action="store", + 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", + 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") + action = "store", type="string", dest="loglevel", default = "INFO") parser.add_option("--start", help="start daemon", - action="store_true", dest="start", default="True") + action="store_true", dest="start") parser.add_option("--stop", help="stop daemon", - action="store_false", dest="start") + action="store_true", dest="stop") 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", + 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) + ret=prserv.serv.start_daemon(dbfile=options.dbfile, interface=(options.host, options.port), + logfile=os.path.abspath(options.logfile)) + elif options.stop: + ret=prserv.serv.stop_daemon(options.host, options.port) else: - prserv.serv.stop_daemon() + ret=parser.print_help() + return ret if __name__ == "__main__": try: -- cgit v1.2.3-54-g00ecf