Subject: Re: [PATCH 05/20] build-system: minetest: Don't retain references to "bash-minimal".

From: Leo Prikler <[email-masked]>
Date: Thu, 05 Aug 2021 14:04:07 +0200

Hi,

Am Donnerstag, den 05.08.2021, 13:01 +0200 schrieb Maxime Devos:
> Hi,
> 
> The attached patch squashes "PATCH 04" and "PATCH 05" together
> and extends the build system.  It now has an install plan only
> installing
> what's necessary (Lua code, PNG images, some configuration files
> ...),
> a 'check' build phase verifying Minetest can actually load the mod,
> and a 'minimise-png' phase minimising PNG images.
> 
> The mod name for ‘(("." "share/minetest/mods/the-mod-name"))’ can now
> be determined exactly in most cases (Minetest doesn't really care but
> the directory name can appear in the GUI in some cases).
> 
> Greetings,
> Maxime.

> +mods, which consists of copying lua code, images and other resources
> to
s/lua/Lua/ :)

> +(define* (install #:key inputs #:allow-other-keys #:rest arguments)
> +  (apply (@@ (guix build copy-build-system) install)
> +         #:install-plan (mod-install-plan (apply guess-mod-name
> arguments))
> +         arguments))
@@ is a code smell, as far as Guix is concerned.  Rather import copy-
build-system with the copy: prefix.

> +(define png-file?
> +  ((@@ (guix build utils) file-header-match) %png-magic-bytes))
Likewise import (guix build utils) directly.

> +(define (lower-mod name . arguments)
> +  (define lower (build-system-lower gnu-build-system))
> +  (apply lower
> +         name
> +         #:imported-modules %minetest-build-system-modules
> +         #:modules %default-modules
> +         #:phases '%standard-phases
> +         #:implicit-inputs? #f
> +         ;; Mods are architecture-independent.
> +         #:target #f
> +         ;; Ensure nothing sneaks into the closure.
> +         #:allowed-references '()
> +         (substitute-keyword-arguments arguments
> +           ((#:native-inputs native-inputs '())
> +            (append native-inputs (standard-minetest-packages))))))
This appears a little confusing.  On first glance, it does not seem to
allow overriding e.g. #:phases, but on a second look using `apply'
together with shallowly substituted arguments would enable that.  The
only thing that's missing imo is that #:implicit-inputs? is not
honoured for (standard-minetest-packages) -- I think you might want to
rectify that.

Otherwise looks pretty good to me.