[autobuilder-helper,warrior,06/41] prepare-shared-repos: Use temporary non-NFS directory for layer clones for speed

Submitted by Richard Purdie on Sept. 10, 2020, 12:25 p.m. | Patch ID: 176286

Details

Message ID 20200910122553.2040430-6-richard.purdie@linuxfoundation.org
State New
Headers show

Commit Message

Richard Purdie Sept. 10, 2020, 12:25 p.m.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 scripts/prepare-shared-repos | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/scripts/prepare-shared-repos b/scripts/prepare-shared-repos
index eb89f5b..9ed0772 100755
--- a/scripts/prepare-shared-repos
+++ b/scripts/prepare-shared-repos
@@ -8,6 +8,7 @@  import os
 import sys
 import subprocess
 import errno
+import tempfile
 
 import utils
 
@@ -31,8 +32,11 @@  with open(args.repojson) as f:
 
 stashdir = utils.getconfig("REPO_STASH_DIR", ourconfig)
 
-for repo in sorted(repos.keys()):
-    utils.printheader("Intially fetching repo %s" % repo)
-    utils.fetchgitrepo(args.sharedsrcdir, repo, repos[repo], stashdir)
-    if args.publish_dir:
-        utils.publishrepo(args.sharedsrcdir, repo, args.publish_dir)
+with tempfile.TemporaryDirectory(prefix="shared-repo-temp-", dir="/tmp") as tempdir:
+    for repo in sorted(repos.keys()):
+        utils.printheader("Intially fetching repo %s" % repo)
+        utils.fetchgitrepo(tempdir, repo, repos[repo], stashdir)
+        if args.publish_dir:
+            utils.publishrepo(tempdir, repo, args.publish_dir)
+
+    subprocess.check_call(["rsync", "-a", tempdir + "/*", args.sharedsrcdir])