Open mseri opened 5 months ago
There is a pretty big problem though: the breakage is silent.
The patch
command from macOS/BSDs makes a file empty instead of removing it so the files that have been removed by https://github.com/ocaml/opam-repository/pull/25960 will be there but empty and they will overwrite the file of the same name added by extra-source.
This should not be advertise as "possible breakage" but Giant Warning to anyone still not using GNU patch on macOS instead and it might not be "breaking"
What do you reckon we should do? Should we revert the change? Ping also @hannesm
My point of view is:
There's a workaround for those affected: rm -rf ~/.opam/repo/default{,.tar.gz} && opam update default
. So, we should carry on (and not revert), also with the opam-archive in mind we definitively want the freedom to remove packages.
And finally, I don't see a way to have a failsafe and smooth transition. Of course we could wait (forever?) until everyone updated to 2.1.6. We could also push for a release of opam where "if extra_source is present, a extra_file doesn't overwrite it" - but that also would mean to wait for an unknown time until everybody upgraded to that new opam release. Given that we don't have any statistics about "opam version usage", I see no point in delaying.
- we also have announced it at https://discuss.ocaml.org/t/ann-opam-repository-policy-change-checksums-no-md5-and-no-extra-files/14720/1
The discuss post announces this as a policy change, which i think is fair to understand this way. However one thing that hasn't been done is to codify it in https://github.com/ocaml/opam-repository/wiki/Policies, could anyone write an amendment for it?
I was wondering whether such a patch would be sensible (and would work):
diff --git a/repo b/repo
index ff07c1813e..8e7eb9533c 100644
--- a/repo
+++ b/repo
@@ -8,4 +8,7 @@ announce: [
"""
[INFO] opam 2.1 includes many performance improvements over 2.0; please consider upgrading (https://opam.ocaml.org/doc/Install.html)
""" {opam-version >= "2.0.10" & opam-version < "2.1.0~~"}
+"""
+[WARNING] please ensure to have GNU patch installed as `patch`. Otherwise update may fail silently (since it can't remove files).
+""" {os = "macos" & opam-version < "2.1.6"}
]
- we also have announced it at https://discuss.ocaml.org/t/ann-opam-repository-policy-change-checksums-no-md5-and-no-extra-files/14720/1
The discuss post announces this as a policy change, which i think is fair to understand this way. However one thing that hasn't been done is to codify it in https://github.com/ocaml/opam-repository/wiki/Policies, could anyone write an amendment for it?
I also opened https://github.com/ocaml/opam-repository/pull/25963 to guide contributors how to use extra-source
.
I was wondering whether such a patch would be sensible (and would work):
yes i think it would be nice, however currently users of the default opam-repository (via opam.ocaml.org) use a different repo
file generated here: https://github.com/ocaml-opam/opam2web/blob/d3d36b81174cbbb9df9dfe525cd2cfe77fd86206/bin/opam-web.sh#L26 so this one would probably also need to be modified.
I'm not sure if there is a clean way to merge both (use opam-repository's repo
file as a base and modify it as needed), I'll open a ticket at least to track this.
yes i think it would be nice, however currently users of the default opam-repository (via opam.ocaml.org) use a different
repo
file generated here: https://github.com/ocaml-opam/opam2web/blob/d3d36b81174cbbb9df9dfe525cd2cfe77fd86206/bin/opam-web.sh#L26 so this one would probably also need to be modified.
I opened https://github.com/ocaml-opam/opam2web/pull/234 which should work smoothly (at least with my knowledge and tests of shell) -- of course a review would be welcome.
See https://github.com/ocaml/opam-repository/pull/25967 for the update above.
I have also checked the dependency on gpatch for some macos package managers
I think this has been worked out of the system by this point. Are we OK to close it?
I suggest we make an entry on the FAQ in the Wiki with the specific error for this issue and the command to fix it, and then close this issue
Due to the removal of some files, your opam repository may fail to update properly (on macos or bsd, if you don't have gpatch installed). If this is the case please install gpatch or delete
$OPAMROOT/repo/default{,.tar.gz}
and re-doopam update
apologies for the inconvenience.