Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide pkg_mklink, pkg_filegroup #293

Merged
merged 5 commits into from
Mar 8, 2021

Conversation

nacl
Copy link
Collaborator

@nacl nacl commented Feb 16, 2021

This change provides the last two pieces of the basic package creation puzzle: a
symbolic link provisioning rule (pkg_mklink) and a simple package grouping
rule (pkg_filegroup).

As compared to the original rules in pkg/experimental/pkg_filegroup.bzl:

  • pkg_mklink (formerly pkg_mklinks) now operates on a single
    source-destination pair. This is to ease integration of a planned feature
    where you will be able to make symbolic links to targets named by a label.
    The mechanics of this particular feature are not fleshed out at this time, but
    the current feeling is that these will be resolved as a part of the
    pkg_filegroup rule.

    To create multiple links, you can use a list comprehension in a BUILD
    file with minimal loss of clarity.

  • pkg_filegroup is now an example of a "Grouping Rule", which allows for common
    groups of packaged files to be associated under a common name and prefix. These
    are intended to be inputs to packaging rules (pkg_rpm, pkg_tar, etc.).

Tests are included for all of the above.

@nacl nacl requested a review from aiuto February 16, 2021 19:46
@nacl
Copy link
Collaborator Author

nacl commented Feb 19, 2021

Latest change modifies the PackageFilegroupInfo provider to contain a list of (child_provider, provider_origin) tuples, which will aid diagnostics in packaging rules without being too disruptive to other parts of the ruleset.

This seemed to be a reasonable compromise between intrusiveness and clarity, but I'm willing to entertain other options, like embedding the origins directly in the mapping providers (e.g. PackageFilesInfo).

Andrew Psaltis added 3 commits February 24, 2021 18:47
This change provides the last two pieces of the basic package creation puzzle: a
symbolic link provisioning rule (`pkg_mklink`) and a simple package grouping
rule (`pkg_filegroup`).

As compared to the original rules in `pkg/experimental/pkg_filegroup.bzl`:

- `pkg_mklink` (formerly `pkg_mklinks`) now operates on a single
  source-destination pair.  This is to ease integration of a planned feature
  where you will be able to make symbolic links to targets named by a label.
  The mechanics of this particular feature are not fleshed out at this time, but
  the current feeling is that these will be resolved as a part of the
  `pkg_filegroup` rule.

  To create multiple links, you can use a list comprehension in a BUILD
  file with minimal loss of clarity.

- `pkg_filegroup` is now an example of a "Grouping Rule", which allows for common
  groups of packaged files to be associated under a common name and prefix.  These
  are intended to be inputs to packaging rules (`pkg_rpm`, `pkg_tar`, etc.).

Tests are included for all of the above.
This allows packaging rules to identify where there mapping inputs came from and
allows for improved diagnostics.
@nacl nacl force-pushed the topic/pkg_mklink_filegroup branch from a040ba5 to 36717b2 Compare February 25, 2021 01:34
pkg/mappings.bzl Show resolved Hide resolved
pkg/mappings.bzl Show resolved Hide resolved
pkg/tests/mappings/mappings_test.bzl Show resolved Hide resolved
pkg/tests/mappings/mappings_test.bzl Outdated Show resolved Hide resolved
@nacl
Copy link
Collaborator Author

nacl commented Mar 3, 2021

@aiuto Ping. Is there anything else you'd like to see done as a part of this PR?

Copy link
Collaborator

@aiuto aiuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like the origin should be in the info, rather than as a tuple, but I'm willing to face that choice after we try to use it for some more complex things. I'm not worried about backwards compatibility of these providers while we are pre 1.0, because only you and I should be using them.

pkg/tests/mappings/mappings_test.bzl Show resolved Hide resolved
@nacl nacl merged commit 8c22281 into bazelbuild:main Mar 8, 2021
@nacl nacl deleted the topic/pkg_mklink_filegroup branch November 19, 2021 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants