summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHilton Chain <hako@ultrarare.space>2022-10-01 23:46:44 +0800
committerGuix Patches Tester <>2022-11-18 12:47:41 +0100
commitf02e9a25d522c364a8aabddb37d60c21c393f55a (patch)
treeb3a8ca394e133f308e63147cbc9fb1b8e1c1bc34
parent983906ab72307a5b848a54233b30d9744356de07 (diff)
downloadguix-patches-f02e9a25d522c364a8aabddb37d60c21c393f55a.tar
guix-patches-f02e9a25d522c364a8aabddb37d60c21c393f55a.tar.gz
build: copy-build-system: Add #:output filter.issue-58230
* guix/build/copy-build-system.scm (install): Add #:output filter.
-rw-r--r--guix/build/copy-build-system.scm49
1 files 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 @@ In the above, FILTERS are optional.
- 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 @@ In the above, FILTERS are optional.
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 @@ Examples:
- `(\"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 @@ given, then the predicate always returns DEFAULT-VALUE."
(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)