unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Simon Tournier <zimon.toutoune@gmail.com>
To: Josselin Poiret <dev@jpoiret.xyz>, 62036@debbugs.gnu.org
Cc: Ricardo Wurmus <rekado@elephly.net>,
	Mathieu Othacehe <othacehe@gnu.org>,
	ludo@gnu.org, Tobias Geerinckx-Rice <me@tobias.gr>,
	Christopher Baines <mail@cbaines.net>
Subject: [bug#62036] [PATCH] guix: packages: Consider 'patches' by 'package-direct-sources'.
Date: Fri, 10 Mar 2023 12:33:06 +0100	[thread overview]
Message-ID: <87jzzoon7x.fsf@gmail.com> (raw)
In-Reply-To: <87lek5d82p.fsf@jpoiret.xyz>

Hi Josselin,

On jeu., 09 mars 2023 at 20:43, Josselin Poiret via Guix-patches via <guix-patches@gnu.org> wrote:

>> +    (append
>> +     (list source)
>> +     (filter origin? (origin-patches source))))
>
> * cough * (cons source (filter ...)) * cough *

Ahah!  Somehow I removed from my mental toolbox cons, car and cdr
because I am spending too much time explaining to non-lispers. :-)

Thanks for showing me the light. ;-)


> Other than that, LGTM!  Tests worked fine on my end.  No idea what this
> is used for though :p

For instance, it can be used to list all the ’origin’ of a package.
Consider the package ’tensorflow’, it reads,

--8<---------------cut here---------------start------------->8---
    (native-inputs
[...]
       ;; The commit hashes and URLs for third-party source code are taken
       ;; from "tensorflow/workspace.bzl".
       ("boringssl-src"
        ,(let ((commit "ee7aa02")
               (revision "1"))
           (origin
             (method git-fetch)
             (uri (git-reference
                   (url "https://boringssl.googlesource.com/boringssl")
--8<---------------cut here---------------end--------------->8---

where some inputs are not packages but just ’origin’.  Therefore, the
procedure allows to get all the ’origin’, the one from the field
’origin’ and also the ones from inputs.

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,use(gnu packages machine-learning)
scheme@(guix-user)> ,pp (map origin-uri (package-direct-sources tensorflow))
$1 = (#<<git-reference> url: "https://github.com/tensorflow/tensorflow" commit: "v1.9.0" recursive?: #f>
 #<<git-reference> url: "https://boringssl.googlesource.com/boringssl" commit: "ee7aa02" recursive?: #f>
[...]
--8<---------------cut here---------------end--------------->8---

For some packages as ’ntp’, the patches are also a list of ’origin’,

--8<---------------cut here---------------start------------->8---
     (origin
       (method url-fetch)
       (uri (list (string-append
                   "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-"
[...]
       ;; Add an upstream patch to fix build with GCC 10.  Taken from
       ;; <https://bugs.ntp.org/show_bug.cgi?id=3688>.
       (patches (list (origin
                        (method url-fetch)
                        (uri "https://bugs.ntp.org/attachment.cgi?id=1760&action=diff&context=patch&collapsed=&headers=1&format=raw")
[...]
--8<---------------cut here---------------end--------------->8---

and the patch allows to also extract them:

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,use(gnu packages ntp)
scheme@(guix-user)> ,pp (map origin-uri (package-direct-sources ntp))
$2 = (("https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p15.tar.gz"
  "http://archive.ntp.org/ntp4/ntp-4.2/ntp-4.2.8p15.tar.gz")
 "https://bugs.ntp.org/attachment.cgi?id=1760&action=diff&context=patch&collapsed=&headers=1&format=raw"
 "https://bugs.ntp.org/attachment.cgi?id=1814&action=diff&collapsed=&headers=1&format=raw")
--8<---------------cut here---------------end--------------->8---


This way it improves the coverage with Software Heritage.  All the
source code (origin) is extracted and feed some SWH loader.  The code is
there:

https://git.savannah.gnu.org/cgit/guix/maintenance.git/tree/hydra/build-package-metadata.scm#n58

Cheers,
simon




  reply	other threads:[~2023-03-10 12:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 17:18 [bug#62036] [PATCH] guix: packages: Consider 'patches' by 'package-direct-sources' Simon Tournier
2023-03-09 19:43 ` Josselin Poiret via Guix-patches via
2023-03-10 11:33   ` Simon Tournier [this message]
2023-03-10 12:12     ` Josselin Poiret via Guix-patches via
2023-03-11 16:51 ` [bug#62036] [PATCH v2] " Simon Tournier
2023-03-13 11:14   ` bug#62036: " Ludovic Courtès

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzzoon7x.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=62036@debbugs.gnu.org \
    --cc=dev@jpoiret.xyz \
    --cc=ludo@gnu.org \
    --cc=mail@cbaines.net \
    --cc=me@tobias.gr \
    --cc=othacehe@gnu.org \
    --cc=rekado@elephly.net \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).