repo: fix_pkg_config trims prefixes more generically
Metadata
Current evaluation
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.
Suggested action: —
No scores available.
Issue body
- [X] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
-----
Follow up to https://github.com/canonical/craft-parts/pull/251 thanks to an idea from @cmatsuoka.
When normalizing pkg-config (.pc) files from staged snaps, the previously prepended `<path-to-project-path>/stage` will be removed from the `prefix` parameter.
This means all directories prior to and including `stage/` are trimmed.
For example, `/root/stage/usr` is trimmed to `/usr`.
LP: #[1916281](https://bugs.launchpad.net/snapcraft/+bug/1916281)
(CRAFT-1215)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix updating fix_pkg_config to generically strip stage path prefixes from pkg-config files in staged snaps. Resolves LP #1916281 and CRAFT-1215 as a follow-up to PR #251. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #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. | |
| #255 Revert "repo: fix_pkg_config trims prefixes more generically" | craft-parts | merged | Merged a revert of commit f6681f0 that altered craft-part behavior when stage was in the working directory. Approved, passed CI, and restored the original fix_pkg_config prefix trimming logic. | |
| #2119 repo: automatically prune unneeded stage-packages | snapcraft | merged | Merged a fix that automatically prunes unneeded stage-packages from snaps by crawling the apt cache to remove orphaned dependencies from alternative resolution and conflict handling. Approved and passed CI. | |
| #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. |