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.
This commit is contained in:
2026-09-15 10:57:06 +02:00
parent 3b99ece39a
commit 5500f98586
5 changed files with 256 additions and 49 deletions
+6
View File
@@ -48,6 +48,8 @@ fn main() {
.arg(arg!(-v --version <version> "Target package version").required(false))
.arg(arg!(--archive "Only use the archive to download package source, not git").required(false))
.arg(arg!(--ppa <ppa> "Download the package from a specific PPA").required(false))
.arg(arg!(--repository <url> "Download the package from an external flat repository, given as its full suite URL (e.g. https://pkg.noctalia.dev/deb/resolute/)").required(false)
.conflicts_with("ppa"))
.arg(arg!(-p --pocket <pocket> "Target package distribution pocket (updates, security, proposed)").required(false))
.arg(arg!(<package> "Target package")),
)
@@ -138,6 +140,9 @@ fn main() {
let dist = sub_matches.get_one::<String>("dist").map(|s| s.as_str());
let version = sub_matches.get_one::<String>("version").map(|s| s.as_str());
let ppa = sub_matches.get_one::<String>("ppa").map(|s| s.as_str());
let repository = sub_matches
.get_one::<String>("repository")
.map(|s| s.as_str());
let pocket = sub_matches
.get_one::<String>("pocket")
.map(|s| s.as_str())
@@ -166,6 +171,7 @@ fn main() {
pocket,
dist,
base_url.as_deref(),
repository,
Some(&progress_callback),
)
.await?;