From e47a9a26f5cfccaf02cc2252b23f5d218a788a3e Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 16 Sep 2020 23:29:32 +0100 Subject: [PATCH] scripts/send-qa-email,utils: Use buildtools if present resulttool has python version requirements so use buildtools if present. Signed-off-by: Richard Purdie --- scripts/send-qa-email | 4 ++++ scripts/utils.py | 27 +++++++++++++++------------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/scripts/send-qa-email b/scripts/send-qa-email index f38c876..2757fb4 100755 --- a/scripts/send-qa-email +++ b/scripts/send-qa-email @@ -41,6 +41,10 @@ with open(args.repojson) as f: resulttool = os.path.dirname(args.repojson) + "/build/scripts/resulttool" +buildtoolsdir = os.path.dirname(args.repojson) + "/buildtools" +if os.path.exists(buildtoolsdir): + utils.enable_buildtools_tarball(ourconfig, args.workername, buildtoolsdir) + if 'poky' in repos and os.path.exists(resulttool) and args.results_dir: # Need the finalised revisions (not 'HEAD') targetrepodir = "%s/poky" % (args.sharedrepodir) diff --git a/scripts/utils.py b/scripts/utils.py index 46346fb..5e169da 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -397,6 +397,20 @@ def sha256_file(filename): pass return method.hexdigest() +def enable_buildtools_tarball(btdir): + btenv = glob.glob(btdir + "/environment-setup*") + print("Using buildtools %s" % btenv) + # We either parse or wrap all our execution calls, rock and a hard place :( + with open(btenv[0], "r") as f: + for line in f.readlines(): + if line.startswith("export "): + line = line.strip().split(" ", 1)[1].split("=", 1) + if "$PATH" in line[1]: + line[1] = line[1].replace("$PATH", os.environ["PATH"]) + if line[1].startswith(("'", '"')): + line[1] = line[1][1:-1] + os.environ[line[0]] = line[1] + def setup_buildtools_tarball(ourconfig, workername, btdir): bttarball = None if "buildtools" in ourconfig and workername: @@ -438,15 +452,4 @@ def setup_buildtools_tarball(ourconfig, workername, btdir): # We raced with someone else, try again pass subprocess.check_call(["bash", btdlpath, "-d", btdir, "-y"]) - btenv = glob.glob(btdir + "/environment-setup*") - print("Using buildtools %s" % btenv) - # We either parse or wrap all our execution calls, rock and a hard place :( - with open(btenv[0], "r") as f: - for line in f.readlines(): - if line.startswith("export "): - line = line.strip().split(" ", 1)[1].split("=", 1) - if "$PATH" in line[1]: - line[1] = line[1].replace("$PATH", os.environ["PATH"]) - if line[1].startswith(("'", '"')): - line[1] = line[1][1:-1] - os.environ[line[0]] = line[1] + enable_buildtools_tarball(btdir)