diff --git a/pkg/private/deb/deb.bzl b/pkg/private/deb/deb.bzl index d385ed5e..29c7acc1 100644 --- a/pkg/private/deb/deb.bzl +++ b/pkg/private/deb/deb.bzl @@ -160,10 +160,23 @@ def _pkg_deb_impl(ctx): args.add("--pre_depends", d) for d in ctx.attr.recommends: args.add("--recommends", d) - for d in ctx.attr.replaces: - args.add("--replaces", d) - for d in ctx.attr.provides: - args.add("--provides", d) + if ctx.attr.replaces_file: + if ctx.attr.replaces: + fail("Both replaces and replaces_file attributes were specified") + args.add("--replaces", "@" + ctx.file.replaces_file.path) + files.append(ctx.file.replaces_file) + elif ctx.attr.replaces: + for d in ctx.attr.replaces: + args.add("--replaces", d) + + if ctx.attr.provides_file: + if ctx.attr.provides: + fail("Both provides and provides_file attributes were specified") + args.add("--provides", "@" + ctx.file.provides_file.path) + files.append(ctx.file.provides_file) + elif ctx.attr.provides: + for d in ctx.attr.provides: + args.add("--provides", d) args.set_param_file_format("flag_per_line") args.use_param_file("@%s", use_always = True) @@ -351,9 +364,14 @@ See https://www.debian.org/doc/debian-policy/ch-files.html#s-config-files.""", default = [], ), "provides": attr.string_list( - doc = """See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps.""", + doc = """See https://www.debian.org/doc/debian-policy/ch-relationships.html#virtual-packages-provides.""", default = [], ), + "provides_file": attr.label( + doc = """File that contains a list of provided packages. Must not be used with `provides`. + See https://www.debian.org/doc/debian-policy/ch-relationships.html#virtual-packages-provides.""", + allow_single_file = True, + ), "predepends": attr.string_list( doc = """See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps.""", default = [], @@ -363,9 +381,14 @@ See https://www.debian.org/doc/debian-policy/ch-files.html#s-config-files.""", default = [], ), "replaces": attr.string_list( - doc = """See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps.""", + doc = """See https://www.debian.org/doc/debian-policy/ch-relationships.html#overwriting-files-and-replacing-packages-replaces.""", default = [], ), + "replaces_file": attr.label( + doc = """File that contains a list of replaced packages. Must not be used with `replaces`. + See https://www.debian.org/doc/debian-policy/ch-relationships.html#overwriting-files-and-replacing-packages-replaces.""", + allow_single_file = True, + ), "suggests": attr.string_list( doc = """See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps.""", default = [], diff --git a/pkg/private/deb/make_deb.py b/pkg/private/deb/make_deb.py index d1557ba9..ee9bdc38 100644 --- a/pkg/private/deb/make_deb.py +++ b/pkg/private/deb/make_deb.py @@ -408,8 +408,8 @@ def main(): enhances=options.enhances, preDepends=options.pre_depends, recommends=options.recommends, - replaces=options.replaces, - provides=options.provides, + replaces=GetFlagValues(options.replaces), + provides=GetFlagValues(options.provides), homepage=helpers.GetFlagValue(options.homepage), license=helpers.GetFlagValue(options.license), builtUsing=helpers.GetFlagValue(options.built_using),