yocto-autobuilder-helper/scripts/layer-config
Richard Purdie b7cf6d8209 utils: Allow customisation using ABHELPER_JSON from the environment
Usage is documented in README and an example, local-example.json is
included.

Also clean up the parameter to loadconfig() as its actually not needed.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-20 23:16:10 +01:00

1.7 KiB
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 " % sys.argv[0]) sys.exit(1)

targetdir = sys.argv[1] target = sys.argv[2] targetbuilddir = targetdir

ourconfig = utils.loadconfig()

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

repos = utils.getconfig("repo-defaults", ourconfig)

for repo in needrepos: checkdir = repo if repo in repos: if "call-init" in repos[repo] and repos[repo]["call-init"]: callinit = True if "checkout-dirname" in repos[repo]: checkdir = repos[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 repos and "no-layer-add" in repos[repo] and repos[repo]["no-layer-add"]: continue bitbakecmd(targetbuilddir, "bitbake-layers add-layer %s" % (targetbuilddir + "/" + repo))