unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Reusing code for a build-phase?
@ 2023-08-05  8:25 Hartmut Goebel
  2023-08-06 12:49 ` Csepp
  2023-08-06 15:23 ` Bruno Victal
  0 siblings, 2 replies; 5+ messages in thread
From: Hartmut Goebel @ 2023-08-05  8:25 UTC (permalink / raw)
  To: Guix-devel

[-- Attachment #1: Type: text/html, Size: 3411 bytes --]

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

* Re: Reusing code for a build-phase?
  2023-08-05  8:25 Reusing code for a build-phase? Hartmut Goebel
@ 2023-08-06 12:49 ` Csepp
  2023-08-06 13:23   ` Hartmut Goebel
  2023-08-06 15:23 ` Bruno Victal
  1 sibling, 1 reply; 5+ messages in thread
From: Csepp @ 2023-08-06 12:49 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: guix-devel


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.


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

* Re: Reusing code for a build-phase?
  2023-08-06 12:49 ` Csepp
@ 2023-08-06 13:23   ` Hartmut Goebel
  2023-08-08  0:15     ` Csepp
  0 siblings, 1 reply; 5+ messages in thread
From: Hartmut Goebel @ 2023-08-06 13:23 UTC (permalink / raw)
  To: Csepp; +Cc: guix-devel

Am 06.08.23 um 14:49 schrieb Csepp:
> Maybe you could create a build system that inherits from the one these
> packages use, but adds the extra phase.

I was thinking about this, too. But this seems to be too much, as there 
are not hundreds of Vagrant plugins. Also a build-system requires 
documentation, wich is another pile of work.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |



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

* Re: Reusing code for a build-phase?
  2023-08-05  8:25 Reusing code for a build-phase? Hartmut Goebel
  2023-08-06 12:49 ` Csepp
@ 2023-08-06 15:23 ` Bruno Victal
  1 sibling, 0 replies; 5+ messages in thread
From: Bruno Victal @ 2023-08-06 15:23 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: Guix-devel

Hi Hartmut,

On 2023-08-05 09:25, Hartmut Goebel wrote:
> 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

I think using a procedure like you're suggesting here would be alright for this.
Perhaps <https://issues.guix.gnu.org/63081#8> could serve as inspiration?


-- 
Furthermore, I consider that nonfree software must be eradicated.

Cheers,
Bruno.



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

* Re: Reusing code for a build-phase?
  2023-08-06 13:23   ` Hartmut Goebel
@ 2023-08-08  0:15     ` Csepp
  0 siblings, 0 replies; 5+ messages in thread
From: Csepp @ 2023-08-08  0:15 UTC (permalink / raw)
  To: Hartmut Goebel; +Cc: Csepp, guix-devel


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

> Am 06.08.23 um 14:49 schrieb Csepp:
>> Maybe you could create a build system that inherits from the one these
>> packages use, but adds the extra phase.
>
> I was thinking about this, too. But this seems to be too much, as
> there are not hundreds of Vagrant plugins. Also a build-system
> requires documentation, wich is another pile of work.

There already are special purpose build systems, like the Minetest one.
I think you can just define it locally in the module and document it
with a comment, you don't necessarily have to make a module for it.
Alternatively you could write a function that modifies a package to add
the necessary phase.

I'm glad you brough this up, because I should test these ideas on my
MirageOS branch.  FWIW I think I'll go with the build system solution.


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

end of thread, other threads:[~2023-08-08  0:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-05  8:25 Reusing code for a build-phase? Hartmut Goebel
2023-08-06 12:49 ` Csepp
2023-08-06 13:23   ` Hartmut Goebel
2023-08-08  0:15     ` Csepp
2023-08-06 15:23 ` Bruno Victal

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