From f54ad2ffa038f658bccf46f43c5d26545e55ace9 Mon Sep 17 00:00:00 2001 From: Daniel Andersson Date: Wed, 27 May 2026 12:02:53 +0200 Subject: [PATCH 1/2] docs: Update reference docs version to 1.3.0 `docs/latest.md` seems to have not been regenerated when the version was bumped to 1.3.0 in `c62b199`. Regenerate to reflect the correct version number. --- docs/latest.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/latest.md b/docs/latest.md index ba68f1e5..0f0a2551 100755 --- a/docs/latest.md +++ b/docs/latest.md @@ -1,4 +1,4 @@ -# rules_pkg - 1.2.0 +# rules_pkg - 1.3.0

Common Attributes

From 540575e657805d2457e25836d30fede1ad500084 Mon Sep 17 00:00:00 2001 From: Daniel Andersson Date: Wed, 27 May 2026 12:03:00 +0200 Subject: [PATCH 2/2] pkg_deb: Add `installed_size` attribute The `Installed-Size` control field was supported by `make_deb.py` (via the auto-generated --`installed_size` flag), but there was no corresponding attribute on the `pkg_deb` Bazel rule to pass a value through. Add an `installed_size` `attr.string` to `pkg_deb_impl` and emit `--installed_size` to the `make_deb` action args. --- docs/latest.md | 10 ++++++---- pkg/private/deb/deb.bzl | 7 +++++++ tests/deb/BUILD | 1 + tests/deb/pkg_deb_test.py | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/latest.md b/docs/latest.md index 0f0a2551..d6f5dbb5 100755 --- a/docs/latest.md +++ b/docs/latest.md @@ -94,10 +94,11 @@ load("@rules_pkg//pkg/private/deb:deb.bzl", "pkg_deb") pkg_deb(name, data, out, architecture, architecture_file, breaks, built_using, built_using_file, changelog, conffiles, conffiles_file, config, conflicts, depends, - depends_file, description, description_file, distribution, enhances, homepage, license, - maintainer, md5sums, package, package_file_name, package_variables, postinst, postrm, - predepends, preinst, prerm, priority, provides, provides_file, recommends, replaces, - replaces_file, section, suggests, templates, triggers, urgency, version, version_file) + depends_file, description, description_file, distribution, enhances, homepage, + installed_size, license, maintainer, md5sums, package, package_file_name, + package_variables, postinst, postrm, predepends, preinst, prerm, priority, provides, + provides_file, recommends, replaces, replaces_file, section, suggests, templates, + triggers, urgency, version, version_file) Create a Debian package. @@ -136,6 +137,7 @@ include both. If you need downstream rule to specifically depend on only the .de | distribution | "distribution: See http://www.debian.org/doc/debian-policy. | String | optional | `"unstable"` | | enhances | See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps. | List of strings | optional | `[]` | | homepage | The homepage of the project. | String | optional | `""` | +| installed_size | The approximate total size (in KiB) of the package's installed files. Corresponds to the Installed-Size field in the control file. See https://www.debian.org/doc/debian-policy/ch-controlfields.html#installed-size. | String | optional | `""` | | license | The license of the project. | String | optional | `""` | | maintainer | The maintainer of the package. | String | required | | | md5sums | A file listing md5 checksums of files in the data archive. This file is optional. See https://manpages.debian.org/bookworm/dpkg-dev/deb-md5sums.5.en.html. | Label | optional | `None` | diff --git a/pkg/private/deb/deb.bzl b/pkg/private/deb/deb.bzl index 5b948938..169b007a 100644 --- a/pkg/private/deb/deb.bzl +++ b/pkg/private/deb/deb.bzl @@ -137,6 +137,8 @@ def _pkg_deb_impl(ctx): for d in ctx.attr.depends: args.add("--depends", substitute_package_variables(ctx, d)) + if ctx.attr.installed_size: + args.add("--installed_size", substitute_package_variables(ctx, ctx.attr.installed_size)) if ctx.attr.priority: args.add("--priority", substitute_package_variables(ctx, ctx.attr.priority)) if ctx.attr.section: @@ -341,6 +343,11 @@ See https://www.debian.org/doc/debian-policy/ch-files.html#s-config-files.""", See http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections.""", ), "homepage": attr.string(doc = """The homepage of the project."""), + "installed_size": attr.string( + doc = """The approximate total size (in KiB) of the package's installed files. + Corresponds to the Installed-Size field in the control file. + See https://www.debian.org/doc/debian-policy/ch-controlfields.html#installed-size.""", + ), "license": attr.string(doc = """The license of the project."""), "breaks": attr.string_list( doc = """See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps.""", diff --git a/tests/deb/BUILD b/tests/deb/BUILD index e8146b97..f7e947f4 100644 --- a/tests/deb/BUILD +++ b/tests/deb/BUILD @@ -87,6 +87,7 @@ pkg_deb( ], description = "toto ®, Й, ק ,م, ๗, あ, 叶, 葉, 말, ü and é\n more", distribution = "trusty", + installed_size = "1234", license = "Apache-2.0", maintainer = "soméone@somewhere.com", md5sums = ":generate_md5sums", diff --git a/tests/deb/pkg_deb_test.py b/tests/deb/pkg_deb_test.py index 50a0447f..8c89d5d6 100644 --- a/tests/deb/pkg_deb_test.py +++ b/tests/deb/pkg_deb_test.py @@ -159,6 +159,7 @@ def test_description(self): 'Breaks: oldbrokenpkg', 'Provides: hello', 'License: Apache-2.0', + 'Installed-Size: 1234', ] # TODO(https://github.com/bazelbuild/rules_pkg/issues/214): This can not # pass on Windows Until we rewrite how description is passed