From: Simon Tournier <zimon.toutoune@gmail.com>
To: "Nicolas Graves" <ngraves@ngraves.fr>, "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org, "Jean-Baptiste Volatier" <jbv@pm.me>,
"Nicolò Balzarotti" <anothersms@gmail.com>
Subject: Re: Follow-up on julia import script
Date: Mon, 27 Feb 2023 14:46:14 +0100 [thread overview]
Message-ID: <87k003kyqh.fsf@gmail.com> (raw)
In-Reply-To: <87v8jn49vm.fsf@ngraves.fr>
Hi Nicolas,
On lun., 27 févr. 2023 at 12:37, Nicolas Graves via "Development of GNU Guix and the GNU System distribution." <guix-devel@gnu.org> wrote:
> What we get from juliahub is really not bad, since it's really close to
> what we have in other importers.
Oh cool! Thanks.
> - we don't have a `hash` field in the json, tough we might be able to
> get it by parsing Versions.toml additionally to the json. This I can
> do with a very simple parser.
Do you mean Versions.toml from General registry?
Well, I do not think it is straightforward to go from Git SHA1 hash to
NAR SHA256 hash, to put it mildly. :-) Because two points:
1. Git uses one way for serializing and NAR is another.
2. SHA1 is one hash function and SHA256 is another.
1. Git uses one way for serializing and NAR is another. From
Versions.toml [0], it reads,
--8<---------------cut here---------------start------------->8---
["0.6.41"]
git-tree-sha1 = "3cfdb31b517eec4173584fba2b1aa65daad46e09"
--8<---------------cut here---------------end--------------->8---
0: <https://github.com/JuliaRegistries/General/blob/master/Z/Zygote/Versions.toml>
--8<---------------cut here---------------start------------->8---
$ git -C Zygote.jl log -1 --oneline
4777767 (HEAD, tag: v0.6.41) un-bump version
$ guix hash -S git -H sha1 -f hex -x Zygote.jl
3cfdb31b517eec4173584fba2b1aa65daad46e09
--8<---------------cut here---------------end--------------->8---
Let only replace the serializer from Git to NAR:
--8<---------------cut here---------------start------------->8---
$ guix hash -S nar -H sha1 -f hex -x Zygote.jl
85fc67799543110880acaa8c584d44edb3565b7d
--8<---------------cut here---------------end--------------->8---
2. SHA1 is one hash function and SHA256 is another. Obviously, it is
impossible to go from one to the other.
--8<---------------cut here---------------start------------->8---
$ guix hash -S nar -H sha256 -f hex -x Zygote.jl
f3d1776c4f3f539987141ad4a57198fd62038e6ef5e9a2eea8ba0819aa916f09
--8<---------------cut here---------------end--------------->8---
However, here the format is ’hex’ and it is possible to convert this
checksum from the format ’hex’ to the format ’nix-base32’. From this
f3d1776c4f3f539987141ad4a57198fd62038e6ef5e9a2eea8ba0819aa916f09, it is
straightforward to get
02bgj6m1j25sm3pa5sgmds706qpxk1qsbm0s2j3rjlrz9xn7glgk as specified by the
recipe,
--8<---------------cut here---------------start------------->8---
(version "0.6.41")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/FluxML/Zygote.jl")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "02bgj6m1j25sm3pa5sgmds706qpxk1qsbm0s2j3rjlrz9xn7glgk"))))
--8<---------------cut here---------------end--------------->8---
For my point of view, you need to clone the repository to be able to
compute the ’hash’ field.
Cheers,
simon
next prev parent reply other threads:[~2023-02-27 13:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 16:35 Follow-up on julia import script Nicolas Graves via Development of GNU Guix and the GNU System distribution.
2023-02-24 18:21 ` Simon Tournier
2023-02-25 10:11 ` Nicolas Graves via Development of GNU Guix and the GNU System distribution.
2023-02-25 12:19 ` Simon Tournier
2023-02-25 18:23 ` Ludovic Courtès
2023-02-27 10:14 ` Simon Tournier
2023-02-27 11:37 ` Nicolas Graves via Development of GNU Guix and the GNU System distribution.
2023-02-27 13:46 ` Simon Tournier [this message]
2023-02-27 18:01 ` Nicolas Graves via Development of GNU Guix and the GNU System distribution.
2023-02-28 9:25 ` Simon Tournier
2023-03-06 11:23 ` Nicolas Graves via Development of GNU Guix and the GNU System distribution.
2023-03-07 11:52 ` Simon Tournier
2023-03-15 12:43 ` Nicolas Graves via Development of GNU Guix and the GNU System distribution.
2023-03-18 11:17 ` Nicolas Graves via Development of GNU Guix and the GNU System distribution.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k003kyqh.fsf@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=anothersms@gmail.com \
--cc=guix-devel@gnu.org \
--cc=jbv@pm.me \
--cc=ludo@gnu.org \
--cc=ngraves@ngraves.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.