Skip to content
Verified Commit 398aba37 authored by Matthew Clarkson's avatar Matthew Clarkson
Browse files

fix: switch to `//tar/tool`

Changes both `tar_filter`/`tar_concatenate` to use `//tar/tool` rather
than individidual toolchains.

This change brings significant features:

  - Inputs are transparently decompressed using file magic markers
    - Data on `stdin` is decompressed correctly now
  - Outputs are trasparently compressed using the file extension
  - (De)compression is all performed in-process removing the need for Shell pipes
  - Many bug fixes are squashed during the refactor in the Go code

A huge footgun has been removed where the extension were not respected:

```py
# Without the `compress` attribute, this creates a `archive.tar.gz` that
# is actually a tape archive that is _not_ compressed
tar_concatenate(
    name = "archive.tar.gz",
    # compress = "@rules_tar//tar/compress:gzip",
    srcs = ["archive.tar.xz", "something.tar.gz"],
)
# With this patch it is now correctly compressed with `gzip`
```

BREAKING CHANGE: `tar_filter#patterns` is now a list of globs to remove
from the tape archive. The filters can still be negated:

```py
tar_filter(
    name = "filter.tar.xz",
    src = "archive.tar.zst",
    patterns = [
        "!**/*.md",  # Keep Markdown files
        "**/*",      # Remove all other members
    ],
)
```
parent c1c64b3d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment