unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#57717] [DRAFT PATCH core-updates] build-systems: Pass #:allowed-references and #:disallowed-references to builders.
@ 2022-09-10 15:26 Marius Bakke
  2022-09-10 16:27 ` Maxime Devos
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Marius Bakke @ 2022-09-10 15:26 UTC (permalink / raw)
  To: 57717; +Cc: Ludovic Courtès

* guix/build-system/gnu.scm (gnu-build, gnu-cross-build)[builder]: Pass
along #:allowed-references and #:disallowed-references.
* guix/build-system/meson.scm (meson-build, meson-cross-build)[builder]: Likewise.
---
Hello Guix,

This is an untested patch that makes #:allowed-references
and #:disallowed-references available to build-side code.

The intention is to make it easier to use these properties directly when
e.g. wrapping.  Consider the following:

--8<---------------cut here---------------start------------->8---
(arguments
 (list
  #:disallowed-references (list (gexp-input glib "bin")
                                (gexp-input inkscape/stable))
  #:phases
  #~(modify-phases %standard-phases
     (replace 'glib-or-gtk-wrap
       (let ((wrap (assoc-ref %standard-phases 'glib-or-gtk-wrap)))
         (lambda* (#:key inputs outputs disallowed-references
                   #:allow-other-keys)
                 (wrap #:inputs (filter (match-lambda
                                          ((label . output)
                                           (not (member output
                                                        disallowed-references))))
                                        inputs)
                       #:outputs outputs)))))))
--8<---------------cut here---------------end--------------->8---

This way we don't have to build the list of disallowed references twice,
which is difficult without labels in the case of e.g. `(,glib "bin").

Note: I implemented a variant of this approach using a let-binding in
f0114656876dcf2e09874e4ea0c00cacf31f1bb2, perhaps that is "good enough"
as this approach is unlikely to be much used.

WDYT?  I'll implement this for the remaining build systems if this is at
all sane.
---


diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index 8eea1cd4c2..f85a172153 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -393,6 +393,8 @@ (define builder
                            #:build #$build
                            #:outputs %outputs
                            #:inputs %build-inputs
+                           #:allowed-references #$allowed-references
+                           #:disallowed-references #$disallowed-references
                            #:search-paths '#$(sexp->gexp
                                               (map search-path-specification->sexp
                                                    search-paths))
@@ -531,6 +533,8 @@ (define %outputs
                    #:target #$target
                    #:outputs %outputs
                    #:inputs %build-target-inputs
+                   #:allowed-references #$allowed-references
+                   #:disallowed-references #$disallowed-references
                    #:native-inputs %build-host-inputs
                    #:search-paths '#$(sexp->gexp
                                       (map search-path-specification->sexp
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm
index 9fee6c4570..1bef07230f 100644
--- a/guix/build-system/meson.scm
+++ b/guix/build-system/meson.scm
@@ -210,6 +210,8 @@ (define build-phases
           #$(with-build-variables inputs outputs
               #~(meson-build #:source #+source
                              #:system #$system
+                             #:allowed-references #$allowed-references
+                             #:disallowed-references #$disallowed-references
                              #:outputs %outputs
                              #:inputs %build-inputs
                              #:search-paths '#$(sexp->gexp
@@ -318,6 +320,8 @@ (define build-phases
                        #:system #$system
                        #:build #$(nix-system->gnu-triplet system)
                        #:target #$target
+                       #:allowed-references #$allowed-references
+                       #:disallowed-references #$disallowed-references
                        #:outputs #$(outputs->gexp outputs)
                        #:inputs #$inputs
                        #:native-inputs #+(input-tuples->gexp build-inputs)
-- 
2.37.3





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

end of thread, other threads:[~2022-09-11 14:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-10 15:26 [bug#57717] [DRAFT PATCH core-updates] build-systems: Pass #:allowed-references and #:disallowed-references to builders Marius Bakke
2022-09-10 16:27 ` Maxime Devos
2022-09-10 16:32 ` Maxime Devos
2022-09-10 16:34   ` Maxime Devos
2022-09-11 14:12 ` Ludovic Courtès

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