scripts/send-qa-email,utils: Use buildtools if present

resulttool has python version requirements so use buildtools if present.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2020-09-16 23:29:32 +01:00
parent 838be1a00c
commit e47a9a26f5
2 changed files with 19 additions and 12 deletions

View File

@ -41,6 +41,10 @@ with open(args.repojson) as f:
resulttool = os.path.dirname(args.repojson) + "/build/scripts/resulttool" 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: if 'poky' in repos and os.path.exists(resulttool) and args.results_dir:
# Need the finalised revisions (not 'HEAD') # Need the finalised revisions (not 'HEAD')
targetrepodir = "%s/poky" % (args.sharedrepodir) targetrepodir = "%s/poky" % (args.sharedrepodir)

View File

@ -397,6 +397,20 @@ def sha256_file(filename):
pass pass
return method.hexdigest() 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): def setup_buildtools_tarball(ourconfig, workername, btdir):
bttarball = None bttarball = None
if "buildtools" in ourconfig and workername: if "buildtools" in ourconfig and workername:
@ -438,15 +452,4 @@ def setup_buildtools_tarball(ourconfig, workername, btdir):
# We raced with someone else, try again # We raced with someone else, try again
pass pass
subprocess.check_call(["bash", btdlpath, "-d", btdir, "-y"]) subprocess.check_call(["bash", btdlpath, "-d", btdir, "-y"])
btenv = glob.glob(btdir + "/environment-setup*") enable_buildtools_tarball(btdir)
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]