mirror of
git://git.yoctoproject.org/yocto-autobuilder-helper.git
synced 2025-07-19 20:59:02 +02:00
113 lines
3.9 KiB
Python
Executable File
113 lines
3.9 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
#
|
|
# Generate an auto.conf and associated other config files for a given autobuilder configuration
|
|
#
|
|
# Called with $1 - The 'nightly' target the autobuilder is running
|
|
# $2 - The autobuilder step number (a given target can run multiple steps with different configurations)
|
|
# $3 - The target build directory to configure
|
|
# $4 - The poky branch name the build is running on
|
|
# $5 - The name of the repository the build is running on
|
|
# $6 - The directory to publish sstate into
|
|
# $7 - A build-appliance SRCREV to use
|
|
#
|
|
|
|
import json
|
|
import os
|
|
import sys
|
|
import subprocess
|
|
import errno
|
|
import copy
|
|
import utils
|
|
|
|
if len(sys.argv) != 8:
|
|
print("Incorrect number of parameters, please call as %s <nightly-target> <stepnumber> <target-builddir> <branch-name> <repo-name> <sstate-publish-dir> <build-app-srcrev>" % sys.argv[0])
|
|
sys.exit(1)
|
|
|
|
target = sys.argv[1]
|
|
stepnum = int(sys.argv[2]) + 1 # Our step numbering is 1 2 3 etc., not 0 of buildbot
|
|
builddir = sys.argv[3]
|
|
branchname = sys.argv[4]
|
|
reponame = sys.argv[5]
|
|
sstate_release = sys.argv[6]
|
|
buildappsrcrev = sys.argv[7]
|
|
|
|
ourconfig = utils.loadconfig(__file__)
|
|
|
|
variables = []
|
|
|
|
autoconf = os.path.join(builddir, "conf", "auto.conf")
|
|
if os.path.exists(autoconf):
|
|
os.remove(autoconf)
|
|
|
|
# Ensure autoconf's directory exists
|
|
utils.mkdir(os.path.dirname(autoconf))
|
|
|
|
sdkextraconf = os.path.join(builddir, "conf", "sdk-extra.conf")
|
|
if os.path.exists(sdkextraconf):
|
|
os.remove(sdkextraconf)
|
|
|
|
for v in ["MACHINE", "DISTRO", "SDKMACHINE"]:
|
|
value = utils.getconfigvar(v, ourconfig, target, stepnum)
|
|
if value and value != "None":
|
|
variables.append(v + ' = "%s"' % value)
|
|
|
|
distro = utils.getconfigvar("DISTRO", ourconfig, target, stepnum)
|
|
|
|
for v in ["DLDIR", "PRSERV"]:
|
|
value = utils.getconfigvar(v, ourconfig, target, stepnum)
|
|
if value:
|
|
variables.append(value)
|
|
|
|
# Use a separate SSTATE_DIR with the primary
|
|
# SSTATE_DIR configured as a mirror so that we
|
|
# have a directory of symlinks to sstate objects
|
|
# that can be published for the release
|
|
key = "SSTATEDIR"
|
|
if sstate_release != "None":
|
|
key = "SSTATEDIR_RELEASE"
|
|
value = utils.getconfiglist(key, ourconfig, target, stepnum)
|
|
for v in value:
|
|
v = v.replace("@RELEASENUM@", sstate_release)
|
|
variables.append(v)
|
|
|
|
if buildappsrcrev != "None" and buildappsrcrev != "DEFAULT":
|
|
if buildappsrcrev == "AUTOREV":
|
|
buildappsrcrev = "${AUTOREV}"
|
|
value = utils.getconfiglist("BUILDAPP_SRCREV", ourconfig, target, stepnum)
|
|
for v in value:
|
|
v = v.replace("@SRCREV@", buildappsrcrev)
|
|
variables.append(v)
|
|
|
|
if utils.getconfigvar("BUILDINFO", ourconfig, target, stepnum):
|
|
infovars = utils.getconfiglist("BUILDINFOVARS", ourconfig, target, stepnum)
|
|
variables.extend(infovars)
|
|
|
|
extravars = utils.getconfiglist("extravars", ourconfig, target, stepnum)
|
|
if extravars:
|
|
variables.extend(extravars)
|
|
|
|
bh_path, remoterepo, remotebranch, baseremotebranch = utils.getbuildhistoryconfig(ourconfig, target, reponame, branchname)
|
|
if bh_path:
|
|
variables.append('INHERIT += "buildhistory"')
|
|
variables.append('BUILDHISTORY_DIR = "%s"' % bh_path)
|
|
variables.append('BUILDHISTORY_PUSH_REPO = "%s %s:%s"' % (remoterepo, remotebranch, remotebranch))
|
|
variables.append("BUILDHISTORY_COMMIT = '1'")
|
|
variables.append('ERROR_QA_remove = "version-going-backwards"')
|
|
|
|
utils.printheader("Writing %s with contents:" % autoconf)
|
|
with open(autoconf, "w") as f:
|
|
for v in variables:
|
|
print(" " + v)
|
|
f.write(v + "\n")
|
|
|
|
utils.printheader("Writing %s with contents:" % sdkextraconf)
|
|
with open(sdkextraconf, "w") as f:
|
|
for v in utils.getconfiglist("SDKEXTRAS", ourconfig, target, stepnum):
|
|
replace = ""
|
|
if sstate_release != "None":
|
|
replace = sstate_release + "/"
|
|
v = v.replace("@RELEASENUM@", replace)
|
|
print(" " + v)
|
|
f.write(v + "\n")
|
|
|