pkg_deb: Add installed_size attribute#1068
Open
dandersson wants to merge 2 commits into
Open
Conversation
`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.
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.
cgrindel
approved these changes
May 30, 2026
Collaborator
There was a problem hiding this comment.
@aiuto I presume this updated to 1.30 due to the pre-release?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1067
The
Installed-SizeDebian control field was already supported bymake_deb.py(the--installed_sizeflag is auto-generated fromDEBIAN_FIELDS), but there was no attribute on thepkg_debBazel rule to pass a value through.Changes
installed_sizeattr.stringtopkg_deb_impl(pkg/private/deb/deb.bzl), following the same pattern as other optional string control-field attributes (homepage,license,priority, etc.). For simplicity I opted to make it a string and not an integer, even though technically it always should be integer-valued, to be in line with other existing attributes.--installed_sizeto themake_debaction args when the attribute is set.This PR also includes a preparatory commit that fixes the stale version number in
docs/latest.md(still said1.2.0after the bump to1.3.0inc62b199).Testing
All
debtests pass.(I get a test failure for
//tests/tar:pkg_tar_test, but I get that on currentmain(22b54a3) as well, and I can't find a revision where this test passes for me at all.)Thoughts on auto-calculating size
One could imagine automatically calculating this value from the
dataparameter using the Pythontarfilemodule, but apart from being a more invasive change it could be backwards-incompatible for broken archives, and in particular would be a practical problem for zstd compression which doesn't get Python standard library support until Python 3.14.Implementing it as just another named argument seems safe. Calculating the size can be done at the call site instead.