From fd8b3f828d24b0dffbfa752312fa34a6ca23a326 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Tue, 8 Oct 2024 15:27:52 -0400 Subject: [PATCH 1/3] whl_library: avoid excessive report_progress() messages should close https://github.com/bazelbuild/rules_python/issues/2206 with current behavior, we see really long progress messages in the console like ``` Running whl_library.ResolveRequirement(foobar_pip_deps_regex, regex==2023.12.25 --hash=sha256:0694219a1d54336fd0445ea3\ 82d49d36882415c0134ee1e8332afd1529f0baa5 --hash=sha256:086dd15e9435b393ae06f96ab69ab2d333f5d65cbe65ca5a3ef0ec9564dfe770 --hash=sha256:094ba3\ 86bb5c01e54e14434d4caabf6583334090865b23ef58e0424a6286d3dc --hash=sha256:09da66917262d9481c719599116c7dc0c321ffcec4b1f510c4f8a066f8768105 --\ hash=sha256:0ecf44ddf9171cd7566ef1768047f6e66975788258b1c6c6ca78098b95cf9a3d --hash=sha256:0fda75704357805eb953a3ee15a2b240694a9a514548cd49b3c51\ 24b4e2ad01b --hash=sha256:11a963f8e25ab5c61348d090bf1b07f1953929c13bd2309a0662e9ff680763c9 --hash=sha256:150c39f5b964e4d7dba46a7962a088fbc91\ f06e606f023ce57bb347a3b2d4630 --hash=sha256:1b9d811f72210fa9306aeb88385b8f8bcef0dfbf3873410413c00aa94c56c2b6 --hash=sha256:1e0eabac536b4cc7f\ 57a5f3d095bfa557860ab912f25965e08fe1545e2ed8b4c --hash=sha256:22a86d9fff2009302c440b9d799ef2fe322416d2d58fc124b926aa89365ec482 --hash=sha256\ :22f3470f7524b6da61e2020672df2f3063676aff444db1daa283c2ea4ed259d6 --hash=sha256:263ef5cc10979837f243950637fffb06e8daed7f1ac1e39d5910fd29929e489a\ --hash=sha256:283fc8eed679758de38fe493b7d7d84a198b558942b03f017b1f94dda8efae80 --hash=sha256:29171aa128da69afdf4bde412d5bedc335f2ca8fcfe448\ ... ``` --- python/private/pypi/whl_library.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/private/pypi/whl_library.bzl b/python/private/pypi/whl_library.bzl index 309316b2ee..60e46b3480 100644 --- a/python/private/pypi/whl_library.bzl +++ b/python/private/pypi/whl_library.bzl @@ -244,7 +244,10 @@ def _whl_library_impl(rctx): repo_utils.execute_checked( rctx, - op = op_tmpl.format(name = rctx.attr.name, requirement = rctx.attr.requirement), + # truncate the requirement value when logging it / reporting + # progress since it may contain several ' --hash=sha256:... + # --hash=sha256:...' substrings that fill up the console + op = op_tmpl.format(name = rctx.attr.name, requirement = rctx.attr.requirement.split(" ", 1)[0]), arguments = args, environment = environment, quiet = rctx.attr.quiet, From aabd8cac2cbcdb29f4f7fab8a1f66af413ab5f9f Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Tue, 8 Oct 2024 15:31:46 -0400 Subject: [PATCH 2/3] update CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c850d186ac..c966ebe5a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,8 @@ A brief description of the categories of changes: * (whl_filegroup): Provide per default also the `RECORD` file * (py_wheel): `RECORD` file entry elements are now quoted if necessary when a wheel is created +* (whl_library) truncate progress messages from the repo rule to better handle + case where a requirement has many `--hash=sha256:...` flags ### Added * (py_wheel) Now supports `compress = (True|False)` to allow disabling From 190fe832d0dd62229ca0d9eee332952956e1e57f Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Tue, 8 Oct 2024 16:01:31 -0400 Subject: [PATCH 3/3] examples/bzlmod: update lockfile --- examples/bzlmod/MODULE.bazel.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/bzlmod/MODULE.bazel.lock b/examples/bzlmod/MODULE.bazel.lock index 11e63af6e9..2ddbe40bc3 100644 --- a/examples/bzlmod/MODULE.bazel.lock +++ b/examples/bzlmod/MODULE.bazel.lock @@ -1231,7 +1231,7 @@ }, "@@rules_python~//python/extensions:pip.bzl%pip": { "general": { - "bzlTransitiveDigest": "SY5Kzq6Z7CG9q0dbCVrOHK8FFnVC6YTXBqGE4ZfNNbo=", + "bzlTransitiveDigest": "kPvx0u6SR68H+8BqqEfxd3NpVZjuMOyzI9Xml01rdrQ=", "usagesDigest": "MChlcSw99EuW3K7OOoMcXQIdcJnEh6YmfyjJm+9mxIg=", "recordedFileInputs": { "@@other_module~//requirements_lock_3_11.txt": "a7d0061366569043d5efcf80e34a32c732679367cb3c831c4cdc606adc36d314", @@ -6138,7 +6138,7 @@ }, "@@rules_python~//python/private/pypi:pip.bzl%pip_internal": { "general": { - "bzlTransitiveDigest": "BLXk2JiegzzGfis5XuIaAVMg5WUUhmsofn99NgeBDEQ=", + "bzlTransitiveDigest": "c3OA6iewVGq8nz0o3iI2AtIQhsRZIg/E/PDq2vuAQTw=", "usagesDigest": "Y8ihY+R57BAFhalrVLVdJFrpwlbsiKz9JPJ99ljF7HA=", "recordedFileInputs": { "@@rules_python~//tools/publish/requirements.txt": "031e35d03dde03ae6305fe4b3d1f58ad7bdad857379752deede0f93649991b8a",