yocto-autobuilder-helper/scripts/layer-config
Richard Purdie aad15671f7 shared-repos-unpack/layer-config: Use topdir and repos subdirs for checkouts/builds
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-25 10:15:58 +00:00

1.6 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 + "/topdir"

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)

for repo in needrepos: checkdir = repo if repo in ourconfig["repo-defaults"] and "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 + "/"])

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))