all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Nicolò Balzarotti" <anothersms@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 45972@debbugs.gnu.org
Subject: [bug#45972] [PATCH] Add julia-json with dependencies
Date: Thu, 28 Jan 2021 01:30:24 +0100	[thread overview]
Message-ID: <87czxpdhsv.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <87mtwut34z.fsf@gnu.org>

> 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’t 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 fine.

> Can we either extract the Julia package name from metadata that’s in
> the package itself (?), or otherwise pass it to all the phases via
> ‘julia-build-system’?

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*=\\s*\"(.*)\"" line)))
              (if m (match:substring m 1)
                  (loop (read-line in 'concat)))))))))
#+end_src

As you can see this is very minimal/naive (takes the first name = ""
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).

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"] |> println")

doing something like cargo's manifest-target procedure does.  But it'd
go the other way if it's ok.

Let me know!  Once decided, I'll submit the updated patches

>
> Sorry for not noticing earlier!
>
np and thanks again!




  reply	other threads:[~2021-01-28  0:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 23:47 [bug#45972] [PATCH] Add julia-json with dependencies Nicolò Balzarotti
2021-01-26 21:33 ` Ludovic Courtès
2021-01-26 23:23   ` Nicolò Balzarotti
2021-01-27 22:40     ` Ludovic Courtès
2021-01-28  0:30       ` Nicolò Balzarotti [this message]
2021-01-28 13:10         ` Ludovic Courtès
2021-01-28 15:37           ` Nicolò Balzarotti
2021-01-30 14:10             ` bug#45972: " Ludovic Courtès
2021-01-30 14:46         ` [bug#45972] Julia importer? zimoun
2021-01-30 20:13           ` Nicolò Balzarotti
2021-01-30 21:42             ` Nicolò Balzarotti
2021-01-31 19:35             ` zimoun
2021-01-31 20:00               ` Nicolò Balzarotti
2021-02-01  7:22                 ` zimoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87czxpdhsv.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me \
    --to=anothersms@gmail.com \
    --cc=45972@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.