Skip to content

ArchiveWriter: support explicit entries and rewrite internal symlinks#652

Open
mazdak wants to merge 2 commits intoapple:mainfrom
mazdak:mazdak/archive-writer-symlink
Open

ArchiveWriter: support explicit entries and rewrite internal symlinks#652
mazdak wants to merge 2 commits intoapple:mainfrom
mazdak:mazdak/archive-writer-symlink

Conversation

@mazdak
Copy link
Copy Markdown

@mazdak mazdak commented Apr 5, 2026

Context and Motivation

While building out a Docker Compose-style plugin and validating it against our own real development stack, we ran into two classes of problems in the build-context path, and to fix them we had to make changes to the container app, but part of the changes were archive-authoring concerns and belong in ContainerizationArchive, not in higher-level callers. The result is a reusable API for explicit archive creation and more portable archives when symlinks point to other archived content.

(Related container PR: apple/container#1391)

This PR adds a generic explicit-entry archive API to ContainerizationArchive and improves symlink handling so archives remain relocatable after extraction.

In addition to archiveDirectory(_:), callers can now provide an ordered list of source entries to archive. This makes it possible to archive a precomputed file set without rewalking the source tree and centralizes symlink handling in the archive layer itself.

Testing

  • add regression coverage for explicit-entry archive creation
  • add round-trip tests for:
    • internal absolute symlinks rewritten to archive-relative paths
    • external absolute symlinks preserved unchanged
    • canonicalized internal absolute symlinks through symlinked ancestors
  • verify existing archive-directory symlink behavior still passes

Passed:

  • swift test --filter archiveEntries
  • swift test --filter archiveDirectoryRewritesInternalAbsoluteSymlink
  • swift test --filter archiveDirectorySymlinkInside
  • swift test --filter archiveDirectorySymlinkOutsideExcluded

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.

1 participant