summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander FaxÄ <alexander.faxa@gmail.com>2022-09-13 17:40:17 +0200
committerGitHub <noreply@github.com>2022-09-13 11:40:17 -0400
commit0f128a2579163798b75da0309c73d5cbfaf7e261 (patch)
tree10be3088d10884e8be79296c290aa8f26397328e
parent46eabd36cf957920406d2a8b05f178a0bd0f851a (diff)
downloadbazelbuild-rules_pkg-0f128a2579163798b75da0309c73d5cbfaf7e261.tar.gz
Do not warn if the origin paths are the same. (#615)
-rw-r--r--pkg/private/pkg_files.bzl26
1 files changed, 16 insertions, 10 deletions
diff --git a/pkg/private/pkg_files.bzl b/pkg/private/pkg_files.bzl
index 75e12db..f78f28b 100644
--- a/pkg/private/pkg_files.bzl
+++ b/pkg/private/pkg_files.bzl
@@ -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"):