Add strip_components to extract/download_and_extract `http_arch…#29281
Add strip_components to extract/download_and_extract `http_arch…#29281willstranton wants to merge 1 commit intobazelbuild:masterfrom
strip_components to extract/download_and_extract `http_arch…#29281Conversation
…ive` The `strip_components` attribute functions similar to tar --strip-components: > Strip NUMBER leading components from file names on extraction. This is an alternative to the existing `strip_prefix` attribute, which required knowing the exact prefix to be stripped. Only one of the two attributes (`strip_prefix`, `strip_components`) can be set at one time. Fixes bazelbuild#28879 RELNOTES[NEW]: Adds the `strip_components` attribute to `extract`/`download_and_extract`/`http_archive` to allow stripping of path components when extracting files.
If the source archive URL is deterministic, the exact prefix should be known? |
Yes, that's true, but it's inconvenient to have to examine an archive to determine that exact prefix. This pull request is a "quality of life" improvement. As you point out, it's not a "must have". Summarizing from the community:
I remember having to update dependencies manually before BCR. You had to update the tar archive AND the prefix that was stripped.
|
Add
strip_componentstoextract/download_and_extracthttp_archiveDescription
The
strip_componentsattribute functions similar totar --strip-components:This is an alternative to the existing
strip_prefixattribute, which required knowing the exact prefix to be stripped. Only one of the two attributes (strip_prefix,strip_components) can be set at one time.Motivation
See #28879
Build API Changes
See #28879
Yes
N/A - this is not a breaking change.
Checklist
Release Notes
RELNOTES[NEW]: Adds the
strip_componentsattribute toextract/download_and_extract/http_archiveto allow stripping of path components when extracting files.