yocto-autobuilder-helper/scripts/shared-repo-unpack
Richard Purdie 7f70683c57 prepare-shared-repos/shared-repo-unpack: Allow future option to filter repos and implement more functionality
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-22 16:12:34 +00:00

38 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python3
#
# Unpack a shared directory of repos to the autobuilder working directory
#
# Called with $1 - The json file containing the repositories to use
# $2 - The shared directory where the repos are to be transferred from (can be 'None')
# $3 - The autobuilder working directory
# $4 - The target to filter the repos to
#
import json
import os
import sys
import subprocess
import errno
import utils
if len(sys.argv) != 4:
print("Incorrect number of parameters, please call as %s repo.json")
sys.exit(1)
repojson = sys.argv[1]
shared = sys.argv[2]
targetdir = sys.argv[3]
ourconfig = utils.loadconfig(__file__)
with open(repojson) as f:
repos = json.load(f)
# FIXME: Need to filter repo list to the list of repos we need from ourconfig
for repo in sorted(repos.keys()):
if shared:
subprocess.check_call(["rsync", "-a", "%s/%s" % (shared, repo), "%s/%s" % (targetdir, repo)])
else:
utils.fetchgitrepo(targetdir, repo, repos[repo], stashdir)