|
From: | Hartmut Goebel |
Subject: | Reusing code for a build-phase? |
Date: | Sat, 5 Aug 2023 10:25:45 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 |
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)))))))))))
-- Regards Hartmut Goebel | Hartmut Goebel | h.goebel@crazy-compilers.com | | www.crazy-compilers.com | compilers which you thought are impossible |
[Prev in Thread] | Current Thread | [Next in Thread] |