all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How do you write a package's deps to a file?
@ 2020-11-30 16:25 Bonface M. K.
  2020-11-30 17:17 ` Julien Lepiller
  2020-12-01  7:35 ` Efraim Flashner
  0 siblings, 2 replies; 9+ messages in thread
From: Bonface M. K. @ 2020-11-30 16:25 UTC (permalink / raw)
  To: help-guix; +Cc: Pjotr Prins

[-- Attachment #1: Type: text/plain, Size: 6662 bytes --]


Hi guix! I want to output the deps of a package to
a writable file. Like say the "hello" world
package, I'd like to insert a file after, say the
install phase, so that later I could parse it and
serve it from a website. Here's a snip of what I
have:

#+begin_src scheme
(add-after 'install 'create-dependency-file
                 (lambda* (#:key inputs outputs #:allow-other-keys)
                   (call-with-output-file
                       (string-append
                        (assoc-ref outputs "out")
                        "/lib/python3.8/site-packages"
                        "/wqflask/DEPENDENCIES.txt")
                     (lambda (port)
                       (format
                        port "
#### System Inputs (generated from Guix)
|Name | Version | Home Page | Description |
|-----|---------|-----------|-------------|
|~a|
"
                        (apply
                         string-append
                         (map (lambda (input)
                                (let ((name (car input)))
                                  (string-append
                                   "| **" name "** | "
                                   ,(package-version
                                     (specification->package name)) " | "
                                   ,(package-home-page
                                     (specification->package name))
                                   " |"
                                   ,(package-description
                                     (specification->package name))
                                   " |\n")))
                              inputs)))
                       ))
                   ))
#+end_src

That ^^ doesn't seem to work as I'd like it to. The output(truncated)
looks something like:
                            
#+begin_src markdown
➜  guix git:(master) ✗ cat ~/opt/python3-genenetwork2/lib/python3.8/site-packages/wqflask/DEPENDENCIES.txt


 #### System Inputs (generated from Guix)
|Name | Version | Home Page | Description |
|-----|---------|-----------|-------------|
|| **python** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **source** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-colorbox** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **coreutils** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **git** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **which** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **grep** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **r** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **r-ctl** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **r-qtl** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **r-wgcna** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **redis** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **mariadb** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **gemma** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **gemma-wrapper** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **plink-ng-gn** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **racket-minimal** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **rust-qtlreaper** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **nginx** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **python-twint** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **python-unittest2** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-twitter-post-fetcher** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-cytoscape** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-panzoom** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-qtip** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-chroma** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-d3-tip** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-jscolor** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-colorbox** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-jszip** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **js-jstat** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **js-md5** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **js-parsley** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-plotly** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-typeahead** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **js-underscore** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **js-smart-time-ago** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
| **javascript-nouislider** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
#+end_src

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?

Is it also possible to get the same information in
a fine grained manner, like say get the
propagated-inputs instead of getting /all/ inputs?

-- 
Bonface M. K. <https://www.bonfacemunyoki.com>
Chief Emacs Bazu / Rieng ya software sare
Mchochezi of: <https://upbookclub.com> / Twitter: @BonfaceKilz
GPG Key: D4F09EB110177E03C28E2FE1F5BBAE1E0392253F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 869 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How do you write a package's deps to a file?
  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
  2020-12-01  8:29   ` Bonface M. K.
  2020-12-01  7:35 ` Efraim Flashner
  1 sibling, 2 replies; 9+ messages in thread
From: Julien Lepiller @ 2020-11-30 17:17 UTC (permalink / raw)
  To: help-guix, Bonface M. K.; +Cc: Pjotr Prins

The reason you always get the same data is because you're assigning "name" inside the sexp (build-side), but you're using it inside tge unquote (host-side), so it refers to the name of the package you're building.

I think you're doing it wrong, because some input names have no corresponding package (see source for instance). Why not use the package data directly, like guix graph does for instance?

Le 30 novembre 2020 11:25:11 GMT-05:00, "Bonface M. K." <bonfacemunyoki@gmail.com> a écrit :
>
>Hi guix! I want to output the deps of a package to
>a writable file. Like say the "hello" world
>package, I'd like to insert a file after, say the
>install phase, so that later I could parse it and
>serve it from a website. Here's a snip of what I
>have:
>
>#+begin_src scheme
>(add-after 'install 'create-dependency-file
>                 (lambda* (#:key inputs outputs #:allow-other-keys)
>                   (call-with-output-file
>                       (string-append
>                        (assoc-ref outputs "out")
>                        "/lib/python3.8/site-packages"
>                        "/wqflask/DEPENDENCIES.txt")
>                     (lambda (port)
>                       (format
>                        port "
>#### System Inputs (generated from Guix)
>|Name | Version | Home Page | Description |
>|-----|---------|-----------|-------------|
>|~a|
>"
>                        (apply
>                         string-append
>                         (map (lambda (input)
>                                (let ((name (car input)))
>                                  (string-append
>                                   "| **" name "** | "
>                                   ,(package-version
>                                   (specification->package name)) " | "
>                                   ,(package-home-page
>                                     (specification->package name))
>                                   " |"
>                                   ,(package-description
>                                     (specification->package name))
>                                   " |\n")))
>                              inputs)))
>                       ))
>                   ))
>#+end_src
>
>That ^^ doesn't seem to work as I'd like it to. The output(truncated)
>looks something like:
>                            
>#+begin_src markdown
>➜  guix git:(master) ✗ cat
>~/opt/python3-genenetwork2/lib/python3.8/site-packages/wqflask/DEPENDENCIES.txt
>
>
> #### System Inputs (generated from Guix)
>|Name | Version | Home Page | Description |
>|-----|---------|-----------|-------------|
>|| **python** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **source** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork
>installation sumo. |
>| **javascript-colorbox** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **coreutils** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **git** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork
>installation sumo. |
>| **which** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork
>installation sumo. |
>| **grep** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork
>installation sumo. |
>| **r** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork
>installation sumo. |
>| **r-ctl** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork
>installation sumo. |
>| **r-qtl** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork
>installation sumo. |
>| **r-wgcna** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **redis** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork
>installation sumo. |
>| **mariadb** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **gemma** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork
>installation sumo. |
>| **gemma-wrapper** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **plink-ng-gn** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **racket-minimal** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **rust-qtlreaper** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **nginx** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork
>installation sumo. |
>| **python-twint** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **python-unittest2** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **javascript-twitter-post-fetcher** | 3.11-guix-84cbf35 |
>http://genenetwork.org/ |Genenetwork installation sumo. |
>| **javascript-cytoscape** | 3.11-guix-84cbf35 |
>http://genenetwork.org/ |Genenetwork installation sumo. |
>| **javascript-panzoom** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **javascript-qtip** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **javascript-chroma** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **javascript-d3-tip** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **javascript-jscolor** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **javascript-colorbox** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **javascript-jszip** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **js-jstat** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **js-md5** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork
>installation sumo. |
>| **js-parsley** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **javascript-plotly** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **javascript-typeahead** | 3.11-guix-84cbf35 |
>http://genenetwork.org/ |Genenetwork installation sumo. |
>| **js-underscore** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **js-smart-time-ago** | 3.11-guix-84cbf35 | http://genenetwork.org/
>|Genenetwork installation sumo. |
>| **javascript-nouislider** | 3.11-guix-84cbf35 |
>http://genenetwork.org/ |Genenetwork installation sumo. |
>#+end_src
>
>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?
>
>Is it also possible to get the same information in
>a fine grained manner, like say get the
>propagated-inputs instead of getting /all/ inputs?
>
>-- 
>Bonface M. K. <https://www.bonfacemunyoki.com>
>Chief Emacs Bazu / Rieng ya software sare
>Mchochezi of: <https://upbookclub.com> / Twitter: @BonfaceKilz
>GPG Key: D4F09EB110177E03C28E2FE1F5BBAE1E0392253F

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How do you write a package's deps to a file?
  2020-11-30 17:17 ` Julien Lepiller
@ 2020-11-30 23:23   ` zimoun
  2020-12-01  9:13     ` Bonface M. K.
  2020-12-01  8:29   ` Bonface M. K.
  1 sibling, 1 reply; 9+ messages in thread
From: zimoun @ 2020-11-30 23:23 UTC (permalink / raw)
  To: Julien Lepiller, help-guix, Bonface M. K.; +Cc: Pjotr Prins

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How do you write a package's deps to a file?
  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-12-01  7:35 ` Efraim Flashner
  2020-12-01  9:15   ` Bonface M. K.
  1 sibling, 1 reply; 9+ messages in thread
From: Efraim Flashner @ 2020-12-01  7:35 UTC (permalink / raw)
  To: Bonface M. K.; +Cc: help-guix, Pjotr Prins

[-- Attachment #1: Type: text/plain, Size: 7113 bytes --]

On Mon, Nov 30, 2020 at 07:25:11PM +0300, Bonface M. K. wrote:
> 
> Hi guix! I want to output the deps of a package to
> a writable file. Like say the "hello" world
> package, I'd like to insert a file after, say the
> install phase, so that later I could parse it and
> serve it from a website. Here's a snip of what I
> have:
> 
> #+begin_src scheme
> (add-after 'install 'create-dependency-file
>                  (lambda* (#:key inputs outputs #:allow-other-keys)
>                    (call-with-output-file
>                        (string-append
>                         (assoc-ref outputs "out")
>                         "/lib/python3.8/site-packages"
>                         "/wqflask/DEPENDENCIES.txt")
>                      (lambda (port)
>                        (format
>                         port "
> #### System Inputs (generated from Guix)
> |Name | Version | Home Page | Description |
> |-----|---------|-----------|-------------|
> |~a|
> "
>                         (apply
>                          string-append
>                          (map (lambda (input)
>                                 (let ((name (car input)))
>                                   (string-append
>                                    "| **" name "** | "
>                                    ,(package-version
>                                      (specification->package name)) " | "
>                                    ,(package-home-page
>                                      (specification->package name))
>                                    " |"
>                                    ,(package-description
>                                      (specification->package name))
>                                    " |\n")))
>                               inputs)))
>                        ))
>                    ))
> #+end_src
> 
> That ^^ doesn't seem to work as I'd like it to. The output(truncated)
> looks something like:
>                             
> #+begin_src markdown
> ➜  guix git:(master) ✗ cat ~/opt/python3-genenetwork2/lib/python3.8/site-packages/wqflask/DEPENDENCIES.txt
> 
> 
>  #### System Inputs (generated from Guix)
> |Name | Version | Home Page | Description |
> |-----|---------|-----------|-------------|
> || **python** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **source** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-colorbox** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **coreutils** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **git** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **which** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **grep** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **r** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **r-ctl** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **r-qtl** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **r-wgcna** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **redis** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **mariadb** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **gemma** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **gemma-wrapper** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **plink-ng-gn** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **racket-minimal** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **rust-qtlreaper** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **nginx** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **python-twint** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **python-unittest2** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-twitter-post-fetcher** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-cytoscape** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-panzoom** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-qtip** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-chroma** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-d3-tip** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-jscolor** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-colorbox** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-jszip** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **js-jstat** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **js-md5** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **js-parsley** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-plotly** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-typeahead** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **js-underscore** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **js-smart-time-ago** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> | **javascript-nouislider** | 3.11-guix-84cbf35 | http://genenetwork.org/ |Genenetwork installation sumo. |
> #+end_src
> 
> 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?
> 
> Is it also possible to get the same information in
> a fine grained manner, like say get the
> propagated-inputs instead of getting /all/ inputs?
> 

I think it would be easiest to compute this outside the package
definition and then add it as an input and just plop the precomputed
file into place in a custom phase.


-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How do you write a package's deps to a file?
  2020-11-30 17:17 ` Julien Lepiller
  2020-11-30 23:23   ` zimoun
@ 2020-12-01  8:29   ` Bonface M. K.
  1 sibling, 0 replies; 9+ messages in thread
From: Bonface M. K. @ 2020-12-01  8:29 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: help-guix, Pjotr Prins

[-- Attachment #1: Type: text/plain, Size: 993 bytes --]

Hi!

Julien Lepiller <julien@lepiller.eu> writes:

> The reason you always get the same data is because
> you're assigning "name" inside the sexp
> (build-side), but you're using it inside tge
> unquote (host-side), so it refers to the name of
> the package you're building.
>

Ah yes! I see that now. Silly me ~.~

> I think you're doing it wrong, because some input
> names have no corresponding package (see source
> for instance). Why not use the package data
> directly, like guix graph does for instance?
>

I don't know how to do this. I've had a look at
guix/graph.scm and scripts/graph.scm... And I got
lost--- I'm not /yet/ a scheme guru... I reckon
I'll go with Efraim's suggestion which seems
easier to do :)

Thanks for the pointers!

[...]
-- 
Bonface M. K. <https://www.bonfacemunyoki.com>
Chief Emacs Bazu / Rieng ya software sare
Mchochezi of: <https://upbookclub.com> / Twitter: @BonfaceKilz
GPG Key: D4F09EB110177E03C28E2FE1F5BBAE1E0392253F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 869 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How do you write a package's deps to a file?
  2020-11-30 23:23   ` zimoun
@ 2020-12-01  9:13     ` Bonface M. K.
  2020-12-01  9:59       ` zimoun
  0 siblings, 1 reply; 9+ messages in thread
From: Bonface M. K. @ 2020-12-01  9:13 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix, Pjotr Prins

[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]

Hi!

zimoun <zimon.toutoune@gmail.com> writes:

[...]
> …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:
>
> 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>
>

I sse that now. Thanks for pointing that out.

>
> 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.
>

Yes! Ideally I want to get details of the package
inputs, so that I could use that info to write to
a file somewhere in the outputs dir. The end goal
is to use that file to display (on some website)
the dependencies the project has. So when you do,
say, `guix install <my-awesome-package>`, as part
of your outputs, you also generate a file that
explicitly list the deps as part of your output ;)

>
> Well, I am interested by the answer of: is it possible to get the
>

I think Efraim's suggestion in this thread is more
pragmatic ;)

> All the best,
> simon
>

-- 
Bonface M. K. <https://www.bonfacemunyoki.com>
Chief Emacs Bazu / Rieng ya software sare
Mchochezi of: <https://upbookclub.com> / Twitter: @BonfaceKilz
GPG Key: D4F09EB110177E03C28E2FE1F5BBAE1E0392253F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 869 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How do you write a package's deps to a file?
  2020-12-01  7:35 ` Efraim Flashner
@ 2020-12-01  9:15   ` Bonface M. K.
  0 siblings, 0 replies; 9+ messages in thread
From: Bonface M. K. @ 2020-12-01  9:15 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: help-guix, Pjotr Prins

[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]

Hi Efraim!

Efraim Flashner <efraim@flashner.co.il> writes:

[...]
>> 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?
>> 
>> Is it also possible to get the same information in
>> a fine grained manner, like say get the
>> propagated-inputs instead of getting /all/ inputs?
>> 
>
> I think it would be easiest to compute this outside the package
> definition and then add it as an input and just plop the precomputed
> file into place in a custom phase.

Yes! I think this will do it for this case. Would
never have thought of that! Thanks!

-- 
Bonface M. K. <https://www.bonfacemunyoki.com>
Chief Emacs Bazu / Rieng ya software sare
Mchochezi of: <https://upbookclub.com> / Twitter: @BonfaceKilz
GPG Key: D4F09EB110177E03C28E2FE1F5BBAE1E0392253F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 869 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How do you write a package's deps to a file?
  2020-12-01  9:13     ` Bonface M. K.
@ 2020-12-01  9:59       ` zimoun
  2020-12-01 18:04         ` Bonface M. K.
  0 siblings, 1 reply; 9+ messages in thread
From: zimoun @ 2020-12-01  9:59 UTC (permalink / raw)
  To: Bonface M. K.; +Cc: help-guix, Pjotr Prins

Hi,

On Tue, 01 Dec 2020 at 12:13, "Bonface M. K." <bonfacemunyoki@gmail.com> wrote:

>> 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.
>>
>
> Yes! Ideally I want to get details of the package
> inputs, so that I could use that info to write to
> a file somewhere in the outputs dir. The end goal
> is to use that file to display (on some website)
> the dependencies the project has. So when you do,
> say, `guix install <my-awesome-package>`, as part
> of your outputs, you also generate a file that
> explicitly list the deps as part of your output ;)
>
>>
>> Well, I am interested by the answer of: is it possible to get the
>>
>
> I think Efraim's suggestion in this thread is more
> pragmatic ;)

The Efraim’s suggestion–also the Julien’s suggestion about use the
package data directly– is not what you are describing above.  It is
“simply get somehow the list of inputs and their metadata, which is
straightforward.” :-)

Basically, first step you run “./pre-inst-env guix repl -- script.scm”
which contains ’package-inputs’ (or any other ’package-direct-inputs’,
’package-propagated-inputs’, etc.) with formatting and second step you
manually add to the package this generated file in one phase to get it
in the output.

The file ’script.scm’ is more or less one illustration in this blog
post:

<https://guix.gnu.org/en/blog/2020/reproducible-computations-with-guix/>


Now, is it possible to embed this first step in the package definition
as an extra phase and run it via ’invoke’ or similar?


(And I am still interested by the answer of «is it possible to get the
metadata of the inputs in phases?» :-))

All the best,
simon


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: How do you write a package's deps to a file?
  2020-12-01  9:59       ` zimoun
@ 2020-12-01 18:04         ` Bonface M. K.
  0 siblings, 0 replies; 9+ messages in thread
From: Bonface M. K. @ 2020-12-01 18:04 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix, Pjotr Prins

[-- Attachment #1: Type: text/plain, Size: 2320 bytes --]

Hi all!

Was finally able to hack something that
works! See below:

zimoun <zimon.toutoune@gmail.com> writes:
>
> (And I am still interested by the answer of «is it possible to get the
> metadata of the inputs in phases?» :-))
>

Yes it's possible. The trick is to use
"this-package" which can *only* be used inside a
package definition and no where else. Stumbled
across that when poring through some guix package
definitions, moreso skriblio.

Here's my working phase:
--8<---------------cut here---------------start------------->8---
(add-after 'install 'generate-dependency-file
                 (lambda* (#:key inputs outputs #:allow-other-keys)
                   (call-with-output-file
                       (string-append
                        (assoc-ref outputs "out")
                        "/lib/python3.8/site-packages"
                        "/wqflask/DEPENDENCIES.md")
                     (lambda (port)
                       (format
                        port "
#### System Inputs (generated from Guix)
|Name | Version | Home Page | Description |
|-----|---------|-----------|-------------|
|~a|
"
                        ,(apply
                          string-append 
                          (map
                           (lambda (input)
                             (let* ((pkg (cadr input))
                                    (name (package-name pkg))
                                    (version (package-version pkg))
                                    (home-page (package-home-page pkg))
                                    (description (package-description pkg)))
                               (string-append
                                "| **" name "** | "
                                version " | "
                                home-page " | "
                                description " | "
                                " |\n")))
                              (package-propagated-inputs this-package)))))
                     )))
--8<---------------cut here---------------end--------------->8---

-- 
Bonface M. K. <https://www.bonfacemunyoki.com>
Chief Emacs Bazu / Rieng ya software sare
Mchochezi of: <https://upbookclub.com> / Twitter: @BonfaceKilz
GPG Key: D4F09EB110177E03C28E2FE1F5BBAE1E0392253F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 869 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-12-01 18:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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.

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.