From patchwork Sat Oct 1 15:46:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 43096 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 660E927BBEB; Sat, 1 Oct 2022 16:48:14 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 12ABE27BBEA for ; Sat, 1 Oct 2022 16:48:13 +0100 (BST) Received: from localhost ([::1]:35966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeeiq-0001Pn-8k for patchwork@mira.cbaines.net; Sat, 01 Oct 2022 11:48:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeeih-0001Pc-9L for guix-patches@gnu.org; Sat, 01 Oct 2022 11:48:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46521) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oeeig-00013R-M9 for guix-patches@gnu.org; Sat, 01 Oct 2022 11:48:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oeeig-0002xe-HY for guix-patches@gnu.org; Sat, 01 Oct 2022 11:48:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58230] [PATCH] build: copy-build-system: Add #:output filter. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 01 Oct 2022 15:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58230 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58230@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166463925011239 (code B ref -1); Sat, 01 Oct 2022 15:48:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Oct 2022 15:47:30 +0000 Received: from localhost ([127.0.0.1]:45599 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeeiA-0002vD-07 for submit@debbugs.gnu.org; Sat, 01 Oct 2022 11:47:30 -0400 Received: from lists.gnu.org ([209.51.188.17]:44288) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeei8-0002v5-13 for submit@debbugs.gnu.org; Sat, 01 Oct 2022 11:47:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeei7-0001Ng-Rw for guix-patches@gnu.org; Sat, 01 Oct 2022 11:47:27 -0400 Received: from mail.boiledscript.com ([144.168.59.46]:57556) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeei6-0000yB-7N for guix-patches@gnu.org; Sat, 01 Oct 2022 11:47:27 -0400 Date: Sat, 01 Oct 2022 23:46:44 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1664639240; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Tsn4ewYFUTqURAFbzVi0bM7oHXrRVTRFUc75WouV60E=; b=u5gesgngeI8YM+xESfE+kFZvkEz53XuZohPkqcpv2FBGYH+Lsk2SoZediMSvzK/sU2UMGW Fbzzhs341GeM6CDT1CnPE5xZjiHRA5tXc2+LEMo1f/jUKSslCvscxOP2FINDUhmzYZotIN J0eWzGCwUF/fTsvigweOdnKwQuUxW1YiR59EUAB1DDBQgVyGC5YFWwfFDLlLLwSL/DVSFi 81MhWDrn9QNsJsRj8jV/d1MmHdhRWcxNvkiePP+S5vE1LjyjMNqholuU9moPU0850L0IAt eMTNAKYMoeCl3s1mua/o4FJvxWXW8uq84ZBa0mrS+dc4vYr0qnfx4jQ88PrbBg== Message-ID: MIME-Version: 1.0 Authentication-Results: mail.boiledscript.com; auth=pass smtp.mailfrom=hako@ultrarare.space X-Spamd-Bar: / Received-SPF: pass client-ip=144.168.59.46; envelope-from=hako@ultrarare.space; helo=mail.boiledscript.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches X-Patchwork-Original-From: Hilton Chain via Guix-patches via From: Hilton Chain X-getmail-retrieved-from-mailbox: Patches * guix/build/copy-build-system.scm (install): Add #:output filter. --- guix/build/copy-build-system.scm | 49 +++++++++++++++++++------------- 1 file changed, 30 insertions(+), 19 deletions(-) base-commit: 225e00bd1925487fb045d9184fd249d93accad08 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)