2011-05-27 06:31:45 +00:00
|
|
|
#!/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"
|
|
|
|
|
2012-01-10 06:13:50 +00:00
|
|
|
PRHOST_DEFAULT='0.0.0.0'
|
2011-05-27 06:31:45 +00:00
|
|
|
PRPORT_DEFAULT=8585
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = optparse.OptionParser(
|
|
|
|
version="Bitbake PR Service Core version %s, %%prog version %s" % (prserv.__version__, __version__),
|
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 <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-10 06:13:49 +00:00
|
|
|
usage = "%prog < --start | --stop > [options]")
|
2011-05-27 06:31:45 +00:00
|
|
|
|
2012-01-10 06:13:50 +00:00
|
|
|
parser.add_option("-f", "--file", help="database filename(default: prserv.sqlite3)", action="store",
|
|
|
|
dest="dbfile", type="string", default="prserv.sqlite3")
|
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 <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-10 06:13:49 +00:00
|
|
|
parser.add_option("-l", "--log", help="log filename(default: prserv.log)", action="store",
|
2011-05-27 06:31:45 +00:00
|
|
|
dest="logfile", type="string", default="prserv.log")
|
|
|
|
parser.add_option("--loglevel", help="logging level, i.e. CRITICAL, ERROR, WARNING, INFO, DEBUG",
|
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 <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-10 06:13:49 +00:00
|
|
|
action = "store", type="string", dest="loglevel", default = "INFO")
|
2011-05-27 06:31:45 +00:00
|
|
|
parser.add_option("--start", help="start daemon",
|
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 <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-10 06:13:49 +00:00
|
|
|
action="store_true", dest="start")
|
2011-05-27 06:31:45 +00:00
|
|
|
parser.add_option("--stop", help="stop daemon",
|
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 <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-10 06:13:49 +00:00
|
|
|
action="store_true", dest="stop")
|
2011-05-27 06:31:45 +00:00
|
|
|
parser.add_option("--host", help="ip address to bind", action="store",
|
|
|
|
dest="host", type="string", default=PRHOST_DEFAULT)
|
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 <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-10 06:13:49 +00:00
|
|
|
parser.add_option("--port", help="port number(default: 8585)", action="store",
|
2011-05-27 06:31:45 +00:00
|
|
|
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:
|
2012-01-10 06:13:50 +00:00
|
|
|
ret=prserv.serv.start_daemon(options.dbfile, options.host, options.port,os.path.abspath(options.logfile))
|
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 <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-10 06:13:49 +00:00
|
|
|
elif options.stop:
|
|
|
|
ret=prserv.serv.stop_daemon(options.host, options.port)
|
2011-05-27 06:31:45 +00:00
|
|
|
else:
|
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 <lianhao.lu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-01-10 06:13:49 +00:00
|
|
|
ret=parser.print_help()
|
|
|
|
return ret
|
2011-05-27 06:31:45 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
try:
|
|
|
|
ret = main()
|
|
|
|
except Exception:
|
|
|
|
ret = 1
|
|
|
|
import traceback
|
|
|
|
traceback.print_exc(5)
|
|
|
|
sys.exit(ret)
|
|
|
|
|