guix-devel
[Top][All Lists]
Advanced

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

Re: Adding content-addressed URLs to https://guix.gnu.org/sources.json


From: Simon Tournier
Subject: Re: Adding content-addressed URLs to https://guix.gnu.org/sources.json
Date: Tue, 02 May 2023 19:35:59 +0200

Hi,

On Tue, 02 May 2023 at 08:52, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

> Thanks for explaining, it makes sense.  One way to tip package writers
> in the right direction would be to add a warning when such a situation
> occurs upon running 'guix lint'.

Somehow improve “guix lint -c archival”. ;-)


> Simon's solution is a bit more complicated/verbose than the gexp version
> currently in used taste, but it works while preserving the origin and
> avoids extra steps in each package that will be using sorbet-monorepo,
> so I think I'd go with it.

My point was to show that ’snippet’ could produce the exact same output
but exposing the ’origin’ usable by third-party (sources.json or else).
Maybe the snippet can be simplified. :-)

Another solution would to list ’sorbet-monorepo’ as an input and then
apply a generic build phase dealing with mono repo.  Hum, I think the
’snippet’ approach is better. :_

Note ’racket-packages-origin’ from (gnu packages racket) looks similar:

--8<---------------cut here---------------start------------->8---
  (computed-file
   (string-append "racket-pkg-" name "-sources")
   (with-imported-modules `((guix build utils))
     #~(begin
         (use-modules (guix build utils))
         (mkdir-p (string-append #$output "/share/racket/pkgs"))
         (chdir (string-append #$output "/share/racket/pkgs"))
         #$@(map (match-lambda
                   ((? string? name)
                    #~(copy-recursively #$(file-append origin (string-append 
"/" name))
                                        #$name))
                   ((name ".")
                    #~(copy-recursively #$origin #$name))
                   ((name path)
                    #~(copy-recursively #$(file-append origin (string-append 
"/" path))
                                        #$name)))
                 specs)))))
--8<---------------cut here---------------end--------------->8---

and that somehow uses the ’inputs’ approach.  Well, contrary to what I
said earlier in this thread, not all the sources for building Racket are
captured by sources.json:

--8<---------------cut here---------------start------------->8---

$ wget https://guix.gnu.org/sources.json
$ guix shell jq
$ cat sources.json | jq | grep sorbet

$ cat sources.json | jq | grep 'github.com/racket'
      "git_url": "https://github.com/racket/racket";,
--8<---------------cut here---------------end--------------->8---

As you see, it requires,

    https://github.com/racket/2d

as input and that’s not listed.  I will give a look later if no one
beats me. :-)


Somehow, my initial point when mentioning ’computed-origin-method’ is
that maybe there is a need.  Maybe it’s an opportunity to rehash this
“method”.  Or another that provides 1. the structure we need for
extracting and 2. the flexibility we need for special use cases.

Cheers,
simon



reply via email to

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