unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Csepp <raingloom@riseup.net>
To: Hartmut Goebel <h.goebel@crazy-compilers.com>
Cc: guix-devel@gnu.org
Subject: Re: Reusing code for a build-phase?
Date: Sun, 06 Aug 2023 14:49:29 +0200	[thread overview]
Message-ID: <87wmy8jpww.fsf@riseup.net> (raw)
In-Reply-To: <68aacdad-ecd3-2e82-db4b-c9c85bb8e520@crazy-compilers.com>


Hartmut Goebel <h.goebel@crazy-compilers.com> writes:

> Hi,
>
> I'm currently packaging vagrant and some plugins. For all plugins an additional phase is required, generating a json file, see below. Since this is quite
> some code, I'd like to put it into some definition or some wrapper. Since it uses (this-package-verion), my attempts failed.
>
> At best, a plugin would then be defined like
>
>   (define-public vagrant-abc (vagrant-plugin-wrapper (package …
>
> Anyhow I'd be happy to when being able to use some function in the phase instead of duplicating the code.
>
> Any ideas? Many thanks in advance
>
>     (arguments
>      (list
>       #:tests? #f ; tests involve running vagrant and downloading a box
>       #:phases
>       #~(modify-phases %standard-phases
>           (add-after 'install 'install-plugin.json
>             (lambda _
>               (let* ((plugins.d (string-append
>                                  #$output "/share/vagrant-plugins/plugins.d"))
>                      (plugin.json (string-append
>                                    plugins.d "/" #$name ".json")))
>                 (mkdir-p plugins.d)
>                 #$(with-extensions (list guile-json-4)
>                     #~(begin
>                         (use-modules (json))
>                         (call-with-output-file plugin.json
>                           (lambda (port)
>                             (scm->json
>                              '((#$name
>                                 .
>                                 (("ruby_version"
>                                   . #$(package-version (this-package-input "ruby")))
>                                  ("vagrant_version"
>                                   . #$(package-version (this-package-input "vagrant")))
>                                  ("gem_version" .  "")
>                                  ("require" . "")
>                                  ("sources" . #()))))
>                              port)))))))))))

Maybe you could create a build system that inherits from the one these
packages use, but adds the extra phase.


  reply	other threads:[~2023-08-06 12:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-05  8:25 Reusing code for a build-phase? Hartmut Goebel
2023-08-06 12:49 ` Csepp [this message]
2023-08-06 13:23   ` Hartmut Goebel
2023-08-08  0:15     ` Csepp
2023-08-06 15:23 ` Bruno Victal

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=87wmy8jpww.fsf@riseup.net \
    --to=raingloom@riseup.net \
    --cc=guix-devel@gnu.org \
    --cc=h.goebel@crazy-compilers.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.
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).