[gnome-continuous-yocto/gnomeostree-3.28-rocko: 5234/8267] scripts/yocto-compat-layer.py: Make output log argument optional



commit 07dd071bf667d5f0a729ec8f5e0d6a117d70596c
Author: Aníbal Limón <anibal limon linux intel com>
Date:   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]
    
    (From OE-Core rev: f91ccdeb8b0b3e4063ed2bf22215a25f8902cbd9)
    
    Signed-off-by: Aníbal Limón <anibal limon linux intel com>
    Signed-off-by: Ross Burton <ross burton intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 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 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.")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]