-
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
Support for cross-platform RPM package generation #729
base: 0.9.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,7 +142,7 @@ def _make_absolute_if_not_already_or_is_macro(path): | |
# this can be inlined easily. | ||
return path if path.startswith(("/", "%")) else "/" + path | ||
|
||
#### Input processing helper functons. | ||
#### Input processing helper functions. | ||
|
||
# TODO(nacl, #459): These are redundant with functions and structures in | ||
# pkg/private/pkg_files.bzl. We should really use the infrastructure provided | ||
|
@@ -251,7 +251,7 @@ def _pkg_rpm_impl(ctx): | |
rpm_name, | ||
ctx.attr.version, | ||
ctx.attr.release, | ||
ctx.attr.architecture, | ||
ctx.attr.architecture if ctx.attr.architecture else ctx.attr.target_architecture, | ||
) | ||
|
||
outputs, output_file, output_name = setup_output_files( | ||
|
@@ -432,6 +432,9 @@ def _pkg_rpm_impl(ctx): | |
|
||
args.append("--out_file=" + output_file.path) | ||
|
||
if ctx.attr.target_architecture: | ||
args.append("--target_arch=" + ctx.attr.target_architecture) | ||
|
||
# Add data files. | ||
if ctx.file.changelog: | ||
files.append(ctx.file.changelog) | ||
|
@@ -666,7 +669,7 @@ def _pkg_rpm_impl(ctx): | |
output_groups = { | ||
"out": [default_file], | ||
"rpm": [output_file], | ||
"changes": changes | ||
"changes": changes, | ||
} | ||
return [ | ||
OutputGroupInfo(**output_groups), | ||
|
@@ -791,21 +794,30 @@ pkg_rpm = rule( | |
# funny if it's not provided. The contents of the RPM are believed to | ||
# be set as expected, though. | ||
"architecture": attr.string( | ||
doc = """Package architecture. | ||
doc = """Host architecture. | ||
|
||
This currently sets the `BuildArch` tag, which influences the output | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's drop "currently" in these |
||
architecture of the package. | ||
|
||
Typically, `BuildArch` only needs to be set when the package is | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might as well make the exact behavior and use clear and tie it back to Bazel definitions when the terms overlap. The points to make are
Note that when cross compiling the target and execution platforms may not match. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aiuto @ogalbxela when cross-compiling, target/exec may differ, but the logical default value would be the target. When not cross-compiling, the target and exec match, so the logical default value would be the target. Is there interest in setting the default to the target rather than exec platform? Or a risk of breaking change in the default ? |
||
known to be cross-platform (e.g. written in an interpreted | ||
language), or, less common, when it is known that the application is | ||
only valid for specific architectures. | ||
not architecture dependent (e.g. written in an interpreted | ||
language). | ||
|
||
When no attribute is provided, this will default to your host's | ||
architecture. This is usually what you want. | ||
|
||
""", | ||
), | ||
"target_architecture": attr.string( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need both? I have not figured out the value of setting both, since only one gets used. |
||
doc = """Package architecture. | ||
|
||
This currently sets the value for the "--target" argument to "rpmbuild" | ||
to specify platform package is built for. | ||
|
||
When no attribute is provided, this will default to your host's | ||
architecture. | ||
""", | ||
), | ||
"license": attr.string( | ||
doc = """RPM "License" tag. | ||
|
||
|
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.
Doesn't this comment apply to targert_arch?