-
Couldn't load subscription status.
- Fork 374
Open
Labels
Milestone
Description
There are two forms of archive-mirrors:
- The
archive-mirrorsfrom the global options, displayed inopam optionand changeable there (since opamClient: pass dl_cache from initConfig to config #5315). By default empty. - The
archive-mirrorsfrom each repositories currently set in your switch
Currently the latter isn't used very much due to #4830, but as most people who will actually set archive-mirrors manually are most likely using opam >= 2.2, the idea of setting it in opam-repository sounds doable.
However i can see some minor problems with the way opam handles archive-mirrors for repositories.
- If one adds several repositories and the all have their
archive-mirrorsset, then any cache miss will actually try downloading the archive as many times as there are repositories and these urls are not de-duplicated. Meaning that for opam-repository for example, a cache miss will keep sending request to opam.ocaml.org as many times as there are opam-repository forks in the current switch. - These values aren't visible anywhere for regular users. The only way for users to know their values is to do
grep archive-mirrors: .opam/repo/*/repoor something of the sort. - These values aren't overridable. If for whatever reason you do not want to use the mirror from a repository, there are currently no ways of doing that without forking it and removing the
archive-mirrorsfield manually, because... - ... removing
archive-mirrorsfrom therepofile cannot currently be done automatically without assuming a certain format (e.g. Avoid duplicated archive-mirrors: field in the repo file ocaml-opam/opam2web#247) or without usingopam-ed
To solve these minor issues, i propose to:
- improve the handling of the mirrors by transforming the
string listtoSet.(OpamUrl.t).twhere the values are actually used - add a
Repositories configurationsection inopam optionthat displays the value ofarchive-mirrorsfor each repository - allow to override the repository configuration with a new
opam option --repositoryargument. Setting it could add a note duringopam updateto remind them that the value from the repository isn't taken into account - add a new
opam admin edit-repo-filecommand, which would allow to remove or edit fields in the repo file