yocto-autobuilder-helper/scripts/layer-config
Thomas Goodwin 43c2a3acc3 layer-config: fixing silent failures from always exiting '0'
The return value from bitbakecmd was not being returned when
errors occurred which allowed shared-repo-unpack to succeed
despite the failure.  This fix changes to check_call and a
try-catch when attempting to add repos that fail for whatever
reason during add-layer, like a missing conf/layer.conf at
the top level or a previously-added layer breaks parsing
because of missing dependencies.

Signed-off-by: Thomas Goodwin <btgoodwin@geontech.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-02 17:34:48 +01:00

1.8 KiB
Executable File

#!/usr/bin/env python3

Move the repositories into the correct layout and generate bblayers.conf

import json import os import sys import subprocess import errno

import utils

parser = utils.ArgParser(description='Moves the repositories into the correct layout and generates bblayers.conf.')

parser.add_argument('abworkdir', help="The autobuilder working directory") parser.add_argument('target', help="The target to filter the repos to")

args = parser.parse_args()

ourconfig = utils.loadconfig()

def bitbakecmd(targetdir, cmd): subprocess.check_call(". ./oe-init-build-env; %s" % cmd, shell=True, cwd=targetdir)

needrepos = utils.getconfigvar("NEEDREPOS", ourconfig, args.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(args.abworkdir + "/" + checkdir) for f in os.listdir(args.abworkdir + "/repos/" + repo): subprocess.check_call(['mv', args.abworkdir + "/repos/" + repo + "/" + f, args.abworkdir + "/" + checkdir + "/"])

if callinit: subprocess.check_call(". ./oe-init-build-env", shell=True, cwd=args.abworkdir)

for repo in needrepos: if repo in repos and "no-layer-add" in repos[repo] and repos[repo]["no-layer-add"]: continue try: bitbakecmd(args.abworkdir, "bitbake-layers add-layer %s" % (args.abworkdir + "/" + repo)) except subprocess.CalledProcessError as e: utils.printheader("ERROR: Command %s failed with exit code %d, see errors above." % (e.cmd, e.returncode)) sys.exit(e.returncode)