is there a command to add a `checksum` to an opam file?
There's a command which is able to check if an opam file has a correct checksum
opam lint --check-upstream path/to/the/file
But is there one to add a checksum to an opam file?
For the record it would be convenient at ahrefs where we have a repo with overlays or unreleased versions of packages. We can usually start from opam show --raw name-of-the-package > patch/to/the/file and set the url of the archive we want to use. But then we need to do something by hand to compute and add the checksum, which people tend to forget about.
echo "checksum: [ \"sha512=$(curl -L $(opam show -f url.src --raw path/to/the/file | sed 's/^"\(.*\)"$/\1/') | sha512sum | awk '{print $1}')\" ]"
(ftr doing curl | checksum is kind of meh from the not trusting the infrastructure pov, should be doing checksum on the local file before uploading)
This part already exists as part of tools like dune-release and opam publish I believe. The use case here is a bit different.