Skip to content

add support to TarArchiver for more common compression suffixes #8369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Sources/Basics/Archiver/TarArchiver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ import struct TSCBasic.FileSystemError

/// An `Archiver` that handles Tar archives using the command-line `tar` tool.
public struct TarArchiver: Archiver {
public let supportedExtensions: Set<String> = ["tar", "tar.gz"]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't clear to me whether "tar.gz" is really needed or if "gz" is good enough here? The tar commands don't seem to care:

 tar tzf test.gz | head
6.0.3-RELEASE_rhel_ubi9_x86_64.artifactbundle/
6.0.3-RELEASE_rhel_ubi9_x86_64.artifactbundle/6.0.3-RELEASE_rhel_ubi9_x86_64/
6.0.3-RELEASE_rhel_ubi9_x86_64.artifactbundle/info.json
6.0.3-RELEASE_rhel_ubi9_x86_64.artifactbundle/6.0.3-RELEASE_rhel_ubi9_x86_64/x86_64-unknown-linux-gnu/


public let supportedExtensions: Set<String> = [
"tar",
"gz", "tgz", // gzip
"bz2", "tz2", "tbz2", "tbz", // bzip2
"lzma", // lzma
"xz" // xz
]

/// The file-system implementation used for various file-system operations and checks.
private let fileSystem: FileSystem
Expand Down