repo: normalize if stage-packages and check types (CRAFT-222)
Metadata
Current evaluation
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.
Suggested action: —
No scores available.
Issue body
Normalization takes place across the entire working tree for a part.
As a side effect, files that are not part of stage-packages are also
normalized, for that matter, stage-snaps, as those are unpacked first.
When considering the pc snap, Snapcraft creates a snap.pc to correctly
namespace the snaps snap directory. The .pc artifact fixes does not
filter on file type, fileinput is used for the fixup and internally
creates a .bak file as a backup which fails as snap.pc is a directory
and not a file.
Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for CRAFT-222 that prevents normalization from incorrectly processing directories like snap.pc. The change restricts normalization to stage-packages and adds file type checks to avoid backup creation failures on directories. Verified by maintainer. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for normalization failures with snap.pc directories. Updated logic to only normalize when stage-packages are present and added type checks to prevent invalid backup file creation during snap gadget staging. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #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. | |
| #76 packages: normalize unpacked stage packages (CRAFT-33) | craft-parts | merged | 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. | |
| #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. | |
| #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. | |
| #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. | |
| #252 repo: fix_pkg_config trims prefixes more generically | craft-parts | merged | Merged. Updates fix_pkg_config to generically strip prefixes, including the stage directory, when normalizing pkg-config files from staged snaps. Resolves LP #1916281 and CRAFT-1215. Approved and passed CI. |