diff options
Diffstat (limited to 'scripts/buildhistory-diff')
-rwxr-xr-x | scripts/buildhistory-diff | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/scripts/buildhistory-diff b/scripts/buildhistory-diff index e79cb7ac8d..a6e785aa23 100755 --- a/scripts/buildhistory-diff +++ b/scripts/buildhistory-diff @@ -4,11 +4,13 @@ # # Copyright (C) 2013 Intel Corporation # Author: Paul Eggleton <paul.eggleton@linux.intel.com> +# +# SPDX-License-Identifier: GPL-2.0-only +# import sys import os import argparse -from distutils.version import LooseVersion # Ensure PythonGit is installed (buildhistory_analysis needs it) try: @@ -25,10 +27,12 @@ def get_args_parser(): %(prog)s [options] [from-revision [to-revision]] (if not specified, from-revision defaults to build-minus-1, and to-revision defaults to HEAD)""") + default_dir = os.path.join(os.environ.get('BUILDDIR', '.'), 'buildhistory') + parser.add_argument('-p', '--buildhistory-dir', action='store', dest='buildhistory_dir', - default='buildhistory/', + default=default_dir, help="Specify path to buildhistory directory (defaults to buildhistory/ under cwd)") parser.add_argument('-v', '--report-version', action='store_true', @@ -38,7 +42,7 @@ def get_args_parser(): parser.add_argument('-a', '--report-all', action='store_true', dest='report_all', - default='False', + default=False, help="Report all changes, not just the default significant ones") parser.add_argument('-s', '---signatures', action='store_true', @@ -53,6 +57,10 @@ def get_args_parser(): parser.add_argument('-e', '--exclude-path', action='append', help="Exclude path from the output") + parser.add_argument('-c', '--colour', + choices=('yes', 'no', 'auto'), + default="auto", + help="Whether to colourise (defaults to auto)") parser.add_argument('revisions', default = ['build-minus-1', 'HEAD'], nargs='*', @@ -64,20 +72,11 @@ def main(): parser = get_args_parser() args = parser.parse_args() - if LooseVersion(git.__version__) < '0.3.1': - sys.stderr.write("Version of GitPython is too old, please install GitPython (python-git) 0.3.1 or later in order to use this script\n") - sys.exit(1) - if len(args.revisions) > 2: sys.stderr.write('Invalid argument(s) specified: %s\n\n' % ' '.join(args.revisions[2:])) parser.print_help() sys.exit(1) - if not os.path.exists(args.buildhistory_dir): - if args.buildhistory_dir == 'buildhistory/': - cwd = os.getcwd() - if os.path.basename(cwd) == 'buildhistory': - args.buildhistory_dir = cwd if not os.path.exists(args.buildhistory_dir): sys.stderr.write('Buildhistory directory "%s" does not exist\n\n' % args.buildhistory_dir) @@ -107,10 +106,11 @@ def main(): elif len(args.revisions) == 2: fromrev, torev = args.revisions - from oe.buildhistory_analysis import process_changes - + from oe.buildhistory_analysis import init_colours, process_changes import gitdb + init_colours({"yes": True, "no": False, "auto": sys.stdout.isatty()}[args.colour]) + try: changes = process_changes(args.buildhistory_dir, fromrev, torev, args.report_all, args.report_ver, args.sigs, |