Skip to content

Commit

Permalink
Do not warn if the origin paths are the same. (#615)
Browse files Browse the repository at this point in the history
  • Loading branch information
faximan authored Sep 13, 2022
1 parent 46eabd3 commit 0f128a2
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions pkg/private/pkg_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,23 @@ _DestFile = provider(
def _check_dest(content_map, dest, src, origin):
old_entry = content_map.get(dest)

# TODO(#385): This is insufficient but good enough for now. We should
# compare over all the attributes too. That will detect problems where
# people specify the owner in one place, but another overly broad glob
# brings in the file with a different owner.
if old_entry and old_entry.src != src:
# buildifier: disable=print
print("Duplicate output path: <%s>, declared in %s and %s" % (
dest,
origin,
content_map[dest].origin,
))
# TODO(#385): This is insufficient but good enough for now.
# Ideally, we should
# - If the origin paths are different, then fail (breaking change)
# - If the origin paths are the same, then warn if any of the attributes
# (mode, owner, architecture) are different as we are going to pick
# one, but not necessairly the one that the user intended.
# This would also detect problems where people specify the owner in
# one place, but another overly broad glob brings in the file with
# a different owner.
if origin != old_entry.origin:
# buildifier: disable=print
print("Duplicate output path: <%s>, declared in %s and %s" % (
dest,
origin,
old_entry.origin,
))

def _merge_attributes(info, mode, user, group):
if hasattr(info, "attributes"):
Expand Down

0 comments on commit 0f128a2

Please sign in to comment.