yocto-autobuilder-helper/scripts/setup-config
Richard Purdie bb67d8aa84 setup-config: Start to build up variables to add to configuration
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-15 13:56:00 +00:00

1.3 KiB
Executable File

#!/usr/bin/env python3

import json import os import sys import subprocess

scriptsdir = os.path.dirname(os.path.realpath(file))

with open(os.path.join(scriptsdir, '..', 'config.json')) as f: ourconfig = json.load(f)

target = "nightly-arm" branchname = "master" distro = "poky"

Strip off "nightly-"

target = target[8:]

Check if config contains all the listed params

def contains(params, config): for p in params: if p not in config: return False return True

variables = []

if contains(["BUILD_HISTORY_DIR", "build-history-targets", "BUILD_HISTORY_REPO"], ourconfig): if target in ourconfig["build-history-targets"]: bh_path = os.path.join(ourconfig["BUILD_HISTORY_DIR"], distro, branchname, "nightly-" + target) remoterepo = ourconfig["BUILD_HISTORY_REPO"] remotebranch = distro + "/" + branchname + "/nightly-" + target subprocess.check_output([os.path.join(scriptsdir, "buildhistory-init"), target, bh_path, remoterepo, remotebranch], stderr=subprocess.STDOUT) variables.append('INHERIT += "buildhistory"') variables.append('BUILDHISTORY_DIR = "%s"' % bh_path) variables.append('BUILDHISTORY_PUSH_REPO = "%s %s:%s"' % (remoterepo, remotebranch, remotebranch))

print(str(ourconfig))

print("setup-config called with %s" % " ".join(sys.argv))

print(str(variables))