aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLei Maohui <leimaohui@cn.fujitsu.com>2019-05-30 14:10:39 +0900
committerLei Maohui <leimaohui@cn.fujitsu.com>2019-05-30 14:10:39 +0900
commit37efe5b9934f4f17876e95afcba5ca2056c94573 (patch)
treea0dd0628725a7a0e17b2c552a1eca17fb36cc264
parent32878f394005420067f20b6c99a3f6afe9285b9d (diff)
downloadmeta-spdxscanner-37efe5b9934f4f17876e95afcba5ca2056c94573.tar.gz
meta-spdxscanner-37efe5b9934f4f17876e95afcba5ca2056c94573.tar.bz2
meta-spdxscanner-37efe5b9934f4f17876e95afcba5ca2056c94573.zip
Try more times to reduce failure when milti do_spdx is running.
Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
-rw-r--r--classes/fossdriver-host.bbclass50
1 files changed, 35 insertions, 15 deletions
diff --git a/classes/fossdriver-host.bbclass b/classes/fossdriver-host.bbclass
index 4a4f2e5..6160aa3 100644
--- a/classes/fossdriver-host.bbclass
+++ b/classes/fossdriver-host.bbclass
@@ -131,7 +131,7 @@ python do_spdx () {
bb.warn('Can\'t get the spdx file ' + info['pn'] + '. Please check your.')
}
-addtask do_spdx before do_fetch
+addtask do_spdx before do_unpack after do_fetch
def spdx_create_tarball(d, srcdir, suffix, ar_outdir):
"""
@@ -197,6 +197,7 @@ def spdx_get_src(d):
def invoke_fossdriver(tar_file, spdx_file):
import os
+ import time
(work_dir, tar_file) = os.path.split(tar_file)
os.chdir(work_dir)
@@ -214,24 +215,43 @@ def invoke_fossdriver(tar_file, spdx_file):
bb.note("invoke_fossdriver : tar_file = %s " % tar_file)
if (Reuse(server, tar_file, "Software Repository", tar_file, "Software Repository").run() != True):
bb.note("This OSS has not been scanned. So upload it to fossology server.")
- if (Upload(server, tar_file, "Software Repository").run() != True):
+ i = 0
+ while i < 5:
+ if (Upload(server, tar_file, "Software Repository").run() != True):
bb.warn("%s Upload failed, try again!" % tar_file)
- if (Upload(server, tar_file, "Software Repository").run() != True):
- bb.warn("%s Upload fail.Please check your fossology server." % tar_file)
- return False
- else:
+ i += 1
+ else:
+ i = 0
+ while i < 10:
if (Scanners(server, tar_file, "Software Repository").run() != True):
bb.warn("%s scanner failed, try again!" % tar_file)
- if (Scanners(server, tar_file, "Software Repository").run() != True):
- bb.warn("%s scanner fail.Please check your fossology server." % tar_file)
- return False
+ i+= 1
+ else:
+ i = 0
+ while i < 10:
+ if (SPDXTV(server, tar_file, "Software Repository", spdx_file).run() == False):
+ time.sleep(1)
+ bb.warn("%s SPDXTV failed, try again!" % tar_file)
+ i += 1
+ else:
+ return True
+ bb.warn("%s SPDXTV failed, Please check your fossology server." % tar_file)
+ return False
+ bb.warn("%s Scanners failed, Please check your fossology server." % tar_file)
+ return False
+ bb.warn("%s Upload fail.Please check your fossology server." % tar_file)
+ return False
else:
- bb.note("This OSS has been scanned. Use the last result.")
- if (SPDXTV(server, tar_file, "Software Repository", spdx_file).run() == False):
- bb.warn("%s SPDXTV failed, try again!" % tar_file)
- if (SPDXTV(server, tar_file, "Software Repository", spdx_file).run() == False):
- bb.warn("%s scanner fail.Please check your fossology server." % tar_file)
- return False
+ i = 0
+ while i < 10:
+ if (SPDXTV(server, tar_file, "Software Repository", spdx_file).run() == False):
+ time.sleep(1)
+ bb.warn("%s SPDXTV failed, try again!" % tar_file)
+ i += 1
+ else:
+ return True
+ bb.warn("%s SPDXTV failed, Please check your fossology server." % tar_file)
+ return False
def create_manifest(info,sstatefile):
import shutil