From patchwork Sun Oct 29 12:56:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Volf X-Patchwork-Id: 55522 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 8492727BBE9; Sun, 29 Oct 2023 12:59:42 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,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 CCF8427BBE2 for ; Sun, 29 Oct 2023 12:59:41 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qx5O8-0004Fz-7p; Sun, 29 Oct 2023 08:59:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qx5O6-0004Fm-H7 for guix-patches@gnu.org; Sun, 29 Oct 2023 08:59:30 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qx5O6-00065J-2F for guix-patches@gnu.org; Sun, 29 Oct 2023 08:59:30 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qx5Oc-0001ud-Jr for guix-patches@gnu.org; Sun, 29 Oct 2023 09:00:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66815] [PATCH] build-system/guile: Add target-guile-scm+go procedure. Resent-From: Tomas Volf Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 29 Oct 2023 13:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66815 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66815@debbugs.gnu.org Cc: Tomas Volf X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16985843807285 (code B ref -1); Sun, 29 Oct 2023 13:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Oct 2023 12:59:40 +0000 Received: from localhost ([127.0.0.1]:40708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx5OG-0001tQ-5a for submit@debbugs.gnu.org; Sun, 29 Oct 2023 08:59:40 -0400 Received: from lists.gnu.org ([2001:470:142::17]:42570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx5OB-0001t9-5m for submit@debbugs.gnu.org; Sun, 29 Oct 2023 08:59:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qx5NY-0004CH-1p for guix-patches@gnu.org; Sun, 29 Oct 2023 08:58:56 -0400 Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qx5NU-00062i-TJ for guix-patches@gnu.org; Sun, 29 Oct 2023 08:58:55 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id C709F27465B; Sun, 29 Oct 2023 12:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1698584328; bh=I7dFqfqFN9Nx+vNUDVHkkbNh51f0s2OAYya8WVCvDtA=; h=From:To:Cc:Subject:Date; b=k/vKjG0wJQlXLx4YCUOtflPkIaWcUeHG3NhE8jZ9Fdn+o0eAFQ6JlzshZJaz87/pm bY8qMnkOUVTL7lpYKp+dWf+D8rnn/z62f8rgiNskzRSvLAUistoWrIp+LA3ze878um ifXqA7QYHJp4thuWVMmgSksfW0yBYpiR1KdeAOXCPK2WGVWFSVVybMtnq4Qmsfh++1 KIaevU2NroapQ6MqYaFYWugSjna+ylpWpVxoLghsf8KfxtakWy1h+m4Qzmlw7g5MSG JrXEQ0f1LmiuOikGWEdI9QOVttZcHdoTN1x6gOfEM8nRANzqyXmhdRnNmNvihJHGMI E0S7vw2KNkq6y19tuOaU31FWtXNXGNZACBoNrH5nzdAlrc6fPmCXSszCjAxgVqvVWH 0RJVyB3Nxxt8VO8URBl0ZqEQf/2zOiFTKioRSe9owFOha+A5G3XWx5PIaG7IFb7vfb mHBLwfDTZrHISkx/ivHg6pF0Ra3+5vpPbCD78vgoiGxQ2p36391l9T88MudyR2bCER ngVAlUBMYcmIaLZqK9EwC1TSceNJhOsl6RE6UR8c6EvUdzJ611D0VkTqxZomIz2/6u 5Z7O50MFdAXVO2rBeikDp5opeAonpIlUOBPff3yFSwLdC6swbupyEGn0AJ32OylyQ8 kwc9ce4b/r8x6W+ieURWSHT4= Received: from localhost (unknown [146.70.134.132]) by wolfsden.cz (Postfix) with ESMTPSA id 212F62752B8; Sun, 29 Oct 2023 12:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1698584327; bh=I7dFqfqFN9Nx+vNUDVHkkbNh51f0s2OAYya8WVCvDtA=; h=From:To:Cc:Subject:Date; b=sSm+y7OgWP/BqZd680B7NNJd2DwmDjCsLOSLYPDnr+Pj3vFZ+aQ+L8P4WXoPgrOud LQPUB7Rn/IQLxMjx5AJk+c6JodmrVcIS9y9mVhuxm9pdfbs4AmyMZb8llzRYAnzqF1 PLgsBwfJx8YAcc6kaQNZkdrTEQATdF4yO7HtWrJEp+Cgx8lZzZsC2FdhDAgM6cPwTS dv6VarnpBCg2mYXn+OBElYrTMSLca8XCHm1bnPhPc+Qj7d6HekBiIqDnk8GKIVp+xK 1HmEpPUrVYci9sGlqJI9+G1aI6JCAWcrpcBNg/6Ml1rPDuqGx92z4Vu5ha1DopuaXF 73ChjxZHJUnIUz9RKZBpDzh1KspB6BVN2XbzwUJZ6ZeLCjhrT2ZV0oZ1cBshfD9M/L zihBM4P4+A2DxJlPmvxEeHOYttBLAm9TpWg/C0Ao1XTkrTHAdgs2yJszP/qm6iYsOi Q/4fwXM46vsl9JWxf9NAdDIxnGUCALNHvD881jFZC+XT2zgV1NdNa+Ken5z+e7phQp di5nggaWS7+ZquhxWKSh9XAHXM7WGqU4FParbzB0SkpUNedLK/JnoT7v6gX+kBsBH3 jW8+n01EBI45o9ATbQiB1WH6gwhQYOdRyRZP4dXyZpeqP4ov/5FPTWYz//udx3mfrt 6ZMBv/xna66RUjUiaSjp5VPo= Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 2cea3e8c; Sun, 29 Oct 2023 12:58:44 +0000 (UTC) From: Tomas Volf Date: Sun, 29 Oct 2023 13:56:13 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: none client-ip=37.205.8.62; envelope-from=ws@wolfsnet.cz; helo=wolfsden.cz X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, UNPARSEABLE_RELAY=0.001 autolearn=no 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches The paths to .scm and .go files can be constructed given a guile version and a base directory. However it is few lines of code that needs to be copy&pasted. This new procedure returns both of them reducing the maintenance cost. * guix/build/guile-build-system.scm (target-guile-scm+go): New procedure. Change-Id: I58615f2cfe0ec1e58d3fbb47b738ed5dce1bb252 --- This procedure is handy both for executing tests on installed files in guile-build-system and to set environment variables in wrappers. guix/build/guile-build-system.scm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) base-commit: ac01fef9ff3efb48e60e80930743888b0e79be66 diff --git a/guix/build/guile-build-system.scm b/guix/build/guile-build-system.scm index 32a431d347..e7e7f2d0be 100644 --- a/guix/build/guile-build-system.scm +++ b/guix/build/guile-build-system.scm @@ -28,6 +28,7 @@ (define-module (guix build guile-build-system) #:use-module (ice-9 format) #:use-module (guix build utils) #:export (target-guile-effective-version + target-guile-scm+go %standard-phases guile-build)) @@ -44,7 +45,17 @@ (define* (target-guile-effective-version #:optional guile) (string? line) line))) -(define (file-sans-extension file) ;TODO: factorize +(define* (target-guile-scm+go output #:optional guile) + "Return paths under `output' for scm and go files for effective version of +GUILE or whichever `guile' is in $PATH. Raises an error if they cannot be +determined." + (let* ((version (or (target-guile-effective-version guile) + (error "Cannot determine the effective target guile version."))) + (scm (string-append output "/share/guile/site/" version)) + (go (string-append output "/lib/guile/" version "/site-ccache"))) + (values scm go))) + +(define (file-sans-extension file) ;TODO: factorize "Return the substring of FILE without its extension, if any." (let ((dot (string-rindex file #\.))) (if dot