feat: add tarball overlays for source archive modification#224
feat: add tarball overlays for source archive modification#224Tonisal-byte wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for “tarball overlays” that modify files inside source tarballs (extract/modify/repack) and updates sources preparation to account for in-place tarball changes.
Changes:
- Introduces a
tarballutility package for compression detection, extraction, and deterministic repacking. - Adds new overlay types (
tarball-file-remove,tarball-search-replace,tarball-patch) plus grouping/application logic in source prep. - Updates
sourcesfile update flow to rehash tarballs modified by overlays and extends docs/tests accordingly.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/utils/tarball/tarball.go | Implements compression detection, extraction, and deterministic repacking. |
| internal/utils/tarball/tarball_test.go | Adds tests for compression detection, extract-root resolution, and deterministic repack. |
| internal/projectconfig/overlay.go | Adds tarball overlay types, validation, and ModifiesTarball(). |
| internal/projectconfig/overlay_test.go | Extends validation/modification classification tests for tarball overlays. |
| internal/app/azldev/core/sources/tarballoverlays.go | Implements tarball overlay grouping, extract/modify/repack pipeline, and patch application. |
| internal/app/azldev/core/sources/tarballoverlays_internal_test.go | Adds unit tests for grouping and tarball overlay operations. |
| internal/app/azldev/core/sources/sourceprep.go | Applies tarball overlays first and rehashes modified tarballs when updating sources. |
| internal/app/azldev/core/sources/sourceprep_test.go | Updates expected error text for sources parsing failures. |
| internal/app/azldev/cmds/component/preparesources.go | Refactors option wiring into helper to reduce cyclomatic complexity. |
| docs/user/reference/config/overlays.md | Documents new tarball overlays and related fields/behavior. |
|
|
||
| // globFilesInDir finds files under root matching a glob pattern. | ||
| // Supports doublestar patterns (e.g., "**/*.md"). | ||
| func globFilesInDir(root, pattern string) ([]string, error) { |
There was a problem hiding this comment.
Do we not already have helpers to do this?
a495c4d to
3eb0c57
Compare
3eb0c57 to
ad0e582
Compare
Add three new overlay types (tarball-file-remove, tarball-search-replace, tarball-patch) that modify files inside source tarballs during source preparation. Operations are performed in pure Go on the host. Includes: - internal/utils/tarball: reusable deterministic tar extract/repack library - Overlay type registration, validation, and fingerprinting - Source prep integration with sources file hash rehashing - User documentation and TOML examples
ad0e582 to
3a1883c
Compare
|
|
||
| ### Archive Overlays | ||
|
|
||
| A `file-remove` or `file-search-replace` overlay can modify files **inside** a source archive |
There was a problem hiding this comment.
Does this support removing/editing files in nested archives? I'm thinking about cases where a.tar.gz contains a/internal/archive.tar.gz and you want to remove a.tar.gz/a/internal/archive.tar.gz/nested/dir/file-to-remove.txt.
If it doesn't, I don't think it's a P0 (I believe all 10 scripts can be replaced without the nested archives supported), but with the new archive field required for differentiating between "regular" files and archives, adding this extension in the future may be tricky.
Considering that, do you think it would be possible to use the file path alone to denote the file to be removed/edited and automatically detect, if a file on the path is a directory vs an archive as in the a.tar.gz/a/internal/archive.tar.gz/nested/dir/file-to-remove.txt example? Starting with this would give us support for nested archives in one go.
PS Cool idea with re-using existing overlays.
There was a problem hiding this comment.
Thanks! The idea was originally Reubens but I'm glad the implementation is sound. I think it would be better if we revisited this nested archive format in the future. I do agree it's important, but it might introduce complexity to the overlay application process
0d6a73d to
073e58f
Compare
073e58f to
96d9a9c
Compare
0a60b3e to
2a8345b
Compare
Adds tarball overlay support for modifying source archives by applying file overlays during repack.
This is part 2 of 2 in the tarball overlay feature stack.