Continue to fill out buildhistory code

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2018-01-15 13:45:29 +00:00
parent 70db7ea161
commit d19e7f2802
3 changed files with 53 additions and 15 deletions

View File

@ -1,3 +1,5 @@
{ {
"buildhistory" : "True" "build-history-targets" : ["arm64", "arm", "arm-lsb", "mips64", "mips", "mips-lsb", "ppc", "ppc-lsb", "x86-64", "x86-64-lsb", "x86", "x86-lsb"],
"BUILD_HISTORY_DIR" : "/srv/www/vhosts/autobuilder.yoctoproject.org/buildhistory",
"BUILD_HISTORY_REPO" : "ssh://git@push.yoctoproject.org/poky-buildhistory"
} }

View File

@ -1,27 +1,39 @@
#!/bin/sh #!/bin/sh
#
# Called with $1 - The target name
# $2 - The buildhistory directory
# $3 - The remote repository url
# $4 - The remote branch name
#
TARGETNAME=$1
BUILDHISTDIR=$2
REMOTEREPO=$3
REMOTEBRANCH=$4
echo BH $@
exit 0 exit 0
# Example code dumped from an existing nightly-arm buildhistory step for reference # Example code dumped from an existing nightly-arm buildhistory step for reference
if [ ! -d /srv/www/vhosts/autobuilder.yoctoproject.org/buildhistory/poky/master-next/nightly-arm ]; then if [ ! -d $BUILDHISTDIR ]; then
mkdir -p /srv/www/vhosts/autobuilder.yoctoproject.org/buildhistory/poky/master-next/nightly-arm mkdir -p $BUILDHISTDIR
git init /srv/www/vhosts/autobuilder.yoctoproject.org/buildhistory/poky/master-next/nightly-arm git init $BUILDHISTDIR
fi fi
rm -rf /srv/www/vhosts/autobuilder.yoctoproject.org/buildhistory/poky/master-next/nightly-arm rm -rf $BUILDHISTDIR
mkdir -p /srv/www/vhosts/autobuilder.yoctoproject.org/buildhistory/poky/master-next/nightly-arm mkdir -p $BUILDHISTDIR
git init /srv/www/vhosts/autobuilder.yoctoproject.org/buildhistory/poky/master-next/nightly-arm git init $BUILDHISTDIR
if git ls-remote --exit-code ssh://git@push.yoctoproject.org/poky-buildhistory refs/heads/poky/master-next/nightly-arm> /dev/null; then if git ls-remote --exit-code $REMOTEREPO refs/heads/$REMOTEBRANCH> /dev/null; then
git push -q ssh://git@push.yoctoproject.org/poky-buildhistory :poky/master-next/nightly-arm git push -q $REMOTEREPO :$REMOTEBRANCH
fi fi
if ! git ls-remote --exit-code ssh://git@push.yoctoproject.org/poky-buildhistory refs/heads/poky/master-next/nightly-arm > /dev/null; then if ! git ls-remote --exit-code $REMOTEREPO refs/heads/$REMOTEBRANCH > /dev/null; then
cd /srv/www/vhosts/autobuilder.yoctoproject.org/buildhistory/poky/master-next/nightly-arm cd $BUILDHISTDIR
echo 'Initializing Repo' >> README echo 'Initializing Repo' >> README
git checkout -b poky/master-next/nightly-arm git checkout -b $REMOTEBRANCH
git add README git add README
git commit -s -m 'Initializing Repo' git commit -s -m 'Initializing Repo'
git push -q ssh://git@push.yoctoproject.org/poky-buildhistory poky/master-next/nightly-arm:poky/master-next/nightly-arm git push -q $REMOTEREPO $REMOTEBRANCH:$REMOTEBRANCH
fi fi

View File

@ -3,13 +3,37 @@
import json import json
import os import os
import sys import sys
import subprocess
scriptsdir = os.path.dirname(os.path.realpath(__file__)) scriptsdir = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(scriptsdir, '..', 'config.json')) as f: with open(os.path.join(scriptsdir, '..', 'config.json')) as f:
ourconfig = json.load(f) ourconfig = json.load(f)
os.system(os.path.join(scriptsdir, "buildhistory-init")) 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
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)
print(str(ourconfig))
print("setup-config called with %s" % " ".join(sys.argv)) print("setup-config called with %s" % " ".join(sys.argv))