all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: "Bonface M. K." <bonfacemunyoki@gmail.com>
Cc: help-guix@gnu.org, Pjotr Prins <pjotr2020@thebird.nl>
Subject: Re: How do you write a package's deps to a file?
Date: Tue, 1 Dec 2020 09:35:06 +0200	[thread overview]
Message-ID: <X8XyKjLaG4nEe+Kl@E5400> (raw)
In-Reply-To: <86mtyyzuag.fsf@gmail.com>

[-- 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 --]

  parent reply	other threads:[~2020-12-01  7:35 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
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 [this message]
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=X8XyKjLaG4nEe+Kl@E5400 \
    --to=efraim@flashner.co.il \
    --cc=bonfacemunyoki@gmail.com \
    --cc=help-guix@gnu.org \
    --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.