← Back to issue list

packages: handle packages with no candidate (CRAFT-219)

View original Github issue

Metadata

Project
craft-parts
Number
#80
Type
pull request
State
merged
Author
cmatsuoka
Labels
Created
Updated
Closed

Current evaluation

Merged. Adds None checks for package candidates, raising PackageNotFoundError. Fixes unmarking crashes with ESM repositories. Port of snapcraft PR #3528. Approved by two reviewers, passed CI, merged with 112 additions and 21 deletions.

Suggested action:

No scores available.

Issue body

A port of the snapcraft PR #3528 by Chris Patterson. Original description follows: * Add some checks to ensure package.candidate is not None before using it. If it is None, when expected to not be `None`, raise a `PackageNotFoundError` with the name of the package in question. * Do not iterate over all packages when unmarking. This is the cause of https://forum.snapcraft.io/t/snapcraft-crash-when-esm-repositories-are-present/24587/8 where a package was being inspected that did not have an available candidate, causing Snapcraft to fail unnecessarily. Co-authored-by: Chris Patterson <chris.patterson@canonical.com> 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. Adds None checks for package candidates, raising PackageNotFoundError. Fixes unmarking crashes with ESM repositories. Port of snapcraft PR #3528. Approved by two reviewers, passed CI, merged with 112 additions and 21 deletions.
qwen3.6-35b-a3b-mtp-q6 Merged. Added null checks for package.candidate to raise PackageNotFoundError instead of crashing. Optimized unmarking to avoid full package iteration, resolving failures with ESM repositories. Port of snapcraft PR #3528.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#47 packages: add snap-related exceptions craft-parts merged Added exception classes for snap handling errors to craft_parts.packages.snaps. Approved by two reviewers, passed CI checks, and merged with 163 additions and 18 deletions across two files.
74%