GNU bug report logs - #58230
[PATCH] build: copy-build-system: Add #:output filter.

Previous Next

Package: guix-patches;

Reported by: Hilton Chain <hako <at> ultrarare.space>

Date: Sat, 1 Oct 2022 15:48:02 UTC

Severity: normal

Tags: patch

Done: Hilton Chain <hako <at> ultrarare.space>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 58230 in the body.
You can then email your comments to 58230 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#58230; Package guix-patches. (Sat, 01 Oct 2022 15:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hilton Chain <hako <at> ultrarare.space>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 01 Oct 2022 15:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: guix-patches <at> gnu.org
Subject: [PATCH] build: copy-build-system: Add #:output filter.
Date: Sat, 01 Oct 2022 23:46:44 +0800
* guix/build/copy-build-system.scm (install): Add #:output filter.
---
 guix/build/copy-build-system.scm | 49 +++++++++++++++++++-------------
 1 file changed, 30 insertions(+), 19 deletions(-)

diff --git a/guix/build/copy-build-system.scm b/guix/build/copy-build-system.scm
index fb2d1db056..111032eed8 100644
--- a/guix/build/copy-build-system.scm
+++ b/guix/build/copy-build-system.scm
@@ -54,7 +54,7 @@ (define* (install #:key install-plan outputs #:allow-other-keys)
   - Without FILTERS, install the full SOURCE _content_ to TARGET.
     The paths relative to SOURCE are preserved within TARGET.
   - With FILTERS among `#:include`, `#:include-regexp`, `#:exclude`,
-    `#:exclude-regexp`:
+    `#:exclude-regexp`, `#:output`:
     - With `#:include`, install only the paths which suffix exactly matches
       one of the elements in the list.
     - With `#:include-regexp`, install subpaths matching the regexps in the list.
@@ -62,6 +62,8 @@ (define* (install #:key install-plan outputs #:allow-other-keys)
       install every subpath but the files matching the `#:exclude*` filters.
       If both `#:include*` and `#:exclude*` are specified, the exclusion is done
       on the inclusion list.
+    - With `#:output`, install into TARGET of every specified output(s), the
+      default value is \"out\".
 
 Examples:
 
@@ -72,7 +74,13 @@ (define* (install #:key install-plan outputs #:allow-other-keys)
 - `(\"foo/\" \"share/my-app\" #:include (\"sub/file\"))`: Install only \"foo/sub/file\" to
 \"share/my-app/sub/file\".
 - `(\"foo/sub\" \"share/my-app\" #:include (\"file\"))`: Install \"foo/sub/file\" to
-\"share/my-app/file\"."
+\"share/my-app/file\".
+-  As the previout example, when not specifying `#:output`: Install \"foo/sub/file\" to
+\"share/my-app/file\" of \"out\" output.
+- `(\"foo/sub\" \"share/my-app\" #:include (\"file\")) #:output (\"lib\")`: Install
+\"foo/sub/file\" to \"share/my-app/file\" of \"lib\" output.
+- `(\"foo/sub\" \"share/my-app\" #:include (\"file\")) #:output (\"out\"\"lib\")`:
+Install \"foo/sub/file\" to \"share/my-app/file\" of both \"out\" and \"lib\" outputs."
   (define (install-simple source target)
     "Install SOURCE to TARGET.
 TARGET must point to a store location.
@@ -133,23 +141,26 @@ (define* (install-file-list source target #:key include exclude include-regexp e
                                       (string-append target "/")))
              file-list))))
 
-  (define* (install source target #:key include exclude include-regexp exclude-regexp)
-    (let ((final-target (string-append (assoc-ref outputs "out") "/" target))
-          (filters? (or include exclude include-regexp exclude-regexp)))
-      (when (and (not (file-is-directory? source))
-                 filters?)
-        (error "Cannot use filters when SOURCE is a file."))
-      (let ((multi-files-in-source?
-             (or (string-suffix? "/" source)
-                 (and (file-is-directory? source)
-                      filters?))))
-        (if multi-files-in-source?
-            (install-file-list source final-target
-                               #:include include
-                               #:exclude exclude
-                               #:include-regexp include-regexp
-                               #:exclude-regexp exclude-regexp)
-            (install-simple source final-target)))))
+  (define* (install source target #:key include exclude include-regexp exclude-regexp (output '("out")))
+    (for-each
+     (lambda (out)
+       (let ((final-target (string-append (assoc-ref outputs out) "/" target))
+             (filters? (or include exclude include-regexp exclude-regexp)))
+         (when (and (not (file-is-directory? source))
+                    filters?)
+           (error "Cannot use filters when SOURCE is a file."))
+         (let ((multi-files-in-source?
+                (or (string-suffix? "/" source)
+                    (and (file-is-directory? source)
+                         filters?))))
+           (if multi-files-in-source?
+               (install-file-list source final-target
+                                  #:include include
+                                  #:exclude exclude
+                                  #:include-regexp include-regexp
+                                  #:exclude-regexp exclude-regexp)
+               (install-simple source final-target)))))
+     output))
 
   (for-each (lambda (plan) (apply install plan)) install-plan)
   #t)

base-commit: 225e00bd1925487fb045d9184fd249d93accad08
-- 
2.37.3





bug closed, send any further explanations to 58230 <at> debbugs.gnu.org and Hilton Chain <hako <at> ultrarare.space> Request was from Hilton Chain <hako <at> ultrarare.space> to control <at> debbugs.gnu.org. (Sat, 06 Jan 2024 06:08:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 03 Feb 2024 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 82 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.