packages: normalize unpacked stage packages (CRAFT-33)
Metadata
Current evaluation
Merged implementation normalizing unpacked stage packages. The change patches Python shebangs, converts absolute symlinks to relative, removes suid/guid bits, and updates config paths. Ported from Snapcraft and approved by reviewers.
Suggested action: —
No scores available.
Issue body
Packages unpacked in the stage area may contain files that need to be
patched to work correctly. Patches include replacing absolute pathnames
to the python interpreter in script shebangs, converting absolute
symlinks to relative, cleaning suid/guid bits, and changing path names
in pkg-config and xml2/xslt config files to reflect the new installation
root.
The implementation of package normalization and tests is ported from
Snapcraft, and will be replaced by an upcoming stand-alone package
containing repository and package operations.
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged implementation normalizing unpacked stage packages. The change patches Python shebangs, converts absolute symlinks to relative, removes suid/guid bits, and updates config paths. Ported from Snapcraft and approved by reviewers. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Normalizes unpacked stage packages by patching shebangs, converting absolute symlinks to relative, stripping SUID/SGID bits, and updating config paths. Ported from Snapcraft and integrated. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3529 repo: normalize if stage-packages and check types (CRAFT-222) | snapcraft | merged | Merged fix for CRAFT-222 preventing normalization failures on directories like snap.pc. The change restricts normalization to stage-packages and adds type checks to stop fileinput from creating backup files on directories. Approved and verified. | |
| #81 packages: add test to ensure unnecessary normalize not called (CRAFT-221) | craft-parts | merged | Merged a test ensuring file normalization is skipped when no files are unpacked during stage package processing. Approved by two reviewers, passed CI, and addresses CRAFT-221. Follows up on PR #76 to eliminate unnecessary processing overhead. | |
| #3534 repo: normalize only if there are packages to unpack | snapcraft | merged | Merged into master. Fixes a bug where pathlib.glob was incorrectly assumed to return a list instead of a generator. Ensures stage package normalization only runs when packages exist to unpack. Approved by two reviewers and passed CI. | |
| #3848 repo: fix_pkg_config removes prefixes from staged snap's .pc files. | snapcraft | merged | Merged a fix normalizing pkg-config prefixes in staged snaps by stripping prepended build directories. Squash-merged after review approval and full test coverage, resolving Launchpad #1916281 and CRAFT-1214. | |
| #251 repo: fix_pkg_config removes prefixes from staged snap's .pc files. | craft-parts | merged | Merged fix normalizing pkg-config files from staged snaps by stripping prepended build directories from the prefix parameter. Resolves Launchpad bug #1916281 and CRAFT-1215. Approved and merged. | |
| #49 packages: add snap package support | craft-parts | merged | Merged after implementing snap download and installation for stage and build snaps. Approved by two reviewers, passed CI, and added 1,072 lines across five files. Follows snapcraft conventions with future refactoring planned. |