Skip to content

Mirror Composer releases - #594

Merged
andrew merged 3 commits into
git-pkgs:mainfrom
simonchrz:feat/mirror-composer-archive
Oct 25, 2026
Merged

andrew merged 3 commits into
git-pkgs:mainfrom
simonchrz:feat/mirror-composer-archive

Conversation

@simonchrz

Copy link
Copy Markdown
Contributor

Part of #414. Builds on #593 (and #592); the last commit is this PR.

Mirroring pkg:composer/... failed with unsupported ecosystem. A tagged release is now mirrored with the dist archive upstream.composer lists:

  • cached under the file name /composer/files/{vendor}/{package}/{version}/{file} serves it as, using the handler's distFilename;
  • checked against the listed shasum, as the handler checks it (Packagist lists none for GitHub archives);
  • its publish time is stored the way the handler stores it, so serveCachedRelease serves the archive without the metadata, with cooldown on too.

Refused, with a message saying why:

  • branches (dev-main): the handler reads the metadata for every branch download, so a mirrored archive wouldn't be served offline;
  • archive URLs with a query, which clients request with one and which take the same path;
  • packages in upstream.composer_routes. The old message said "give a version", which doesn't help there.

FileLister became VersionFinder, which returns the whole version, since Composer needs the dist type and publish time.

Tested through the mirror and the Composer handler with the upstream closed and cooldown on (internal/server/mirror_composer_test.go); that test fails without the stored publish time. Against packagist.org I mirrored psr/log@3.0.2 and monolog/monolog@3.8.1 and served both with upstream.composer unreachable and a 3d cooldown.

Mirroring a PyPI version passed each file's sha256 as the integrity
GetOrFetchArtifactFromURLWithIntegrity records with the version. Wheels of
one version share the name and version they are cached under, so the last
file's checksum replaced the others', and serving the other wheels from
the cache failed the integrity check.

The mirror now passes the sha256 as a digest, which is checked against
that file's content hash alone.
A conda version is mirrored with every build anaconda.org lists for it,
each cached under the channel, name, version and subdir/filename the conda
download handler reads from its path. The channel comes from the namespace
or the channel qualifier; a package without one is refused, as retention
keys without one are. The subdir, build and type qualifiers select builds.

Which files a version has, which qualifiers select them and where the
handler caches them is now described per ecosystem, so PyPI and conda share
mirrorFiles.

Part of git-pkgs#414.
Mirroring pkg:composer failed with unsupported ecosystem. A tagged release
is now mirrored with the dist archive upstream.composer lists, under the
file name the Composer handler serves it as and checked against the
listed shasum. The release's publish time is stored as the handler stores
it, so the archive is served from the cache without the metadata, with
cooldown on as well.

Branches are refused, since the handler reads the metadata for every
branch download, and so are archive URLs with a query and packages in
upstream.composer_routes.

The mirror now finds the whole version rather than its files, for the
dist type and publish time.

Part of git-pkgs#414.
@andrew
andrew merged commit c17a01c into git-pkgs:main Oct 25, 2026
7 checks passed
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.

2 participants