yocto-autobuilder-helper/scripts/shared-repo-unpack
Thomas Goodwin 417c7d33db layer-config, shared-repo-unpack: Sub-repos in NEEDREPOS
The previous fixes requires the user to set "no-layer-add"
for a repo and then use ADDLAYER to insert the sub-repos
(e.g., meta-openmbedded/meta-oe) as a two-part process.
This means that you would also have to specify that flag
if a repo that is a layer with dependencies is in the
list so that it can be inserted in the correct order later
via ADDLAYER to avoid parsing problems.  This fix allows
for specifying a NEEDREPOS with the subdirectory of the
target layer (e.g., meta-openembedded/meta-oe) so that
there is no need for the "no-layer-add" followed by
ADDLAYER combination.  The entire meta-openembedded
repo would be moved into place, and the sublayer added
to bblayers.conf.

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

65 lines
2.0 KiB
Python
Executable File

#!/usr/bin/env python3
#
# Unpack a shared directory of repos to the autobuilder working directory
#
import json
import os
import sys
import subprocess
import errno
import time
import random
import utils
parser = utils.ArgParser(description='Unpacks a shared directory of repos to the autobuilder working directory.')
parser.add_argument('repojson',
help="The json file containing the repositories to use")
parser.add_argument('abworkdir',
help="The autobuilder working directory")
parser.add_argument('target',
help="The target we want to unpack repos for")
parser.add_argument('-c', '--cache-dir',
action='store',
help="The shared cache directory where the repos may be transferred from")
parser.add_argument('-p', '--publish-dir',
action='store',
help="Where to publish artefacts to (optional)")
args = parser.parse_args()
scriptsdir = os.path.dirname(os.path.realpath(__file__))
ourconfig = utils.loadconfig()
stashdir = utils.getconfig("REPO_STASH_DIR", ourconfig)
needrepos = utils.getconfigvar("NEEDREPOS", ourconfig, args.target, None)
with open(args.repojson) as f:
repos = json.load(f)
targetsubdir = args.abworkdir + "/repos"
needrepos_baseddirs = [r.split('/')[0] for r in needrepos]
for repo in sorted(repos.keys()):
if repo not in needrepos_baseddirs:
continue
targetrepodir = "%s/%s" % (targetsubdir, repo)
if args.cache_dir:
utils.printheader("Copying in repo %s" % repo)
utils.mkdir(targetrepodir)
subprocess.check_call(["rsync", "-a", "%s/%s" % (args.cache_dir, repo), targetsubdir])
else:
utils.printheader("Fetching repo %s" % repo)
utils.fetchgitrepo(targetsubdir, repo, repos[repo], stashdir)
if args.publish_dir:
utils.publishrepo(targetsubdir, repo, args.publish_dir)
try:
subprocess.check_call([scriptsdir + "/layer-config", args.abworkdir, args.target])
except subprocess.CalledProcessError as e:
sys.exit(e.returncode)