Skip to content

Refactor ArchiveWriter to expose archiving each URL independently#693

Open
JaewonHur wants to merge 4 commits intoapple:mainfrom
JaewonHur:archive-urls-oss
Open

Refactor ArchiveWriter to expose archiving each URL independently#693
JaewonHur wants to merge 4 commits intoapple:mainfrom
JaewonHur:archive-urls-oss

Conversation

@JaewonHur
Copy link
Copy Markdown
Contributor

This PR refactors ArchiveWriter to add an API archiveURLs. This archiveURLs is used to archive the contents at each URL independently, similar to doing tar -cvf archive.tar foo.bin /bar/baz.txt.

This archiveURLs API is used to selectively archive the objects under
the given URLs.
let err = POSIXErrorCode(rawValue: errNo) ?? .EINVAL
throw ArchiveError.failedToCreateArchive("lstat failed for '\(fullPath)': \(POSIXError(err))")
}
public func archiveURLs(_ urls: [URL], base: URL) throws {
Copy link
Copy Markdown
Member

@dcantah dcantah Apr 21, 2026

Choose a reason for hiding this comment

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

I really do not want the path type (URL) to be in the name. Maybe archivePaths, or even just archive? We can rely on overloading to support an array of FilePaths in the future for either version.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

archive(_ paths: [FilePath], base: FilePath) gets my vote.

For container 1.0 we'll be banishing URL wherever possible.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm okay with going to FilePath here to start.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated to use archive(_ paths: [FilePath], base: FilePath).
It feels somewhat weird as archive(_ paths: [FilePath],...) needs full paths, while archive(_ relativePath: FilePath,...) needs a relative path, but leave for now.

I can surely update if you want!

@jglogan
Copy link
Copy Markdown
Contributor

jglogan commented Apr 21, 2026

@JaewonHur How much overlap is there with #652?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants