utils/shared-repo-unpack: Create common mkdir function and fix shared-repo-unpack to create directory to rsync to

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2018-01-23 12:27:21 +00:00
parent 806957b392
commit f79fab19a1
3 changed files with 14 additions and 7 deletions

View File

@ -40,12 +40,7 @@ if os.path.exists(autoconf):
os.remove(autoconf)
# Ensure autoconf's directory exists
try:
os.makedirs(os.path.dirname(autoconf))
except OSError as e:
if e.errno != errno.EEXIST:
# Do not complain if the directory exists
raise e
utils.mkdir(os.path.dirname(autoconf))
sdkextraconf = os.path.join(builddir, "conf", "sdk-extra.conf")
if os.path.exists(sdkextraconf):

View File

@ -37,9 +37,11 @@ with open(repojson) as f:
for repo in sorted(repos.keys()):
if repo not in needrepos:
continue
targetrepodir = "%s/%s" % (targetdir, repo)
if shared:
utils.printheader("Copying in repo %s" % repo)
subprocess.check_call(["rsync", "-a", "%s/%s" % (shared, repo), "%s/%s" % (targetdir, repo)])
utils.mkdir(targetrepodir)
subprocess.check_call(["rsync", "-a", "%s/%s" % (shared, repo), targetrepodir])
else:
utils.printheader("Fetching repo %s" % repo)
utils.fetchgitrepo(targetdir, repo, repos[repo], stashdir)

View File

@ -2,6 +2,7 @@ import subprocess
import copy
import os
import json
import errno
#
# Check if config contains all the listed params
@ -101,6 +102,15 @@ def fetchgitrepo(clonedir, repo, params, stashdir):
subprocess.check_call(["git", "checkout", branch], cwd=sharedrepo)
subprocess.check_call(["git", "reset", revision, "--hard"], cwd=sharedrepo)
def mkdir(path):
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
# Do not complain if the directory exists
raise e
def printheader(msg):
print("")
print("====================================================================================================")