oci: preserve directories when adding layers
Metadata
Current evaluation
Merged. Resolves #44 by preserving directory permissions and ownership when adding OCI image layers. Replaces manual file walking with a single directory addition using proper arcname. Approved and passed CI checks.
Suggested action: —
No scores available.
Issue body
The previous code walked() on the source dir "manually" adding the
files, possibly to preserve a path relative to the source dir. This had
the side effect of not explicitly adding the sub directories, which
meant that their attributes (permission, ownership) were not preserved
in the final image (as they couldn't be!). So we simplify to add the
whole directory at once, with a proper `arcname` to preserve the
relative paths.
Fixes #44
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
-----
I plan to do two more pull requests "related" to this - splitting them to simplify review:
- One to add some kind of 'integrated' test to double-verify that the permissions are preserved;
- One small refactoring to use more `Path` and fewer `str`.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Resolves #44 by preserving directory permissions and ownership when adding OCI image layers. Replaces manual file walking with a single directory addition using proper arcname. Approved and passed CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged to resolve #44. Updated OCI layer addition to explicitly include directories with a proper arcname, preserving directory permissions and ownership that were previously lost during manual file traversal. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for OCI layer creation that preserves directory permissions and ownership. Replaces manual file walking with adding the entire directory at once using a proper arcname, resolving issue #44. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #204 oci: handle duplicate directories because of usrmerge | rockcraft | merged | Merged. Resolves CRAFT-1634 and issue #203 by handling usrmerge duplicate directories in OCI payloads. The fix verifies matching attributes before merging directories into a single layer entry and raises errors for conflicts. Approved, passed CI, and modified six files. |