[oe-commits] [openembedded-core] 50/64: scripts/yocto-compat-layer.py: Make output log argument optional

git at git.openembedded.org git at git.openembedded.org
Tue Mar 21 21:12:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit e2216c06aba7bd5301ef41e207ef8d4556f6d8f6
Author: Aníbal Limón <anibal.limon at linux.intel.com>
AuthorDate: Mon Mar 20 14:51:03 2017 -0600

    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 at linux.intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 scripts/yocto-compat-layer.py | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/scripts/yocto-compat-layer.py b/scripts/yocto-compat-layer.py
index 8996fff..b96f3ca 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.")

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list