From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id WEMJLkLP1GF5wQAAgWs5BA (envelope-from ) for ; Tue, 04 Jan 2022 23:50:42 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id iEDKJkLP1GFvIQEAG6o9tA (envelope-from ) for ; Tue, 04 Jan 2022 23:50:42 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3CE6C3C335 for ; Tue, 4 Jan 2022 23:50:42 +0100 (CET) Received: from localhost ([::1]:46152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4sdd-0001xO-61 for larch@yhetil.org; Tue, 04 Jan 2022 17:50:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4sc1-0007Xr-Vm for guix-patches@gnu.org; Tue, 04 Jan 2022 17:49:01 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:55740) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4sc1-0006yL-KW for guix-patches@gnu.org; Tue, 04 Jan 2022 17:49:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n4sc1-0003pp-Iq for guix-patches@gnu.org; Tue, 04 Jan 2022 17:49:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53017] [PATCH 02/17] build: julia-build-system: Create 'Project.toml' file when missing. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 04 Jan 2022 22:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53017 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53017@debbugs.gnu.org Cc: efraim@flashner.co.il, zimoun Received: via spool by 53017-submit@debbugs.gnu.org id=B53017.164133649214510 (code B ref 53017); Tue, 04 Jan 2022 22:49:01 +0000 Received: (at 53017) by debbugs.gnu.org; 4 Jan 2022 22:48:12 +0000 Received: from localhost ([127.0.0.1]:39010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4sbD-0003lw-6C for submit@debbugs.gnu.org; Tue, 04 Jan 2022 17:48:11 -0500 Received: from mail-wm1-f49.google.com ([209.85.128.49]:40775) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4sbA-0003l9-Vx for 53017@debbugs.gnu.org; Tue, 04 Jan 2022 17:48:09 -0500 Received: by mail-wm1-f49.google.com with SMTP id j140-20020a1c2392000000b003399ae48f58so606320wmj.5 for <53017@debbugs.gnu.org>; Tue, 04 Jan 2022 14:48:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J8w7M+1Ix+Uc1q5NPheaYn+7vXV2B0vv2DXCTEMnOSo=; b=AN2S2q2EYASgbohoS6t3u8bwTHvIcPPD1XMlew8mVQWcInkWQI/TnHu2SVBYWAVNAf n5+7q7ev270xBwBwHO1T2dgsGVOvoWlg3QA89DFOWymsUib82fJsfiMO1cXwduAMPn2E Ez3KAFZFVlRsmzL5SO/pS+WaGZhDxJ4Xot9MF8jrq9EUb0VB5iuoqTS0Yp7ZtK/KtN9X 2jojG25qkDF+5NV7biPHGCgg90nUMHhwgfgv1gWnN5RidY+Yi+xf2Lq3GBdCu12KXXyy X4yXGRZecOqtVtl4OaIhpSseYYYf+nPQ3AonqaKIsGJedDqrondSeqD/+Vs2vJy7SmNw pQ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J8w7M+1Ix+Uc1q5NPheaYn+7vXV2B0vv2DXCTEMnOSo=; b=vPCs0Oe97zozoevJAETckMCG4u7D20FcJNLd07EzpIOx+xigRdSyUHVK533ptKpolL d+n/auJ/FZwZB0WFEIfhOroLvAkbXyOxseOy7oy5IB2P2qw64b7qOtRka+eURWdSWSFW ZIy2Ik3gIR2cys+HxQphqHhCWHdcU9PafIQYfyf/nGgISriKJ02IcuXUan4HEGj+2YaK ukNQon/jZbXbUXkg6p0mH44yAqxWFSSJSpY0WdLRhEyHa3gDc8x4m58JzM96iyKMqrzw 6jFw7KggzM/t6j+VfdN4A1xpvNnJwP+Co2bZ0p6w6nCi4ij278iTQu5T6RYJVrRIDIhh pm0A== X-Gm-Message-State: AOAM531pd+b527G/NF89EsdtsaQj3IgHE+1uU5R/rF7VScE0cu71Wqc4 SG9RgqcC/XP+FmXEvL34TDO8WhkeF6Y= X-Google-Smtp-Source: ABdhPJyoSSCYc/D2BJLq9mAEq4XTS9HE4T3O4y9TlMvOzz/DU0nHUEx0f21slwy+GGBaUbPwHJGbIA== X-Received: by 2002:a1c:f70d:: with SMTP id v13mr396948wmh.133.1641336483319; Tue, 04 Jan 2022 14:48:03 -0800 (PST) Received: from localhost.localdomain ([193.48.40.117]) by smtp.gmail.com with ESMTPSA id c9sm732842wml.12.2022.01.04.14.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 14:48:03 -0800 (PST) From: zimoun Date: Tue, 4 Jan 2022 23:47:40 +0100 Message-Id: <20220104224755.1142897-2-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220104224755.1142897-1-zimon.toutoune@gmail.com> References: <20220104224755.1142897-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641336642; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=J8w7M+1Ix+Uc1q5NPheaYn+7vXV2B0vv2DXCTEMnOSo=; b=e2sghxwSL40tmeORHvPxJSLQYS90S4CnoLzaMgeYatFo33p5SrDNJX6dnH74MBYjLKGAj+ /1frSi6sgJg4tVX0nEGtblM4Hhd9J5ucJWKZwfsulBofzRftExaqQ80cXLUWLuVEpxdlgm JTXyKSdVx1PK1GSX0V/HzyM1hnKAy/5iH20Wfm0lKh+B5j0/SumabmjNziEzEJm3zd17kg D/YxemR/44gE2/XJr9AgXiWNYZ0Oo/Wa9jRzPqq6fWJt82mcLI2nq7UWz+eFDwrOdxs9mP UauDqysvSsOpsRf1AW96IVkfcuXZC0QlinsCkKVQCu6jXWhmCC+mguzPRB3DaA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641336642; a=rsa-sha256; cv=none; b=jhuOuyLf1Ugm2d9jdQ25GVJDqkFLdmOHAOBbBPoUbKRHYfJasJDquglaskiXtqB+4WUQvQ FpjztTGOfnRBJsjNnKCxrBx2JmhVTmcyV/iT3MnSkCxpIDKbGxib5FI0XFC+geNfctvy0V D8r2CeLxENWMt25jUEJwtoM6KV0tu13Twds9/VHPpbK0DjlJICgl+73guuh5JSjy1vveZd u9fZAjX5zmVdvLkpk3QTu/zX3WrDXqREdbJtmozguSwuMLPkAdiHrdAFoo48/8DyQ+RVgV 428yxVJISm0dvXfIvgTQtq7zb3AcpiS3I/+g9DQ9pzM/BIdwwNOBuA9JZhwODw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=AN2S2q2E; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.99 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=AN2S2q2E; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 3CE6C3C335 X-Spam-Score: -1.99 X-Migadu-Scanner: scn1.migadu.com X-TUID: VpX49DRXKDIC * guix/build/julia-build-system.scm (link-depot): Create 'Project.toml' file when missing using data provided by the user. (julia-create-package-toml): Remove from export. * doc/guix.texi (Build Systems): Update julia-build-system section. --- doc/guix.texi | 19 +++++++++--------- guix/build/julia-build-system.scm | 33 ++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index dfb94be74e..603f8dcca3 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -71,7 +71,7 @@ Copyright @copyright{} 2019 Kyle Andrews@* Copyright @copyright{} 2019 Alex Griffin@* Copyright @copyright{} 2019, 2020, 2021 Guillaume Le Vaillant@* Copyright @copyright{} 2020 Liliana Marie Prikler@* -Copyright @copyright{} 2019, 2020, 2021 Simon Tournier@* +Copyright @copyright{} 2019, 2020, 2021, 2022 Simon Tournier@* Copyright @copyright{} 2020 Wiktor Żelazny@* Copyright @copyright{} 2020 Damien Cassou@* Copyright @copyright{} 2020 Jakub Kądziołka@* @@ -8363,9 +8363,10 @@ julia} packages, which essentially is similar to running @samp{julia -e @env{JULIA_LOAD_PATH} contains the paths to all Julia package inputs. Tests are run by calling @code{/test/runtests.jl}. -The Julia package name is read from the file @file{Project.toml}. This -value can be overridden by passing the argument @code{#:julia-package-name} -(which must be correctly capitalized). +The Julia package name and uuid is read from the file +@file{Project.toml}. These values can be overridden by passing the +argument @code{#:julia-package-name} (which must be correctly +capitalized) or @code{#:julia-package-uuid}. Julia packages usually manage their binary dependencies via @code{JLLWrappers.jl}, a Julia package that creates a module (named @@ -8393,12 +8394,10 @@ MbedTLS package: (find-files "src/wrappers/" "\\.jl$")))) @end lisp -Some older packages that aren't using @file{Package.toml} yet, will require -this file to be created, too. The function @code{julia-create-package-toml} -helps creating the file. You need to pass the outputs and the source of the -package, its name (the same as the @code{file-name} parameter), the package -uuid, the package version, and a list of dependencies specified by their name -and their uuid. +Some older packages that aren't using @file{Project.toml} yet, will +require this file to be created, too. It is internally done if the +arguments @code{#:julia-package-name} and @code{#:julia-package-uuid} +are provided. @end defvr @defvr {Scheme Variable} maven-build-system diff --git a/guix/build/julia-build-system.scm b/guix/build/julia-build-system.scm index b4e0044567..03d669be64 100644 --- a/guix/build/julia-build-system.scm +++ b/guix/build/julia-build-system.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019, 2020 Nicolò Balzarotti ;;; Copyright © 2021 Jean-Baptiste Volatier -;;; Copyright © 2021 Simon Tournier +;;; Copyright © 2021, 2022 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -27,8 +27,8 @@ (define-module (guix build julia-build-system) #:use-module (ice-9 regex) #:use-module (ice-9 rdelim) #:use-module (ice-9 popen) + #:use-module (srfi srfi-1) #:export (%standard-phases - julia-create-package-toml julia-build)) ;; Commentary: @@ -138,6 +138,8 @@ (define* (check #:key tests? source inputs outputs julia-package-name (define* (link-depot #:key source inputs outputs julia-package-name julia-package-uuid #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) + (name+version (strip-store-file-name out)) + (version (last (string-split name+version #\-))) (package-name (or julia-package-name (project.toml->name "Project.toml"))) @@ -148,6 +150,14 @@ (define* (link-depot #:key source inputs outputs println(Base.version_slug(Base.UUID(\"~a\"), Base.SHA1(Pkg.GitTools.tree_hash(\".\"))))" uuid))) (slug (string-trim-right (get-string-all pipe)))) + ;; Few packages do not have the regular Project.toml file, then when they + ;; are propagated, dependencies do not find them and an raise error. + (unless (file-exists? "Project.toml") + (julia-create-package-toml (getcwd) + julia-package-name julia-package-uuid + version + #:file "Project.toml")) + ;; When installing a package, julia looks first at in the JULIA_DEPOT_PATH ;; for a path like packages/PACKAGE/XXXX ;; Where XXXX is a slug encoding the package UUID and SHA1 of the files @@ -157,17 +167,16 @@ (define* (link-depot #:key source inputs outputs (symlink package-dir (string-append out "/share/julia/packages/" package-name "/" slug)))) -(define (julia-create-package-toml outputs source - name uuid version - deps) - "Some packages are not using the new Package.toml dependency specifications. -Write this file manually, so that Julia can find its dependencies." +(define* (julia-create-package-toml location + name uuid version + #:optional + (deps '()) + #:key + (file "Project.toml")) + "Some packages are not using the new Project.toml dependency specifications. +Write this FILE manually, so that Julia can find its dependencies." (let ((f (open-file - (string-append - (assoc-ref outputs "out") - %package-path - (string-append - name "/Project.toml")) + (string-append location "/" file) "w"))) (display (string-append " -- 2.33.1