-
Notifications
You must be signed in to change notification settings - Fork 179
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
for discussion: pkgfilgroup as a way of structuring package inputs #36
Labels
Comments
nacl
pushed a commit
to nacl/rules_pkg
that referenced
this issue
Dec 5, 2019
Currently, packages need to be assembled in each of their `pkg_*` rules, and each one has a different mechanism for doing so.This attempts to provide a unified interface, the `pkgfilegroup` rule, for accomplishing this task. Packaging rules can be written to take advantage of this in future changes. Analysis tests are also included. This is inspired by bazelbuild#36. This is currently incomplete. Features planned include: - File renaming - Non-file creation (e.g. directories, device nodes)
nacl
pushed a commit
to nacl/rules_pkg
that referenced
this issue
Dec 5, 2019
Currently, packages need to be assembled in each of their `pkg_*` rules, and each one has a different mechanism for doing so.This attempts to provide a unified interface, the `pkgfilegroup` rule, for accomplishing this task. Packaging rules can be written to take advantage of this in future changes. Analysis tests are also included. This is inspired by bazelbuild#36. This is currently incomplete. Features planned include: - File renaming - Non-file creation (e.g. directories, device nodes)
nacl
pushed a commit
to nacl/rules_pkg
that referenced
this issue
Dec 5, 2019
Currently, packages need to be assembled in each of their `pkg_*` rules, and each one has a different mechanism for doing so.This attempts to provide a unified interface, the `pkgfilegroup` rule, for accomplishing this task. Packaging rules can be written to take advantage of this in future changes. Analysis tests are also included. This is inspired by bazelbuild#36. This is currently incomplete. Features planned include: - File renaming - Non-file creation (e.g. directories, device nodes)
nacl
pushed a commit
to nacl/rules_pkg
that referenced
this issue
Dec 5, 2019
Currently, package contents need to be assembled in each of their `pkg_*` rules, and each one has a different mechanism for doing so. This provides a unified interface, the `pkgfilegroup` rule, for accomplishing this task. Packaging rules can be written to take advantage of this in future changes. Analysis tests are also included. This is inspired by bazelbuild#36. This is currently incomplete. Features in development include: - File renaming - Non-file creation (e.g. directories, device nodes)
nacl
pushed a commit
to nacl/rules_pkg
that referenced
this issue
Jan 14, 2020
This adds an experimental rule, `pkgfilegroup`, along with associated Providers, that gives rule developers and users a consistent mechanism for using the output of bazel targets in packaging rules. Inspired by bazelbuild#36. Other capabilities that are provided by this that were not mentioned in bazelbuild#36 are: - Creation of empty directories (`pkg_mkdirs`) - Exclusion of files from a `pkgfilegroup` (`excludes`) - Renames of files in a `pkgfilegroup` (`renames`)
nacl
pushed a commit
to nacl/rules_pkg
that referenced
this issue
Jan 14, 2020
This provides some analysis tests for various features of `pkgfilegroup` and `pkg_mkdirs`. See <PREVIOUS-PR-NUMBER>. You can run them by invoking `bazel test experimental/...` from the `pkg` directory This implementation of pkgfilegroup was inspired by bazelbuild#36.
nacl
pushed a commit
to nacl/rules_pkg
that referenced
this issue
Jan 14, 2020
This change provides a prototype `pkgfilegroup`-based RPM builder in the form of the `gen_rpm` rule. See <PFG-PR-NUMBER> for more details on `pkgfilegroup`. The RPM generator was derived from `make_rpm.py` in `pkg/` and supports a number of features over and above what's available in `pkg_rpm`. As written, it, given a template like the one provided, you can construct many full-fledged RPM packages entirely within Bazel. In most cases, the templates will only need to be customized with advanced logic and other macros that are not settable via bazel itself; `gen_rpm` will write much of the preamble, `%description` text, `%install` scriptlets and `%files` based on rule-provided inputs. Documentation outside of the source files is not yet available. This was empirically tested on RPM packages internal to VMware with positive results; actual tests of the rules not yet ready. This implementation of pkgfilegroup was inspired by bazelbuild#36. This, naturally, is incomplete, and is missing abilities such as: - Configurable compression - Configurable Provides/Requires - SRPM emission - Reproducibility - Configurable stripping - Configurable construction of "debug" packages Co-authored-by: mzeren-vmw Co-authored-by: klash
nacl
pushed a commit
to nacl/rules_pkg
that referenced
this issue
Jan 14, 2020
This provides some analysis tests for various features of `pkgfilegroup` and `pkg_mkdirs`. See bazelbuild#128. You can run them by invoking `bazel test experimental/...` from the `pkg` directory This implementation of pkgfilegroup was inspired by bazelbuild#36. This commit depends on bazelbuild#128.
nacl
pushed a commit
to nacl/rules_pkg
that referenced
this issue
Jan 14, 2020
This provides some analysis tests for various features of `pkgfilegroup` and `pkg_mkdirs`. See bazelbuild#128. You can run them by invoking `bazel test experimental/...` from the `pkg` directory This implementation of pkgfilegroup was inspired by bazelbuild#36.
aiuto
pushed a commit
that referenced
this issue
Feb 28, 2020
* Add pkgfilegroup for package-independent destination mappings This adds an experimental rule, `pkgfilegroup`, along with associated Providers, that gives rule developers and users a consistent mechanism for using the output of bazel targets in packaging rules. Inspired by #36. Other capabilities that are provided by this that were not mentioned in #36 are: - Creation of empty directories (`pkg_mkdirs`) - Exclusion of files from a `pkgfilegroup` (`excludes`) - Renames of files in a `pkgfilegroup` (`renames`) * Add analysis tests for pkgfilegroup and friends This provides some analysis tests for various features of `pkgfilegroup` and `pkg_mkdirs`. See #128. You can run them by invoking `bazel test experimental/...` from the `pkg` directory This implementation of pkgfilegroup was inspired by #36.
7 tasks
aiuto
added
feature-request
and removed
P1
An issue that must be resolved. Must have an assignee
labels
Oct 21, 2021
This is an ancient design discussion that was mostly implemented (in concept). Closing it to reduce bug clutter. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current packaging rules are not the most user friendly. This issue describes the key parts of what Google uses internally. I intend this to prompt discussion.
The basic idea is
So, it is a fairly heavy buy-in. You get more fine grained control over packaging, at the expense of doing things differently than you might have in the past. This is one of the motivators for not releasing Google's code originally. It is crufty in ways that other's might not like.
pkgfilegroup
pkgfilegroup(name, srcs, attr, prefix, section, strip_prefix)
srcs
List of labels; optional
A list of rules that are dependencies of this rule. All output of each of the rules mentioned in the srcs attribute will be included in the packages that depend on this pkgfilegroup.
attr
List of strings; optional
Permissions and ownership of the installed files. This list has 3 elements. The first element is what permissions the installed files should have, specified in octal. The second element is the username or UID that the files should be user-owned by. The third element is the username or GID that the files should be group-owned by. Each element may instead be "-" which specifies that package shouldn't care about that particular element and leave it at the default.
prefix
String; required
Where the package should install these files. All output of each of the rules mentioned in the srcs attribute to this rule will be installed on the end-users machine relative to this prefix.
section
String; optional
Type of file being installed. The string can be blank, doc, or config. Additionally, config can take two optional arguments: missingok and noreplace. These are all syntactically valid values for section:
doc
config
config(missingok)
config(noreplace)
config(missingok,noreplace)
genrpm passes the value of section through to the %files section of the RPM's .spec file. RPM handles documentation and configuration files slightly differently from normal files. For example, RPM will not just overwrite configuration files. It will make sure the older configuration file, if installed, is preserved. missingok means that an error is not reported if rpm --verify is run and the file is missing. noreplace means that, when the RPM is being upgraded, it should not move the existing file out of the way. Instead, it should create the new file with an .rpmnew extension file next to the existing file.
gendeb populates the conffiles control with the srcs of dependency pkgfilegroups with section set to config. gendeb ignores doc and the config optional arguments.
strip_prefix
String; optional; default is "."
Which part of the file name should be stripped. If it is ".", all subdirectories are stripped, leaving only the file name. If it starts with "/", it is interpreted relative to the root of the repository. Otherwise, it is resolved relative to the current package. This path is stripped from the beginning of the file path before appending the remaining part to prefix. For example, if prefix is "/etc", strip_prefix is "foo", and the file name relative to the package is "foo/bar/baz", the file will be installed as "/etc/bar/baz".If strip_prefix is an empty string, the full package-relative path is used.
An example
This would create a spec file containing
%attr(0755,root,root) /usr/bin/hello.sh
%attr(0755,root,root) /usr/bin/hello
And that gets include in hello.spec as
build_rpm_files
Obvious problems.
Good points
The text was updated successfully, but these errors were encountered: