fix(deb): avoid re-downloading cached stage-packages
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
## Summary
Mitigate repeated `.deb` downloads from a warm cache in the `stage-packages` / apt-cache path.
This wraps `package.candidate.fetch_binary(...)` with a narrow local patch for
`apt.package._file_is_same`, using:
- binary file mode
- order-independent hash comparison
so cached `.deb` files that already match the expected metadata are treated as cache hits.
## Context
Refs #1495.
This is intentionally scoped to the `stage-packages` / apt-cache download path.
It is related to, but separate from, #1485, which reduces some `python-apt`
usage in the installed-package check path.
## Testing
- `ruff check craft_parts/packages/apt_cache.py tests/unit/packages/test_apt_cache.py`
- `pytest -q tests/unit/packages/test_apt_cache.py -rs`
- `pytest -q tests/unit/packages/test_deb.py -rs`
- `pytest -q tests/unit/packages -rs`
Evaluation history
No evaluation history available.