all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Leo Prikler <leo.prikler@student.tugraz.at>, 49828@debbugs.gnu.org
Subject: [bug#49828] [PATCH 05/20] build-system: minetest: Don't retain references to "bash-minimal".
Date: Tue, 03 Aug 2021 13:59:16 +0200	[thread overview]
Message-ID: <265c85f914757066aee6b6933ba58bf1abd2bc84.camel@telenet.be> (raw)
In-Reply-To: <60c5062a7debff22cee27198c2548605fd7441e0.camel@student.tugraz.at>


[-- Attachment #1.1: Type: text/plain, Size: 2146 bytes --]

Leo Prikler schreef op di 03-08-2021 om 11:17 [+0200]:
> Hi,
> 
> I'd merge this and 04/20 into a single patch.  04/20 does of its own
> give a good incentive as to why a new build system is to be used (this
> could instead be handled by the importer), with this phase added it
> makes slightly more sense.

As an argument for having a 'minetest-mod-build-system', consider
some ways 'minetest-mod-build-system' could be improved in the future:

  * a phase could be added to minimise PNG images (e.g. using 'optipng')
  * likewise, for lua code
  * some basic tests could be added (e.g. creating a new world and
    loading the mod, testing that Minetest doesn't raise an error during
    mod loading)

Also, having "#:install-plan '(("." "share/minetest/mods/the-mod-name"))"
appear in every package definition seems rather repetitive to me.

The idea behind "04/20" and "05/20" being separate patches, is to start
with a basic "minetest-mod-build-system" and gradually improve it.
The small improvements (currently only one, i.e., 05/20) could be reviewed
separately from each other and whether there should be a
"minetest-mod-build-system" at all.

E.g., see attached a patch that sets #:allowed-references '(), ensuring
nothing sneaks into the closure.  Another change I'm thinking of, is including
only "tar", "gzip" and the like as implicit inputs, and not "bash" or "coreutils",
though that's probably useless if shebang patching has been disabled.

> OTOH, perhaps we shouldn't install those shell scripts in the first
> place?  Perhaps we can instead make the importer generate packages
> based directly on copy-build-system, in which those static strings are
> already evaluated.  WDYT?

Directly using 'copy-build-system' makes it more difficult to make the
improvements listed above. I don't know what you mean with ‘in which those
static strings are already evaluated’ -- what are ‘those static strings’ here?

I suppose it is possible to exclude shell scripts from installation, but
just installing everything (and disabling shebang patching) seems simpler.

Greetings,
Maxime.

[-- Attachment #1.2: 0001-build-system-copy-Support-allowed-references.patch --]
[-- Type: text/x-patch, Size: 2176 bytes --]

From eef6cb11a923458cba50bbc4e6440c0b2f372da2 Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximedevos@telenet.be>
Date: Tue, 3 Aug 2021 13:50:49 +0200
Subject: [PATCH 1/2] build-system/copy: Support #:allowed-references.

* guix/build-system/copy.scm
  (copy-build): Add #:allowed-references argument.
  (copy-build)[canonicalize-reference]: New procedure.
---
 guix/build-system/copy.scm | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/copy.scm b/guix/build-system/copy.scm
index d1bf8fb654..1cd0a95150 100644
--- a/guix/build-system/copy.scm
+++ b/guix/build-system/copy.scm
@@ -92,8 +92,22 @@
                      (system (%current-system))
                      (imported-modules %copy-build-system-modules)
                      (modules '((guix build copy-build-system)
-                                (guix build utils))))
+                                (guix build utils)))
+                     allowed-references)
   "Build SOURCE using INSTALL-PLAN, and with INPUTS."
+  ;; XXX: procedure copied from (guix build-system gnu)
+  (define canonicalize-reference
+    (match-lambda
+     ((? package? p)
+      (derivation->output-path (package-derivation store p system
+                                                   #:graft? #f)))
+     (((? package? p) output)
+      (derivation->output-path (package-derivation store p system
+                                                   #:graft? #f)
+                               output))
+     ((? string? output)
+      output)))
+
   (define builder
     `(begin
        (use-modules ,@modules)
@@ -131,6 +145,10 @@
                                 #:system system
                                 #:inputs inputs
                                 #:modules imported-modules
+                                #:allowed-references
+                                (and allowed-references
+                                     (map canonicalize-reference
+                                          allowed-references))
                                 #:outputs outputs
                                 #:guile-for-build guile-for-build))
 
-- 
2.32.0


[-- Attachment #1.3: 0002-build-system-minetest-Don-t-let-anything-sneak-into-.patch --]
[-- Type: text/x-patch, Size: 901 bytes --]

From f383aa1c886701631f6ae924a93e13cdad2eaa59 Mon Sep 17 00:00:00 2001
From: Maxime Devos <maximedevos@telenet.be>
Date: Tue, 3 Aug 2021 13:52:37 +0200
Subject: [PATCH 2/2] build-system/minetest: Don't let anything sneak into the
 closure.

* guix/build-system/minetest.scm (lower-mod): Set #:allowed-references
  to the empty list.
---
 guix/build-system/minetest.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/guix/build-system/minetest.scm b/guix/build-system/minetest.scm
index 993c5631eb..1d63e5ffcf 100644
--- a/guix/build-system/minetest.scm
+++ b/guix/build-system/minetest.scm
@@ -51,6 +51,8 @@
     `'(("." ,(string-append "share/minetest/mods/"
                             (guix-name->mod-name name))))
     #:phases %standard-phases
+    ;; Ensure nothing sneaks into the closure.
+    #:allowed-references '()
     arguments))
 
 (define minetest-mod-build-system
-- 
2.32.0


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  reply	other threads:[~2021-08-03 12:00 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02 15:46 [bug#49828] [PATCH 00/20] Add minetest mods Maxime Devos
2021-08-02 15:50 ` [bug#49828] [PATCH 01/20] gnu: minetest: Respect --without-tests Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 02/20] gnu: minetest: Search for mods in MINETEST_MOD_PATH Maxime Devos
2021-08-02 17:28     ` Leo Prikler
2021-08-02 17:53       ` Maxime Devos
2021-08-02 18:47         ` Leo Prikler
2021-08-03 11:09           ` Maxime Devos
2021-08-03 11:10             ` Maxime Devos
2021-08-03 11:54               ` Leo Prikler
2021-08-02 15:50   ` [bug#49828] [PATCH 03/20] gnu: minetest: New package module Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 04/20] build-system: Add 'minetest-mod-build-system' Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 05/20] build-system: minetest: Don't retain references to "bash-minimal" Maxime Devos
2021-08-03  9:17     ` Leo Prikler
2021-08-03 11:59       ` Maxime Devos [this message]
2021-08-03 12:28         ` Leo Prikler
2021-08-05 11:01           ` Maxime Devos
2021-08-05 12:04             ` Leo Prikler
2021-08-05 13:16               ` Maxime Devos
2021-08-05 13:42                 ` Leo Prikler
2021-08-05 14:41                   ` Maxime Devos
2021-08-05 15:15                     ` Leo Prikler
2021-08-02 15:50   ` [bug#49828] [PATCH 06/20] guix: Add ContentDB importer Maxime Devos
2021-08-05 16:41     ` Leo Prikler
2021-08-07 18:31       ` Maxime Devos
2021-08-07 19:47         ` Leo Prikler
2021-08-09 20:00           ` [bug#49828] [PATCH 06/20] guix: Add ContentDB importer. (XXX Don't send yet) Maxime Devos
2021-08-09 20:04             ` Maxime Devos
2021-08-09 21:45             ` [bug#49828] [PATCH 06/20] guix: Add ContentDB importer. (XXX Yes send now) Leo Prikler
2021-08-10 11:02               ` [bug#49828] [PATCH 06/20] guix: Add ContentDB importer Maxime Devos
2021-08-10 12:16                 ` Leo Prikler
2021-08-10 15:07                 ` [bug#49828] [PATCH v3 00/20] Add minetest mods Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 01/20] gnu: minetest: Respect --without-tests Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 02/20] gnu: minetest: Search for mods in MINETEST_MOD_PATH Maxime Devos
2021-08-20 11:45                     ` bug#49828: " Leo Prikler
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 03/20] gnu: minetest: New package module Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 04/20] build-system: Add 'minetest-mod-build-system' Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 05/20] import/utils: Recognise GPL-3.0-or-later and friends Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 06/20] guix: Add ContentDB importer Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 07/20] gnu: Add minetest-mesecons Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 08/20] gnu: Add minetest-basic-materials Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 09/20] gnu: Add minetest-unifieddyes Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 10/20] gnu: Add minetest-pipeworks Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 11/20] gnu: Add minetest-coloredwood Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 12/20] gnu: Add minetest-ethereal Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 13/20] gnu: Add minetest-technic Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 14/20] gnu: Add minetest-throwing Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 15/20] gnu: Add minetest-throwing-arrows Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 16/20] gnu: Add minetest-unified-inventory Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 17/20] gnu: Add minetest-worldedit Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 18/20] gnu: Add minetest-mobs Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 19/20] gnu: Add minetest-mobs-animal Maxime Devos
2021-08-10 15:07                   ` [bug#49828] [PATCH v3 20/20] gnu: Add minetest-homedecor-modpack Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 07/20] gnu: Add minetest-mesecons Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 08/20] gnu: Add minetest-basic-materials Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 09/20] gnu: Add minetest-unifieddyes Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 10/20] gnu: Add minetest-pipeworks Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 11/20] gnu: Add minetest-coloredwood Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 12/20] gnu: Add minetest-ethereal Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 13/20] gnu: Add minetest-technic Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 14/20] gnu: Add minetest-throwing Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 15/20] gnu: Add minetest-throwing-arrows Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 16/20] gnu: Add minetest-unified-inventory Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 17/20] gnu: Add minetest-worldedit Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 18/20] gnu: Add minetest-mobs Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 19/20] gnu: Add minetest-mobs-animal Maxime Devos
2021-08-02 15:50   ` [bug#49828] [PATCH 20/20] gnu: Add minetest-homedecor-modpack Maxime Devos
2021-08-02 17:14   ` [bug#49828] [PATCH 01/20] gnu: minetest: Respect --without-tests Leo Prikler
2021-08-02 17:18     ` Maxime Devos
2021-08-02 17:22       ` Leo Prikler
2021-08-05 12:46 ` [bug#49828] [PATCH 00/20] Add minetest mods Andrew Ward
2021-08-05 21:10   ` Maxime Devos

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=265c85f914757066aee6b6933ba58bf1abd2bc84.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=49828@debbugs.gnu.org \
    --cc=leo.prikler@student.tugraz.at \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.