Skip to content

Commit 6cbe16e

Browse files
committed
Bazel: add progress reporting
1 parent ecdf623 commit 6cbe16e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

misc/bazel/lfs.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ def lfs_smudge(repository_ctx, srcs, extract = False, stripPrefix = None):
55
python = repository_ctx.which("python3") or repository_ctx.which("python")
66
if not python:
77
fail("Neither python3 nor python executables found")
8+
repository_ctx.report_progress("querying LFS url(s) for: %s" % ", ".join([src.basename for src in srcs]))
89
res = repository_ctx.execute([python, script] + srcs, quiet = True)
910
if res.return_code != 0:
1011
fail("git LFS probing failed while instantiating @%s:\n%s" % (repository_ctx.name, res.stderr))
12+
promises = []
1113
for src, loc in zip(srcs, res.stdout.splitlines()):
1214
if loc == "local":
1315
if extract:
16+
repository_ctx.report_progress("extracting local %s" % src.basename)
1417
repository_ctx.extract(src, stripPrefix = stripPrefix)
1518
else:
19+
repository_ctx.report_progress("symlinking local %s" % src.basename)
1620
repository_ctx.symlink(src, src.basename)
1721
else:
1822
sha256, _, url = loc.partition(" ")
@@ -22,8 +26,10 @@ def lfs_smudge(repository_ctx, srcs, extract = False, stripPrefix = None):
2226
# it doesn't matter if file is something like some.name.zip and possible_extension == "name.zip",
2327
# download_and_extract will just append ".name.zip" its internal temporary name, so extraction works
2428
possible_extension = ".".join(src.basename.rsplit(".", 2)[-2:])
29+
repository_ctx.report_progress("downloading and extracting remote %s" % src.basename)
2530
repository_ctx.download_and_extract(url, sha256 = sha256, stripPrefix = stripPrefix, type = possible_extension)
2631
else:
32+
repository_ctx.report_progress("downloading remote %s" % src.basename)
2733
repository_ctx.download(url, src.basename, sha256 = sha256)
2834

2935
def _download_and_extract_lfs(repository_ctx):

0 commit comments

Comments
 (0)