all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Julien Lepiller <julien@lepiller.eu>,
	help-guix@gnu.org, "Bonface M. K." <bonfacemunyoki@gmail.com>
Cc: Pjotr Prins <pjotr2020@thebird.nl>
Subject: Re: How do you write a package's deps to a file?
Date: Tue, 01 Dec 2020 00:23:10 +0100	[thread overview]
Message-ID: <868saiwhsx.fsf@gmail.com> (raw)
In-Reply-To: <D5CB7294-94CA-4698-9612-F5609FAE8129@lepiller.eu>

Hi,

>>#+begin_src scheme
>>(add-after 'install 'create-dependency-file
>>                 (lambda* (#:key inputs outputs #:allow-other-keys)

[...]

>>                         (map (lambda (input)
>>                                (let ((name (car input)))
                                    (pk input)
>>                                  ,(package-version
>>                                    (specification->package name)) " | "

[...]

>>                              inputs)))
>>                       ))
>>                   ))
>>#+end_src
>>
>>That ^^ doesn't seem to work as I'd like it to. The output(truncated)
>>looks something like:

It is expected, as Julien explained.


Well, I have tried to uses modules in the builder in order to import
’specification->package’ but I failed.  There is still something a bit
unclear for me: the arguments #:modules vs ’use-modules’.  And for
example, I miss why

--8<---------------cut here---------------start------------->8---
    (arguments
     `(#:modules ((gnu packages))
…     
--8<---------------cut here---------------end--------------->8---

fails.  Moreover…

>>Notice that the version, home page and description
>>are repeated across rows. Herein lies my question:
>>How would you fetch the details of the inputs(like
>>version, home-page, description) etc etc from a
>>modifed phase. Do I need to create a closure from
>>which I can import the modules like say _(use (gnu
>>packages))_. How do I do that if that's the case?

…I am not convinced it is the right level to extract the
information you need since ’input’ is, e.g.,

  ;;; (("source" . "/gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz"))
  ;;; (("grep" . "/gnu/store/yhqc5imq7sn2sf9f48dj4gk12y4kw4s4-grep-3.4"))
  ;;; (("libc:static" . "/gnu/store/s3dcqzwqaakv1yx37by9chksdbkgih17-glibc-2.31-static"))
  
therefore you need ’specification->package’ to find back the package
mapping to the string in order to access the metadata (version,
home-page, etc.).  Aside the issue that some do not have corresponding
packages (source, libc:static for instance).  Aside the issue of
multiple versions, for instance compare the version of the ’gcc’ input
of ’hello’ returning the string “gcc” with:

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> (specification->package "gcc")
guix repl: package 'gcc' has been superseded by 'gcc-toolchain'
$1 = #<package gcc-toolchain@10.2.0 gnu/packages/commencement.scm:3836 7f3b72596640>
--8<---------------cut here---------------end--------------->8---


What do you want?  Get the list of inputs and their metadata when typing
“guix install foo”?  And this list becoming part of the outputs?  Or
simply get somehow the list of inputs and their metadata?  Which is
straightforward.


Well, I am interested by the answer of: is it possible to get the
metadata of the inputs in phases?

All the best,
simon


  reply	other threads:[~2020-11-30 23:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 16:25 How do you write a package's deps to a file? Bonface M. K.
2020-11-30 17:17 ` Julien Lepiller
2020-11-30 23:23   ` zimoun [this message]
2020-12-01  9:13     ` Bonface M. K.
2020-12-01  9:59       ` zimoun
2020-12-01 18:04         ` Bonface M. K.
2020-12-01  8:29   ` Bonface M. K.
2020-12-01  7:35 ` Efraim Flashner
2020-12-01  9:15   ` Bonface M. K.

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=868saiwhsx.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=bonfacemunyoki@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=julien@lepiller.eu \
    --cc=pjotr2020@thebird.nl \
    /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.