Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions third_party/xla/third_party/quilt_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,22 @@ def read_patch_series(ctx, series_spec):
fail("Patch series file does not exist: %s" % series_label)
for line in ctx.read(series_file).splitlines():
line = line.strip()
if line and not line.startswith("#"):
patch_path = series_file.dirname
for part in line.split("/"):
if part and part != ".":
patch_path = patch_path.get_child(part)
patches.append(patch_path)
if not line or line.startswith("#"):
continue
patch_path = series_file.dirname
for part in line.split("/"):
if part and part != ".":
patch_path = patch_path.get_child(part)

# `dirname` and `get_child` are pure path arithmetic and do not
# register a dependency, so watch each patch explicitly. Otherwise
# the implicit watch inside `ctx.patch` is the first access to the
# file and forces a Skyframe restart after the archive has already
# been downloaded and extracted.
ctx.watch(patch_path)
if not patch_path.exists:
fail("Patch file listed in %s does not exist: %s" % (series_label, patch_path))
patches.append(patch_path)
return patches

def _get_link_dict(ctx, link_files, build_file):
Expand Down
Loading