summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kelly <kellyma@gmail.com>2023-12-21 19:53:01 -0800
committerGitHub <noreply@github.com>2023-12-21 22:53:01 -0500
commit276b9f3d614a3ba3ac6ee09090ef28144015b2c3 (patch)
tree2f110441f58586d6de6e207cba07b973a13ca4d1
parenteaa1b450391e370001b403f0d43fa173d67debb3 (diff)
downloadbazelbuild-rules_pkg-276b9f3d614a3ba3ac6ee09090ef28144015b2c3.tar.gz
Allow additional RPM macro defines (#794)
For some RPM packaging scenarios users may wish to define additional macros. This change enables us to do this using the `--rpmbuild_arg` argument to the `make_rpm.py` script by passing a dict of defines to the `pkg_rpm()` rule.
-rw-r--r--pkg/rpm_pfg.bzl9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/rpm_pfg.bzl b/pkg/rpm_pfg.bzl
index 756482b..52fc872 100644
--- a/pkg/rpm_pfg.bzl
+++ b/pkg/rpm_pfg.bzl
@@ -642,6 +642,12 @@ def _pkg_rpm_impl(ctx):
"_binary_payload {}".format(ctx.attr.binary_payload_compression),
])
+ for key, value in ctx.attr.defines.items():
+ additional_rpmbuild_args.extend([
+ "--define",
+ "{} {}".format(key, value),
+ ])
+
args.extend(["--rpmbuild_arg=" + a for a in additional_rpmbuild_args])
for f in ctx.files.srcs:
@@ -1015,6 +1021,9 @@ pkg_rpm = rule(
overcommitting your system.
""",
),
+ "defines": attr.string_dict(
+ doc = """Additional definitions to pass to rpmbuild""",
+ ),
"rpmbuild_path": attr.string(
doc = """Path to a `rpmbuild` binary. Deprecated in favor of the rpmbuild toolchain""",
),