bazelbuild / rules_pkg

Bazel rules for creating packages of many types (zip, tar, deb, rpm, ...)
Apache License 2.0
216 stars 171 forks source link

Clarify validity requirements in docs of PackageFilesInfo/PackageFilegroupInfo #746

Open nnmm opened 1 year ago

nnmm commented 1 year ago

Is it invalid (meaning under no circumstances a good idea, assumed by consuming rules not to happen) to have

Imo it would be helpful to mention that in the docs of the respective provider. That way, these providers can become a more standardized interface between producing and consuming rules.

aiuto commented 10 months ago

Do you intend to create new rules which would consume these providers?

I'm having trouble understanding the questions abouta/b and a/b/c mixing where a/b is a regular file. Do you have a working example which can do that? If the source package a/b exists, so there can be a target a/b/c, then it is almost always incorrect in Bazel to have the package a produce the plain or symlink target a/b.

nnmm commented 10 months ago

@aiuto Yes, I do have a custom rule consuming these providers.

By "containing a file a/b", I mean an entry in dest_src_map with key a/b. So this has nothing to do with targets' names/packages, only with the destination path.

aiuto commented 10 months ago

We're talking about the same thing. It is very difficult to be clear without a concrete example. The srcs of a pkg_ rule are targets themselves, even if they are plain files.

While it is possible to create something like that, it is an unsupported edge case in Bazel. To put it a different way. If //a/b:c is a valid target in your project, and you have also defined the target //a:b, then you are doing something wrong at the core Bazel level.

I'm not going to spend any thought time about the expected behavior when we hit those situations.

On Tue, Oct 17, 2023, 7:20 AM Nikolai Morin @.***> wrote:

@aiuto https://github.com/aiuto Yes, I do have a custom rule consuming these providers.

By "containing a file a/b", I mean an entry in dest_src_map with key a/b. So this has nothing to do with targets' names/packages, only with the destination path.

— Reply to this email directly, view it on GitHub https://github.com/bazelbuild/rules_pkg/issues/746#issuecomment-1766209823, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXHHHAYCP55L6WFF23JDD3X7ZSZHAVCNFSM6AAAAAA4C4ZJEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRWGIYDSOBSGM . You are receiving this because you were mentioned.Message ID: @.***>