Commit Graph
33 Commits
Author SHA1 Message Date
vhaudiquet 4fae02bc85 package_info: drop the ANSI color from the not-found warning
The location embedded in the log record was styled with crossterm: a
remote consumer of pkh's log records would receive ANSI codes inside
the message text. Plain text is the logger's business to style.
2026-09-18 20:55:56 +02:00
vhaudiquet c2dae4f3f9 lift main.rs business logic into the library
The chlog target-series resolution becomes changelog::series_candidates
(UNRELEASED pinning, development-series default and fallbacks modeled
by SeriesCandidates), PPA references get package_info::split_ppa
(shared by pull and deb, now also rejecting empty parts), and SSH
endpoints get context::ContextConfig::from_endpoint — so a library
consumer can resolve series, validate PPAs and build context
configurations without reimplementing the CLI's rules. All three carry
unit tests; main.rs keeps only parsing of flags and error handling.
2026-09-18 20:51:36 +02:00
vhaudiquet 7af767898e launchpad: drive the endpoints from data/launchpad.yml 2026-09-18 13:27:20 +02:00
vhaudiquet 775e3d3b8a fmt 2026-09-17 16:27:34 +02:00
vhaudiquet d2bb311f74 net: retry empty index bodies and report by-hash failures in the error
CDNs occasionally answer 200 with a zero-byte body under load; the
checksum verification then reported the empty-string hash as a mismatch,
and the by-hash retry (subject to the same glitch) silently lost its own
failure reason. Treat empty bodies as transient in both fetch paths and
append the by-hash failure to the final VerifyError.

Includes a regression test serving an empty 200 followed by a valid body
on a local socket.
2026-09-17 15:32:55 +02:00
vhaudiquet 3ed95725e4 net: retry flaky archive fetches and pin index downloads via by-hash
Busy mirrors and CDNs routinely break bulk fetches: pooled keep-alive
connections get closed remotely ('error sending request'), downloads are
cut short (surfacing as bogus checksum mismatches), and index generations
momentarily drift from the Release file fetched moments before.

- shared client: short idle-pool timeout and TCP keepalive, and a
  bounded-retry GET helper now used for index, Release, keyring and
  Launchpad fetches (previously reqwest::get, which has no timeouts)
- downloads: retry the whole download, and check the content length so
  truncation is reported as such instead of a checksum mismatch
- sources index: on a checksum mismatch against the Release file, retry
  pinned to the exact listed generation via Debian's by-hash mechanism;
  body-read errors are retried and reported per component instead of
  aborting the whole lookup
2026-09-17 15:18:14 +02:00
vhaudiquet f72b35acfa Handle malformed remote and edge-case data instead of panicking
- distro_info: malformed CSV rows are skipped with a warning, dates
  that fail to parse become None, and all plain HTTP requests go
  through a shared reqwest client with connect/total timeouts
- package_info: the Sources stanza iterator is iterative (a crafted
  index with many blank stanzas overflowed the stack), stanzas missing
  a Version are skipped, and failed series/pocket probes are summarized
  in the final 'not found' error instead of being silently dropped
- pull: no double unwrap on the remote-derived artifact filename, an
  empty series list is an error, and streaming downloads get a
  per-request timeout
- deb/cross: dpkg-architecture output parsing skips unexpected lines
  and its exit status is checked, as is dpkg --add-architecture
- changelog: version increments parse as u64 with checked arithmetic
  (1.0-20250123123456 used to panic on the u32 parse)
2026-09-16 02:44:45 +02:00
vhaudiquet 213668fa82 pull: authenticate archive indexes against signed Release files
The Sources index was downloaded with no authentication: per-artifact
checksums were verified, but against hashes taken from an index a MITM
could substitute along with the artifacts. Fetch each suite's InRelease
(or Release + Release.gpg), verify the signature with gpgv against the
archive keyring (or the PPA signing key) the same way apt does, and
checksum-check every Sources index against it before parsing.

Distro archives and PPAs verify strictly: an invalid or unverifiable
signature, or a missing gpgv binary, is a hard error. Flat repositories
keep working without a Release file or without a verifiable one (warned
as unauthenticated), but tampering evidence is a hard error there too.

Also switches all archive, PPA and keyring base URLs to https, and
reads suite components from the verified Release instead of fetching
them separately over an unauthenticated channel.
2026-09-16 01:22:22 +02:00
vhaudiquet 5500f98586 pull: add --repository to pull from external flat repositories
Add a --repository flag taking the full suite URL of an external flat
repository (e.g. https://pkg.noctalia.dev/deb/resolute/), i.e. one with
no dists/ hierarchy, like apt's exact-path suites ('Suites: resolute/').

The suite name is read from the root Release file (Codename/Suite), the
sources index is fetched from the repository root as Sources.xz/gz/plain,
and package files are resolved against the URL root, ignoring the stanza
Directory field like apt does. As with PPAs, the stanza Vcs-Git is never
used for external repositories, so the source always comes from the
repository itself.

Also make the sources index parser detect compression by magic bytes
(gz/xz/plain) instead of assuming gzip, and fix extraction of archives
with './'-prefixed entries, which previously aborted and are now
extracted in place instead of being relocated.
2026-09-15 10:57:06 +02:00
vhaudiquet 09cbf56ebc pull: fix hang caused by blocking git2 call and redundant Launchpad checks
CI / build (push) Successful in 14m59s
CI / snap (push) Successful in 2m18s
2026-08-12 17:45:36 +02:00
vhaudiquet e25645b3bb pull: qol fix, highlight release
CI / build (push) Successful in 14m50s
CI / snap (push) Successful in 1m46s
2026-08-11 16:33:57 +02:00
vhaudiquet e1668d5d80 pull: support Sources.gz without Checksums-Sha256
CI / build (push) Failing after 8m34s
CI / snap (push) Has been skipped
The Ubuntu development series (stonking) Sources.gz no longer ships a
Checksums-Sha256 field, only Checksums-Sha512 and the legacy Files
(MD5) field. The package_info parser only read Checksums-Sha256, so
the file list ended up empty and fetch_orig_tarball panicked on
Option::unwrap() when looking for the orig tarball.

- Add a ChecksumAlgo enum (Md5/Sha256/Sha512) to FileEntry, replacing
  the hardcoded sha256 field, and parse the strongest available
  checksum field (Sha256 > Sha512 > MD5).
- Make download_file_checksum verify against the correct algorithm
  instead of always using SHA-256.
- Replace the unwrap() on the orig tarball search with a proper error
  listing the available files, so future regressions fail clearly
  instead of panicking.
- Add md-5 dependency for MD5 verification.
2026-07-24 12:56:31 +02:00
vhaudiquet c4b59a4376 context: copy symlinks as symlinks and improve error messages 2026-07-17 10:12:46 +02:00
vhaudiquet 5ec675c20b pull: fix edge cases
CI / build (push) Failing after 13m53s
CI / snap (push) Has been skipped
- Ubuntu does not have 'Launchpad/Code' repo edge case
- Vcs-Git field has a git command, not only an URL edge case
2026-03-17 17:22:25 +01:00
vhaudiquet eb3e71a938 package_info: fix check_launchpad_repo needing web requests (use git)
CI / build (push) Failing after 20m1s
CI / snap (push) Has been skipped
2026-02-16 18:44:46 +01:00
vhaudiquet 8345f51d2f Multiple changes:
CI / build (push) Successful in 16m23s
CI / snap (push) Successful in 4m1s
- deb: can use ppa as dependency
- deb: cross and regular are using parallel nocheck builds
- deb: ephemeral will not pull keyring if no root powers
2026-02-06 12:04:25 +01:00
vhaudiquet 225157be63 pull: allow pulling from ppa
CI / build (push) Successful in 15m54s
CI / snap (push) Successful in 3m19s
2026-01-29 17:11:01 +01:00
vhaudiquet d832666858 distro_info: fully parse distro info
CI / build (push) Failing after 10m16s
CI / snap (push) Has been skipped
2026-01-26 16:07:39 +01:00
vhaudiquet ab35af5fb5 package_info: refactor into distro_info and package_info split, yaml data
CI / build (push) Failing after 9m3s
2026-01-14 21:18:25 +01:00
vhaudiquet 70e6d8c051 pull: refactor to remove series argument
CI / build (push) Successful in 9m31s
2026-01-11 12:36:19 +01:00
vhaudiquet 650adc28a3 pull: split into package_info::lookup and pull
CI / build (push) Failing after 1m47s
2026-01-11 12:12:19 +01:00
vhaudiquet b3365afe5b docs: added documentation, enforced documentation
CI / build (push) Successful in 7m21s
2026-01-01 18:37:40 +01:00
vhaudiquet 5e1b0988fd package_info: refactor sources parsing even more
CI / build (push) Successful in 7m46s
2026-01-01 15:20:59 +01:00
vhaudiquet a567506831 package_info: refactor sources parsing with iterator
CI / build (push) Successful in 7m12s
2025-12-31 19:23:49 +01:00
vhaudiquetandvhaudiquet 1538e9ee19 deb: cross-compilation, ephemeral contexts, local builds
CI / build (push) Successful in 7m18s
Multiple changes:
- New contexts (schroot, unshare)
- Cross-building quirks, with ephemeral contexts and repositories management
- Contexts with parents, global context manager, better lifetime handling
- Local building of binary packages
- Pull: pulling dsc files by default
- Many small bugfixes and changes

Co-authored-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
Co-committed-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
2025-12-25 17:10:44 +00:00
vhaudiquet 06ab5eaf98 pull: don't fetch orig tarball for native packages
CI / build (push) Successful in 1m51s
2025-12-16 18:05:59 +01:00
vhaudiquet c14ea99dc2 pull: use the most recent pocket first on 'find'
CI / build (push) Failing after 32s
2025-12-12 18:22:29 +01:00
vhaudiquet 5c7b20f847 linter: run linter and format
CI / build (push) Successful in 1m40s
2025-12-01 00:05:39 +01:00
vhaudiquet 2cfbb69fe7 format: run cargo fmt
CI / build (push) Successful in 1m44s
2025-11-30 12:51:52 +01:00
vhaudiquet ef1d8f05bf get: allow fetching without series
CI / build (push) Successful in 1m34s
fetch from devel/sid
fetch with specific dist
2025-11-28 23:47:55 +01:00
vhaudiquet 92dfe8bacb get: fetch from all components
CI / build (push) Successful in 1m12s
2025-11-28 18:16:29 +01:00
vhaudiquet 311304666f better logging
Use callbacks to report progress, indicatif for progress bars, no direct logs but progress messages
2025-11-27 19:34:46 +01:00
vhaudiquet c466ad1846 Initial commit
- pkh created
- basic 'get' command to obtain a source package
2025-11-26 00:22:09 +01:00