diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2017-03-20 14:51:03 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-21 22:43:04 +0000 |
commit | f91ccdeb8b0b3e4063ed2bf22215a25f8902cbd9 (patch) | |
tree | 113331f131fe6c5bee0b227d532efe2988590707 /scripts/yocto-compat-layer.py | |
parent | 95ad04f7daed17bde5be5fc264f6c731fecfdfa9 (diff) | |
download | openembedded-core-f91ccdeb8b0b3e4063ed2bf22215a25f8902cbd9.tar.gz openembedded-core-f91ccdeb8b0b3e4063ed2bf22215a25f8902cbd9.tar.bz2 openembedded-core-f91ccdeb8b0b3e4063ed2bf22215a25f8902cbd9.zip |
scripts/yocto-compat-layer.py: Make output log argument optional
Only create a log file when --output-log option is specified, since
logger is dumping to stdout by default is better to let the user
decide if a log needs to be created.
[YOCTO #11160]
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts/yocto-compat-layer.py')
-rwxr-xr-x | scripts/yocto-compat-layer.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/scripts/yocto-compat-layer.py b/scripts/yocto-compat-layer.py index 8996fff799..b96f3ca0bf 100755 --- a/scripts/yocto-compat-layer.py +++ b/scripts/yocto-compat-layer.py @@ -26,9 +26,6 @@ from compatlayer import LayerType, detect_layers, add_layer, get_signatures from oeqa.utils.commands import get_bb_vars PROGNAME = 'yocto-compat-layer' -DEFAULT_OUTPUT_LOG = '%s-%s.log' % (PROGNAME, - time.strftime("%Y%m%d%H%M%S")) -OUTPUT_LOG_LINK = "%s.log" % PROGNAME CASES_PATHS = [os.path.join(os.path.abspath(os.path.dirname(__file__)), 'lib', 'compatlayer', 'cases')] logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout) @@ -49,9 +46,7 @@ def main(): parser.add_argument('layers', metavar='LAYER_DIR', nargs='+', help='Layer to test compatibility with Yocto Project') parser.add_argument('-o', '--output-log', - help='Output log default: %s' % DEFAULT_OUTPUT_LOG, - action='store', default=DEFAULT_OUTPUT_LOG) - + help='File to output log (optional)', action='store') parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') parser.add_argument('-q', '--quiet', help='Print only errors', @@ -63,16 +58,14 @@ def main(): args = parser.parse_args() - fh = logging.FileHandler(args.output_log) - fh.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) - logger.addHandler(fh) + if args.output_log: + fh = logging.FileHandler(args.output_log) + fh.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) + logger.addHandler(fh) if args.debug: logger.setLevel(logging.DEBUG) elif args.quiet: logger.setLevel(logging.ERROR) - if os.path.exists(OUTPUT_LOG_LINK): - os.unlink(OUTPUT_LOG_LINK) - os.symlink(args.output_log, OUTPUT_LOG_LINK) if not 'BUILDDIR' in os.environ: logger.error("You must source the environment before run this script.") |