-
Notifications
You must be signed in to change notification settings - Fork 176
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 capability to rename archives based on configuration values #198
Conversation
I'd like to clarify the logic behind the new attributes - Important points:
Do you agree? |
On Sun, Jul 12, 2020 at 7:42 PM Konstantin Erman ***@***.***> wrote:
I'd like to clarify the logic behind the new attributes -
package_file_name and naming_info.
When neither of the two is specified the name of the rule is still used as
the name of the package - this is for backwards compatibility.
Now what if only package_file_name is specified? This means instead of
the name of the rule we need to take the string specified by
package_file_name as the base for the package name. In many cases it is
going to be sufficient and people don't need to mess with the new provider
at all.
Yes. package_file_name should be sufficient for many use cases. You only
need a rule to provide naming_info if you need dynamic naming based on
configuration. This was your use case, and probably more cases as people
build for more execution platforms.
When both package_file_name and naming_info are specified it means: 1.
name of the package should be taken from package_file_name and 2.
package_file_name and other string typed attributes of the rule should be
interpreted as the templates subject to expansion from the dictionary
provided by naming_info.
Yes. That is the idea.
Important points:
1. package_file_name can be specified without naming_info.
2. naming_info should affect not only package name, but also other
string attributes. package_dir is especially important.
Do you agree?
It should work wherever it is reasonable. For tar and zip files, it would
only be the file name. For RPM, deb, and yet unsupported formats, we may
need to be able to work that into the expansion of the control files. The
first implementations may only get a few of those but over time we can make
it uniform.
—
… You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#198 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXHHHEH4N6LGYFKXTNICE3R3JC7BANCNFSM4OV46B7Q>
.
|
Wait, wait, what about |
cc/ @nacl
My question is if package_dir is the right abstraction. Should we have the
packaging rules to the package redirection or should pkg_filegroup be the
place where that happens?
…On Sun, Jul 12, 2020 at 10:41 PM Konstantin Erman ***@***.***> wrote:
For tar and zip files, it would only be the file name.
Wait, wait, what about package_dir attribute? Without it being
dynamically configurable pkg_tar would still be unusable in our case.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#198 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXHHHHVCULX2YRLD3BNLS3R3JX5JANCNFSM4OV46B7Q>
.
|
Oh, this is deeper than I was thinking about it. When I discovered Now you are talking about matters like |
I want the fewest number of constructs that work similarly across all the rules. If we want to build a binary that goes in /usr/lib/foo, it would be better to say "prefix everything with /usr/lib/foo" in one place (or at least with one syntax) rather than in every use of that place. |
Unfortunately I don't quite understand your example. |
Sorry for the realllly long delays in responding to this. In the purest possible sense, Something like a The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the ideas behind this, but I think the templating framework could be used by pkg_filegroup
s too.
* Add attribute strip_prefix to pkg_zip * Add tests for pkg_zip strip_prefix behavior
Yes. I tend to forget the 'Info' when speaking about providers. It feels
redundant (and slightly wrong) unless adding "information" to the
description makes sense.
…On Fri, Aug 28, 2020 at 11:58 AM Andrew Psaltis ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pkg/providers.bzl
<#198 (comment)>:
> +PackageNamingInfo = provider(
+ doc = """Metadata about a package artifact.""",
+ fields = {
+ "values": "Dict of name/value pairs",
+ },
+)
Not a bad idea, although it wouldn't mesh all that well with the standard
that providers are named Info.
On further thought, would it make sense to use the builtin
TemplateVariableInfo
<https://docs.bazel.build/versions/master/skylark/lib/TemplateVariableInfo.html>
provider instead?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#198 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAXHHHBBPDVYZKVSCSJTJFTSC7HZHANCNFSM4OV46B7Q>
.
|
I have something now that I think I want to proceed with. It demonstrates 3 key new features:
This PR does not
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like where this is going.
I think this needs a little cleanup and clarification on some points before proceeding. Documentation and testing can come later if you'd like.
Thanks for the review. Back to you now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good.
This is to address #101 #193 and maybe help with #143
The goal is to allow all packaging rules to precisely name their output files in a way that is consistent with the naming conventions of the scheme, even if that requires pieces of the file name which can not be known until build time, such as cpu type.
The basic method is:
package_file_name
, rather than using a defaultPackageVarialbesInfo
provider which specifies a map of values to replacements (e.g. {cpu:x86_64, copt:debug})pkg_
rule target adds apackage_variables
attribute (which must provide PackageVariablesInfo), the provided dictionary will be used for substitutions inpackage_file_name
pkg_
rules will also return aPackageArtifactInfo
provider which will map target label to the file name actually generated. This is need in some situations when associated rules must know the exact name of the final package.If a target does not use
package_file_name
then theout
attribute is created as before (package + "." + extension).If it does, then
out
will be a symlink to the name specified bypackage_name
.This PR only deals with pkg_tar. The other package types, and substitution into the spec files will come in followup changes.