From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id mRo2KvS3EmBQXwAA0tVLHw (envelope-from ) for ; Thu, 28 Jan 2021 13:11:16 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id QCaDJfS3EmD2EgAA1q6Kng (envelope-from ) for ; Thu, 28 Jan 2021 13:11:16 +0000 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 39D2F940276 for ; Thu, 28 Jan 2021 13:11:16 +0000 (UTC) Received: from localhost ([::1]:59778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l574s-0002jO-Nl for larch@yhetil.org; Thu, 28 Jan 2021 08:11:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l574g-0002jI-SU for guix-patches@gnu.org; Thu, 28 Jan 2021 08:11:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35987) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l574g-0001oq-Ll for guix-patches@gnu.org; Thu, 28 Jan 2021 08:11:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l574g-0006OU-Hu for guix-patches@gnu.org; Thu, 28 Jan 2021 08:11:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45972] [PATCH] Add julia-json with dependencies Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 28 Jan 2021 13:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45972 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: =?UTF-8?Q?Nicol=C3=B2?= Balzarotti Received: via spool by 45972-submit@debbugs.gnu.org id=B45972.161183944324528 (code B ref 45972); Thu, 28 Jan 2021 13:11:02 +0000 Received: (at 45972) by debbugs.gnu.org; 28 Jan 2021 13:10:43 +0000 Received: from localhost ([127.0.0.1]:47529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l574N-0006NX-8N for submit@debbugs.gnu.org; Thu, 28 Jan 2021 08:10:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59988) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l574J-0006NJ-FG for 45972@debbugs.gnu.org; Thu, 28 Jan 2021 08:10:42 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41501) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l574E-0001gN-B3; Thu, 28 Jan 2021 08:10:34 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=58000 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l573w-00042p-U1; Thu, 28 Jan 2021 08:10:21 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87ft2xzu1g.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> <87wnvzwfgu.fsf@gnu.org> <87lfcfcmf3.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> <87mtwut34z.fsf@gnu.org> <87czxpdhsv.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 9 =?UTF-8?Q?Pluvi=C3=B4se?= an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 28 Jan 2021 14:10:15 +0100 In-Reply-To: <87czxpdhsv.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> ("=?UTF-8?Q?Nicol=C3=B2?= Balzarotti"'s message of "Thu, 28 Jan 2021 01:30:24 +0100") Message-ID: <87h7n1qkaw.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: , Cc: 45972@debbugs.gnu.org Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.85 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 39D2F940276 X-Spam-Score: -2.85 X-Migadu-Scanner: scn0.migadu.com X-TUID: XevuWUnw8g7Z Buon giorno! Nicol=C3=B2 Balzarotti skribis: >> My understanding is that the first patch expects the source file name to >> match the Julia package name. > > That's correct, we use it in the build system. > >> IMO, that shouldn=E2=80=99t be the case. > > At first I wasn't sure it was ok, but it went on through the revision > process when I submitted the first package (Compat) so I tought it was fi= ne. If it was me it was probably an oversight, I=E2=80=99m sorry about that. >> Can we either extract the Julia package name from metadata that=E2=80=99= s in >> the package itself (?), or otherwise pass it to all the phases via >> =E2=80=98julia-build-system=E2=80=99? > > Sure, I'd just read it from Package.toml (nowadays almost all the > packages have this file, and for when it's missing we also have the > julia-create-package-toml procedure that creates it). > > The file is toml, but I don't see a toml parser in guix. So, I'd use a > function like the following: > > #+begin_src scheme > (define (package.toml->name file) > (call-with-input-file file > (lambda (in) > (let loop ((line (read-line in 'concat))) > (if (eof-object? line) > #f ;What to do? > (let ((m (string-match "name\\s*=3D\\s*\"(.*)\"" line))) > (if m (match:substring m 1) > (loop (read-line in 'concat))))))))) > #+end_src Sounds reasonable to me. If I understand the toml format correctly, =E2=80=9Cname=3D.*=E2=80=9D is guaranteed to be on a line on its own, so th= at looks safe. > As you can see this is very minimal/naive (takes the first name =3D "" > occurrence, does not even consider comments, for which I'd add a > negative lookahead "^(?!#)" which I can't get to work with ice-9 regex), > but tested on a few packages it working. I don't know what to do when > the match is not found (since it's something that might happen only > during development, the #f fallback should not be too bad, btw, as the > build will fail). Yes, sounds good. To be on the safe side, we can add a #:julia-package-name parameter to the build system; it would default to #f, in which case the name is extracted from the toml file. > The other way I think this is easily solvable is by asking julia > directly, by reading the output of: > > (invoke-julia "using Pkg; Pkg.TOML.parsefile("Project.toml")["name"] |> p= rintln") > > doing something like cargo's manifest-target procedure does. But it'd > go the other way if it's ok. Yeah, the basic =E2=80=9Cparser=E2=80=9D seems to be good enough. Thanks! Ludo=E2=80=99.