Skip to content

enable multiple debian repositories - #353

Open
andrewmrich wants to merge 5 commits into
git-pkgs:mainfrom
andrewmrich:arich/debian-repositories
Open

andrewmrich wants to merge 5 commits into
git-pkgs:mainfrom
andrewmrich:arich/debian-repositories

Conversation

@andrewmrich

@andrewmrich andrewmrich commented Sep 16, 2026

Copy link
Copy Markdown

upstream.debian is a single URL, but a Debian release is served by more than one archive. Security updates ship from https://security.debian.org/debian-security, a different host from the main archive. So a client pointed at the proxy can't write a complete sources.list, and trixie-security is unreachable.

This adds upstream.debian_repositories, a name-to-URL map served at /debian/{name}/, matching the existing upstream.apk:

upstream:
  debian: "http://deb.debian.org/debian"
  debian_repositories:
    security: "https://security.debian.org/debian-security"
deb http://localhost:8080/debian trixie main
deb http://localhost:8080/debian/security trixie-security main

/debian/pool/ and /debian/dists/ still address upstream.debian with unchanged cache identities, and TestDebianHandler_LegacyCacheKeysUnchanged pins those literals, so existing deployments keep their warm caches. Config load refuses pool and dists as repository names, since either would shadow the main archive's own root path.

#56 proposed a hardcoded debian-security route. A map covers that case and others with it, which is what I ran: apt-get update and installs through this branch from a debian:bookworm-slim client, against deb.debian.org, security.debian.org, cli.github.com/packages, and a snapshot.debian.org timestamp, all configured together. With the main archive and the GitHub CLI repo in one sources.list, apt install gh resolved gh from the third-party repo and its git dependency from the main archive in one transaction.

Testing is arm64 only, and some runs used trusted=yes, so it didn't exercise signature verification.

A Debian release is served by more than one archive. Security updates live on
a different host than the main archive, so a single upstream.debian URL cannot
serve a complete suite set and -security suites are unreachable.

Add upstream.debian_repositories, a name-to-URL map served at /debian/{name}/,
modelled on upstream.apk. The field is additive: upstream.debian keeps serving
/debian/pool/... and /debian/dists/... with unchanged cache identities, so
existing deployments and their warm caches are unaffected, and the scalar
field and PROXY_UPSTREAM_DEBIAN are untouched.

Named repositories scope both caches by name, since the same filename can hold
different bytes in different archives. Metadata keys are hashed over name,
upstream URL, and path, as APKHandler does. Names are validated through
validateNamedUpstreams, and "pool" and "dists" are refused because they would
shadow the main archive's own paths.

An unconfigured first path segment stays a main-archive path rather than
returning 404 as the APK handler does: the main archive is unnamed and serves
paths of its own at the root.
The motivation for separate archives was repeated across six files and the
reserved-name rationale across five. Keep each in one place -- the reference
docs -- and leave the code comments to what an informed reader cannot get
from the code: why an unknown first segment is not a 404 as it is for APK,
and why the main archive keeps its legacy cache identities.

Comments and prose only; no behaviour change.
@andrewmrich
andrewmrich force-pushed the arich/debian-repositories branch from 3569ec5 to 658664a Compare September 16, 2026 17:23
A request to /debian/{name}/ for a name that is not configured fell through
to the main archive, so a typo surfaced as the upstream's own HTML 404 with
no mention of the repository. The reply now names the unknown repository and
lists the configured ones.

Scoped to {name}/dists/ and {name}/pool/. The main archive serves README,
indices/ and project/ at its root, so an unknown first segment stays a
main-archive path everywhere else.

apt prints only the status line, so this is visible via curl or the proxy
log rather than in apt output.
@andrewmrich
andrewmrich marked this pull request as ready for review September 19, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant