Skip to content

http_archive (also repository_ctx.extract) strip_components #28879

@pauldraper

Description

@pauldraper

Description of the feature request:

http_archive repositiory rule has strip_components integer attribute that removes the number of path components when extracting the archive.

Also, the repository_ctx.extract and repository.download_and_extract.

The naming is similar to tar --strip-components=NUMBER.

Which category does this issue belong to?

Rules API

What underlying problem are you trying to solve with this feature?

Archives often have a containing directories.

  • Sometimes, this is long or not easily memorable -- a version number, or a commit hash
  • Sometimes, this is not readily known. E.g. npm packages usually use a package/ prefix, but not always.

Usually, users don't actually care what the leading component is, they just want to remove it.

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development 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 ?


Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions