summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-04-02 23:51:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-04-09 22:15:46 +0100
commitd80bcba0e34a1037447dfe7ab4857a987db39364 (patch)
tree8de232b96377747174702bb52bda3685fe88602a /scripts
parent10d43f6d08df45d259aa76c2a7815cb951df8fe0 (diff)
downloadpoky-d80bcba0e34a1037447dfe7ab4857a987db39364.tar.gz
poky-d80bcba0e34a1037447dfe7ab4857a987db39364.tar.bz2
poky-d80bcba0e34a1037447dfe7ab4857a987db39364.zip
resulttool: Allow store to work on single files
Store operations using a single file as a source weren't working as the os.walk command didn't like being given a single file. Fix the store operation to work for single files. (From OE-Core rev: 5173954c1ec75629bedbe06d6979dae36eb71b6f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/resulttool/store.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/scripts/lib/resulttool/store.py b/scripts/lib/resulttool/store.py
index 5e33716c3d..3a81933242 100644
--- a/scripts/lib/resulttool/store.py
+++ b/scripts/lib/resulttool/store.py
@@ -29,15 +29,18 @@ def store(args, logger):
try:
results = {}
logger.info('Reading files from %s' % args.source)
- for root, dirs, files in os.walk(args.source):
- for name in files:
- f = os.path.join(root, name)
- if name == "testresults.json":
- resultutils.append_resultsdata(results, f)
- elif args.all:
- dst = f.replace(args.source, tempdir + "/")
- os.makedirs(os.path.dirname(dst), exist_ok=True)
- shutil.copyfile(f, dst)
+ if os.path.isfile(args.source):
+ resultutils.append_resultsdata(results, args.source)
+ else:
+ for root, dirs, files in os.walk(args.source):
+ for name in files:
+ f = os.path.join(root, name)
+ if name == "testresults.json":
+ resultutils.append_resultsdata(results, f)
+ elif args.all:
+ dst = f.replace(args.source, tempdir + "/")
+ os.makedirs(os.path.dirname(dst), exist_ok=True)
+ shutil.copyfile(f, dst)
revisions = {}