yocto-autobuilder-helper/scripts/layer-config
Richard Purdie 943395f925 layer-config: Add configuration for calling the init scripts (fixes eclipse build)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-30 14:13:22 +00:00

55 lines
1.8 KiB
Python
Executable File

#!/usr/bin/env python3
#
# Move the repositories into the correct layout and generate bblayers.conf
#
# Called with $1 - The autobuilder working directory
# $2 - The target to filter the repos to
#
import json
import os
import sys
import subprocess
import errno
import utils
if len(sys.argv) != 3:
print("Incorrect number of parameters, please call as %s <autobuilder-workdir> <target>" % sys.argv[0])
sys.exit(1)
targetdir = sys.argv[1]
target = sys.argv[2]
targetbuilddir = targetdir
ourconfig = utils.loadconfig(__file__)
def bitbakecmd(targetbuilddir, cmd):
ret = subprocess.call(". ./oe-init-build-env; %s" % cmd, shell=True, cwd=targetbuilddir)
if ret:
utils.printheader("ERROR: Command %s failed with exit code %d, see errors above." % (cmd, ret))
needrepos = utils.getconfigvar("NEEDREPOS", ourconfig, target, None)
callinit = False
for repo in needrepos:
checkdir = repo
if repo in ourconfig["repo-defaults"]:
if "call-init" in ourconfig["repo-defaults"][repo] and ourconfig["repo-defaults"][repo]["call-init"]:
callinit = True
if "checkout-dirname" in ourconfig["repo-defaults"][repo]:
checkdir = ourconfig["repo-defaults"][repo]["checkout-dirname"]
utils.mkdir(targetbuilddir + "/" + checkdir)
for f in os.listdir(targetdir + "/repos/" + repo):
subprocess.check_call(['mv', targetdir + "/repos/" + repo + "/" + f, targetbuilddir + "/" + checkdir + "/"])
if callinit:
subprocess.check_call(". ./oe-init-build-env", shell=True, cwd=targetbuilddir)
for repo in needrepos:
if repo in ourconfig["repo-defaults"] and "no-layer-add" in ourconfig["repo-defaults"][repo] and ourconfig["repo-defaults"][repo]["no-layer-add"]:
continue
bitbakecmd(targetbuilddir, "bitbake-layers add-layer %s" % (targetbuilddir + "/" + repo))