Skip to content
  • Matthew Clarkson's avatar
    fix: switch to `//tar/tool` · 398aba37
    Matthew Clarkson authored
    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
        ],
    )
    ```
    398aba37