all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Konrad Hinsen <konrad.hinsen@fastmail.net>
Cc: 41253@debbugs.gnu.org
Subject: [bug#41253] [PATCH v4] guix repl: Add script execution.
Date: Sat, 13 Jun 2020 21:44:51 +0200	[thread overview]
Message-ID: <87v9juyclo.fsf@gnu.org> (raw)
In-Reply-To: <m17dwaj4xd.fsf@fastmail.net> (Konrad Hinsen's message of "Sat, 13 Jun 2020 18:39:42 +0200")

Hi,

Konrad Hinsen <konrad.hinsen@fastmail.net> skribis:

>> “When one or more @var{file} argument is provided, each @var{file} is
>> executed as a Guile program:”
>
> No, that's no longer true. Only one script can be run at a time, because
>
>   guix repl script1.scm script2.scm
>
> now means "run script1.scm with script2.scm as its argument". And therefore...

Ah OK, sorry for the confusion.

>>> +  (define script-file
>>> +    (let ((file (car script))
>>> +          (directory (getcwd)))
>>> +      (canonicalize-path
>>> +       (cond ((string-prefix? "/" file) file)
>>> +             (else (string-append directory "/" file))))))
>>
>> I think we can just use file names as they arrive, without attempting to
>> canonicalize them or anything.
>
> That's what I thought (and tried) as well, at first. Problems:
>
>  - It doesn't work when run via pre-inst-env with a non-absolute
>    filename for the script. The script is looked up relative
>    to the directory containing repl.scm.

Oh right, that’s because we’re using ‘load’.  We should instead do:

  (load-in-vicinity "." file)

Alternatively, (primitive-load file), but in that case the script would
be systematically interpreted.

>  - The script filename is also the first item of (command-line)
>    when called inside the script, and that's useful only it it's
>    an absolute filename.

In what way is it useful?

>>> +cat > "$tmpfile"<<EOF
>>> +#!/usr/bin/env -S guix repl --
>>
>> Rather:
>>
>>   #!$(type -P env)
>
> I didn't know that was possible on a shebang line!

It’s not, but here it’s evaluated as part of the here-document
expansion.

Thanks!

Ludo’.




  reply	other threads:[~2020-06-13 19:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14  9:18 [bug#41253] [PATCH] guix: add script execution to "guix repl" Konrad Hinsen
2020-05-14 16:25 ` [bug#41253] [PATCH v2] guix repl: Add script execution zimoun
2020-05-29 10:11   ` [bug#41253] [PATCH v3] " Konrad Hinsen
2020-06-04 15:06     ` Ludovic Courtès
2020-06-05  8:48       ` Konrad Hinsen
2020-06-05 10:18         ` Konrad Hinsen
2020-06-05 16:36         ` Ludovic Courtès
2020-06-06  5:22           ` Konrad Hinsen
2020-06-06  5:18     ` [bug#41253] [PATCH v4] " Konrad Hinsen
2020-06-12 15:58       ` Ludovic Courtès
2020-06-13 16:39         ` Konrad Hinsen
2020-06-13 19:44           ` Ludovic Courtès [this message]
2020-06-14  7:02             ` Konrad Hinsen
2020-06-13 16:34       ` [bug#41253] [PATCH v5] " Konrad Hinsen
2020-06-14  7:00         ` [bug#41253] [PATCH v6] " Konrad Hinsen
2020-06-14 20:50           ` bug#41253: " Ludovic Courtès
2020-05-14 16:31 ` [bug#41253] [PATCH] guix: add script execution to "guix repl" zimoun
2020-05-29 10:16   ` Konrad Hinsen
2020-05-29 13:53     ` zimoun
2020-05-29 17:21       ` Konrad Hinsen

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=87v9juyclo.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=41253@debbugs.gnu.org \
    --cc=konrad.hinsen@fastmail.net \
    /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.