Open bendavini opened 2 days ago
AIUI @bazel_tools//tools/zip:zipper
is not meant to be a general-purpose zip utility, just one that caters to the needs of build rules built into Bazel. What's the use case for this?
TL;DR we want to be able to extract (a subset of) files from a zip archive in a way that is consumable by other actions (mostly rules_pkg
).
I asked here what is the most proper way to hermetically unzip things; the answer was to use zipper .
The use case is described in the first link. We have a custom rule which is a wrapper around a non-hermetic unzip
command that provides an alternative to a genrule
that does not require the list of files to be extracted.
If @bazel_tools//tools/zip:zipper
is not meant to be a general purpose zip utility, do you know of something that is (and is also hermetic)?
https://registry.bazel.build/modules/ape has cross-platform binaries for common utilities, including unzip
.
Thanks @fmeum ! Learn about a new module every day :)
I am happy to use a new module, but would prefer to lean on a built-in if possible. If zipper
is meant to be exclusive to bazel internals, should I file another ticket to make it be 'advertised' as such? (i.e., something like a readme recommending the APE module for cases like this, reduced visibility of zipper
, output of said information in the help
, etc.
@lberki @meteorcloudy Do we have a stance on expanding the scope of @bazel_tools//tools/zip:zipper
and/or intentionally supporting its use outside of built-in rules?
@tjgq @bendavini @ahumesky I'd much, much rather no one use that built-in zipper tool. It was added in support of Android rules, which are in the process of being removed from the Bazel proper and thus ideally, this binary would also vanish from @bazel_tools
.
Description of the feature request:
unzip
(https://infozip.sourceforge.net/) allows users to specify files to exclude while unzipping a file:unzip file.zip -x $(<excl_file.txt)
In order to use
zipper x
in a similar way, a user needs to perform some additional shell magic to get the same result (we've a full (currently non-hermetic)unzip.bzl
that uses system unzip to achieve this.)Which category does this issue belong to?
CLI, Core
What underlying problem are you trying to solve with this feature?
Make
zipper
's extract (x
) functionally equivalent to the widely-usedunzip
utilityWhich operating system are you running Bazel on?
Mac(x86/aarch64) / Linux (x86)
What is the output of
bazel info release
?7.2.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No. Have scoured slack, github, email threads, and our internal tools
Any other information, logs, or outputs that you want to share?
No response