rpm: Add conflicts and obsoletes to sub RPMs (#851)

This change brings the sub RPM rules closer to parity with both
reality and the parent RPM rules by adding the `Conflicts` and
`Obsoletes` fields to them.
This commit is contained in:
Mike Kelly 2024-04-15 19:21:27 -07:00 committed by GitHub
parent 59e682ddf1
commit 0b5d943a50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 0 deletions

View File

@ -51,6 +51,8 @@ PackageSubRPMInfo = provider(
"version": "RPM `Version` tag for this subpackage",
"requires": "List of RPM capability expressions that this package requires",
"provides": "List of RPM capability expressions that this package provides",
"conflicts": "List of RPM capability expressions that conflict with this package",
"obsoletes": "List of RPM capability expressions that this package obsoletes",
"srcs": "Mapping groups to include in this RPM",
},
)
@ -326,6 +328,12 @@ def _process_subrpm(ctx, rpm_name, rpm_info, rpm_ctx):
for p in rpm_info.provides:
rpm_lines += ["Provides: %s" % p]
for c in rpm_info.conflicts:
rpm_lines += ["Conflicts: %s" % c]
for o in rpm_info.obsoletes:
rpm_lines += ["Obsoletes: %s" % o]
rpm_lines += [
"",
"%%description %s" % rpm_info.package_name,
@ -1205,6 +1213,8 @@ def _pkg_sub_rpm_impl(ctx):
version = ctx.attr.version,
requires = ctx.attr.requires,
provides = ctx.attr.provides,
conflicts = ctx.attr.conflicts,
obsoletes = ctx.attr.obsoletes,
srcs = ctx.attr.srcs,
),
DefaultInfo(
@ -1239,6 +1249,8 @@ pkg_sub_rpm = rule(
"version": attr.string(doc = "RPM `Version` tag for this subrpm"),
"requires": attr.string_list(doc = "List of RPM capability expressions that this package requires"),
"provides": attr.string_list(doc = "List of RPM capability expressions that this package provides"),
"conflicts": attr.string_list(doc = "List of RPM capability expressions that conflict with this package"),
"obsoletes": attr.string_list(doc = "List of RPM capability expressions that this package obsoletes"),
"srcs": attr.label_list(
doc = "Mapping groups to include in this RPM",
mandatory = True,