unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: "Bonface M. K." <bonfacemunyoki@gmail.com>
To: zimoun <zimon.toutoune@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, 01 Dec 2020 21:04:22 +0300	[thread overview]
Message-ID: <86czzto121.fsf@gmail.com> (raw)
In-Reply-To: <86y2ihvocy.fsf@gmail.com> (zimoun's message of "Tue, 01 Dec 2020 10:59:09 +0100")

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

  reply	other threads:[~2020-12-01 18:04 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. [this message]
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

  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=86czzto121.fsf@gmail.com \
    --to=bonfacemunyoki@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=pjotr2020@thebird.nl \
    --cc=zimon.toutoune@gmail.com \
    /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.
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).