]> code.ossystems Code Review - openembedded-core.git/commitdiff
buildhistory-diff: use BUILDDIR to know where buildhistory is
authorRoss Burton <ross@burtonini.com>
Tue, 15 Sep 2020 12:55:48 +0000 (13:55 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 16 Sep 2020 13:02:27 +0000 (14:02 +0100)
Instead of assuming that the buildhistory is stored in ./buildhistory
unless told otherwise, use the environment variable BUILDDIR if present
(which is set by oe-init-build-env) to locate the buildhistory
directory.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/buildhistory-diff

index 833f7c33a5b7aa16db938056b4b2e065c3216348..3bd40a2a1ea989be858feb4acdec0afb60bb6a2e 100755 (executable)
@@ -28,10 +28,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',
@@ -80,11 +82,6 @@ def main():
         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)