repo: normalize only if there are packages to unpack
Metadata
Current evaluation
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.
Suggested action: —
No scores available.
Issue body
Stage package contents should be normalized after unpacking, but only
if there are packages to unpack. Previous code to test this condition
assumed that pathlib's glob returned a list instead of a generator.
Fix the package presence verification (without unecessarily obtaining
a package list from the generator).
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for pathlib.glob usage in stage package normalization. Previously assumed glob returned a list, causing verification errors. Updated to efficiently check for packages without converting the generator, then merged into master. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Corrected a bug where pathlib.glob() returning a generator instead of a list caused incorrect package presence verification. The fix ensures repo normalization only runs when packages exist, avoiding unnecessary generator consumption. |
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. | |
| #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. | |
| #767 fix(PackageService): normalize paths returned by the pack method | craft-application | merged | Merged fix normalizing paths returned by PackageService.pack. The caller now handles path normalization and discards invalid results instead of relying on resolved filesystem paths. Approved by two reviewers with all CI checks passing. |