diff options
| author | Michael Opdenacker <michael.opdenacker@bootlin.com> | 2024-05-11 16:31:29 +0530 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-21 14:23:43 +0100 |
| commit | 5f99010e41fc26e674d7dc6b6d9d355bc4243542 (patch) | |
| tree | 7f326490946da618fdf3ae0d65e509645c7eff23 | |
| parent | 48d38aef22954cbed38d6a51fa438edac85040d7 (diff) | |
| download | poky-5f99010e41fc26e674d7dc6b6d9d355bc4243542.tar.gz | |
bitbake: prserv: move code from __init__ to bitbake-prserv
This script was the only user of this code.
(Bitbake rev: 19a5595e3f70d61fd6fa414f9fd5b413a02de37b)
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cc: Joshua Watt <JPEWhacker@gmail.com>
Cc: Tim Orling <ticotimo@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | bitbake/bin/bitbake-prserv | 9 | ||||
| -rw-r--r-- | bitbake/lib/prserv/__init__.py | 13 |
2 files changed, 8 insertions, 14 deletions
diff --git a/bitbake/bin/bitbake-prserv b/bitbake/bin/bitbake-prserv index ad0a069401..920663a1d8 100755 --- a/bitbake/bin/bitbake-prserv +++ b/bitbake/bin/bitbake-prserv | |||
| @@ -21,6 +21,13 @@ VERSION = "1.1.0" | |||
| 21 | PRHOST_DEFAULT="0.0.0.0" | 21 | PRHOST_DEFAULT="0.0.0.0" |
| 22 | PRPORT_DEFAULT=8585 | 22 | PRPORT_DEFAULT=8585 |
| 23 | 23 | ||
| 24 | def init_logger(logfile, loglevel): | ||
| 25 | numeric_level = getattr(logging, loglevel.upper(), None) | ||
| 26 | if not isinstance(numeric_level, int): | ||
| 27 | raise ValueError("Invalid log level: %s" % loglevel) | ||
| 28 | FORMAT = "%(asctime)-15s %(message)s" | ||
| 29 | logging.basicConfig(level=numeric_level, filename=logfile, format=FORMAT) | ||
| 30 | |||
| 24 | def main(): | 31 | def main(): |
| 25 | parser = argparse.ArgumentParser( | 32 | parser = argparse.ArgumentParser( |
| 26 | description="BitBake PR Server. Version=%s" % VERSION, | 33 | description="BitBake PR Server. Version=%s" % VERSION, |
| @@ -72,7 +79,7 @@ def main(): | |||
| 72 | ) | 79 | ) |
| 73 | 80 | ||
| 74 | args = parser.parse_args() | 81 | args = parser.parse_args() |
| 75 | prserv.init_logger(os.path.abspath(args.log), args.loglevel) | 82 | init_logger(os.path.abspath(args.log), args.loglevel) |
| 76 | 83 | ||
| 77 | if args.start: | 84 | if args.start: |
| 78 | ret=prserv.serv.start_daemon(args.file, args.host, args.port, os.path.abspath(args.log), args.read_only) | 85 | ret=prserv.serv.start_daemon(args.file, args.host, args.port, os.path.abspath(args.log), args.read_only) |
diff --git a/bitbake/lib/prserv/__init__.py b/bitbake/lib/prserv/__init__.py index 0e0aa34d0e..94658b815d 100644 --- a/bitbake/lib/prserv/__init__.py +++ b/bitbake/lib/prserv/__init__.py | |||
| @@ -5,16 +5,3 @@ | |||
| 5 | # | 5 | # |
| 6 | 6 | ||
| 7 | __version__ = "1.0.0" | 7 | __version__ = "1.0.0" |
| 8 | |||
| 9 | import os, time | ||
| 10 | import sys, logging | ||
| 11 | |||
| 12 | def init_logger(logfile, loglevel): | ||
| 13 | numeric_level = getattr(logging, loglevel.upper(), None) | ||
| 14 | if not isinstance(numeric_level, int): | ||
| 15 | raise ValueError("Invalid log level: %s" % loglevel) | ||
| 16 | FORMAT = "%(asctime)-15s %(message)s" | ||
| 17 | logging.basicConfig(level=numeric_level, filename=logfile, format=FORMAT) | ||
| 18 | |||
| 19 | class NotFoundError(Exception): | ||
| 20 | pass | ||
