all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Maxime Devos <maximedevos@telenet.be>
Cc: Guix Devel <guix-devel@gnu.org>
Subject: Re: Why linux-libre source code is not in sources.json
Date: Thu, 9 Sep 2021 19:18:46 +0200	[thread overview]
Message-ID: <CAJ3okZ0CLdVw5CB486uh2cZH4N6U9s_5v1UrC68H7WfyLTQX1g@mail.gmail.com> (raw)
In-Reply-To: <76c52829993400ffb1f85dd30a3d63844a45540e.camel@telenet.be>

Hi,

On Thu, 9 Sept 2021 at 11:51, Maxime Devos <maximedevos@telenet.be> wrote:

> > where ’make-linux-libre-source’ returns a ’computed-origin-method’.  And
> > the ’origin-uri’ of ’linux-libre-5.14-pristine-source’ is a ’gexp’.
> > Then inside this ’gexp’, you can read the ’%upstream-linux-source’ URL:
> >
> > --8<---------------cut here---------------start------------->8---
> > #<gexp-input native
> >  #<origin
> >   #"mirror://kernel.org/linux/kernel/v5.x/linux-5.13.14.tar.xz"
> >   #<content-hash sha256:06lbjsbr86qa8yai5gfclbfxvcqsw33kxj9b4r93hh6z1wajmx82>
> > --8<---------------cut here---------------end--------------->8---
> >
> > and I do not know if it is possible to extract such thing.
>
> To extract the <origin> from the <gexp-input>, use gexp-input-thing.
> To extract the <gexp-input> from the <gexp>, use the unexported
> gexp-references.

Thanks!  It does the job. :-)

I will fix sources.json if no one beats me.

With the (ugly) snippet below,  I get almost the linux-libre, I guess.
The question is now how does SWH ingest the script with the URL:

<https://linux-libre.fsfla.org/pub/linux-libre/releases/5.13.14-gnu1/deblob-5.13>

Another story. :-)

Cheers,
simon


--8<---------------cut here---------------start------------->8---
$ guix repl /tmp/linux.scm | grep linux-libre
(mirror://kernel.org/linux/kernel/v5.x/linux-5.13.14.tar.xz
https://linux-libre.fsfla.org/pub/linux-libre/releases/5.13.14-gnu1/deblob-check
https://linux-libre.fsfla.org/pub/linux-libre/releases/5.13.14-gnu1/deblob-5.13)
(mirror://kernel.org/linux/kernel/v5.x/linux-5.13.14.tar.xz
https://linux-libre.fsfla.org/pub/linux-libre/releases/5.13.14-gnu1/deblob-check
https://linux-libre.fsfla.org/pub/linux-libre/releases/5.13.14-gnu1/deblob-5.13)
(mirror://kernel.org/linux/kernel/v4.x/linux-4.4.283.tar.xz
https://linux-libre.fsfla.org/pub/linux-libre/releases/4.4.283-gnu1/deblob-check
https://linux-libre.fsfla.org/pub/linux-libre/releases/4.4.283-gnu1/deblob-4.4)
(mirror://kernel.org/linux/kernel/v4.x/linux-4.19.206.tar.xz
https://linux-libre.fsfla.org/pub/linux-libre/releases/4.19.206-gnu1/deblob-check
https://linux-libre.fsfla.org/pub/linux-libre/releases/4.19.206-gnu1/deblob-4.19)

[...]

(https://linux-libre.fsfla.org/pub/linux-libre/releases/5.4.20-gnu/linux-libre-5.4.20-gnu.tar.xz
ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-5.4.20-gnu.tar.xz
mirror://gnu/linux-libre/5.4.20-gnu/linux-libre-5.4.20-gnu.tar.xz)
(mirror://kernel.org/linux/kernel/v4.x/linux-4.14.246.tar.xz
https://linux-libre.fsfla.org/pub/linux-libre/releases/4.14.246-gnu1/deblob-check
https://linux-libre.fsfla.org/pub/linux-libre/releases/4.14.246-gnu1/deblob-4.14)
(https://linux-libre.fsfla.org/pub/linux-libre/releases/5.4.20-gnu/linux-libre-5.4.20-gnu.tar.xz
ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-5.4.20-gnu.tar.xz
mirror://gnu/linux-libre/5.4.20-gnu/linux-libre-5.4.20-gnu.tar.xz)
--8<---------------cut here---------------end--------------->8---


--8<---------------cut here---------------start------------->8---
(use-modules (guix packages)
             (guix gexp)
             (gnu packages)
             (gnu packages linux)
             (srfi srfi-1)
             (ice-9 match))

(define gexp-references (@@ (guix gexp) gexp-references))

(define (thing->string thing)
  (match thing
    ((? gexp-input? g)
     (match (gexp-input-thing g)
       ((? origin? o)
        (origin-uri o))
       (_ #f)))
    (_ #f)))

(define (get-uri pkg)
  (match (package-source pkg)
    ((? origin? o)
     (match (origin-uri o)
       ((? string? s)
        (list s))
       ((? list? lst)
        lst)
       ((? promise? prom)
        (match (force prom)
          ((? gexp? g)
           (filter (lambda (x) x)
                   (delete-duplicates
                    (map thing->string
                         (gexp-references g)))))
          (_
           (list #f))))
       (_
        (list #f))))
    (_ #f)))

(define all-packages
  (sort
   (fold-packages (lambda (package lst)
                    (if (or (package-superseded package)
                            (package-replacement package))
                        lst
                        (cons package lst)))
                  '())
   (lambda (p1 p2)
     (string<? (package-name p1)
               (package-name p2)))))

(map (lambda (p)
       (format #t "~a~%" (get-uri p)))
     all-packages)
--8<---------------cut here---------------end--------------->8---


  reply	other threads:[~2021-09-09 17:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04 18:17 Linux-libre source code will be taken offline Leo Famulari
2021-09-04 20:32 ` Jason Self
2021-09-06 17:36   ` Leo Famulari
2021-09-27 22:30     ` Mark H Weaver
2021-09-27 23:17       ` Vagrant Cascadian
2021-09-28 13:05         ` Ludovic Courtès
2021-09-27 23:30       ` Leo Famulari
2021-09-28  0:13         ` zimoun
2021-09-28  0:17           ` zimoun
2021-09-28  0:46         ` Jason Self
2021-09-28  8:43           ` zimoun
2021-09-28 14:02             ` Jason Self
2021-09-28 14:30             ` Jason Self
2021-09-28 17:11               ` zimoun
2021-09-28 17:52                 ` Jason Self
2021-09-29  8:50                   ` zimoun
2021-10-08  1:58                     ` Maxim Cournoyer
2021-10-11  8:43                       ` zimoun
2021-09-08 22:00 ` Ludovic Courtès
2021-09-08 23:46   ` Why linux-libre source code is not in sources.json zimoun
2021-09-09  7:37     ` zimoun
2021-09-09  9:50       ` Maxime Devos
2021-09-09 17:18         ` zimoun [this message]
2021-09-11  0:22   ` Linux-libre source code via SWH sources.json zimoun

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=CAJ3okZ0CLdVw5CB486uh2cZH4N6U9s_5v1UrC68H7WfyLTQX1g@mail.gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=maximedevos@telenet.be \
    /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.