input-output-hk / foliage

🌿 Foliage is a tool to create custom Haskell package repositories, in a fully reproducible way.
MIT License
42 stars 9 forks source link

Hackage url compatibility #58

Closed andreabedini closed 1 year ago

andreabedini commented 1 year ago

To maximise hackage compatibility we should produce the same urls. Here's a list of what Hackage provides (extracted from https://hackage.haskell.org/api).

This is confusing, and indeed this note on hacakge-security starts with:

The situation with paths in cabal/hackage is a bit of a mess.

Reading that note and comparing with the code, I gather that:

We have been using package/{pkg-id}.tar.gz and everything has been working fine, I guess we need to keep it like that. Note that a static website cannot serve a redirect (at least not in a general way).

This is the most recent cabal file. So far we expose this at index/{pkg-name}/{pkg-version}/{pkg-name}.cabal. Note: When first writing foliage, I used hackage-repo-tool as a blue print. hackage-repo-tool does create the /index paths, although they are not provided by Hackage, likely this is for compatibility with local indicies.

This is for all revisions. We don't have anything like this at the moment.

andreabedini commented 1 year ago

I had a second look, it's hackage-security that defines the layout for hackage, and it uses /package/<pkg-id>.tar.gz.

https://github.com/haskell/hackage-security/blob/482bc5a8c0215142e3ec224498453d2b5a25203c/hackage-security/src/Hackage/Security/TUF/Layout/Repo.hs#L52

I guess at this point it's irrelevant what hackage-server calls official :shrug: