guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Follow-up on julia import script


From: Simon Tournier
Subject: Re: Follow-up on julia import script
Date: Mon, 27 Feb 2023 14:46:14 +0100

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]