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

Hi Ludo,

Patch v5 is on its way! A few comments:

> Should be: [@var{file} @var{args}@dots{}]
> The square brackets show it’s optional.

OK.

>> +When a @var{file} argument is provided, @var{file} is
>> +executed as a Guile scripts:
>
> “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...

>   (define scripts  ;plural, no?

This is not a plural. But filter-map is indeed nicer!

>> +  (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.

 - 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.

>> +cat > "$tmpfile"<<EOF
>> +#!/usr/bin/env -S guix repl --
>
> Rather:
>
>   #!$(type -P env)

I didn't know that was possible on a shebang line!

> Could you send an updated patch?

Done!

Cheers,
  Konrad




  reply	other threads:[~2020-06-13 16:40 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 [this message]
2020-06-13 19:44           ` Ludovic Courtès
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=m17dwaj4xd.fsf@fastmail.net \
    --to=konrad.hinsen@fastmail.net \
    --cc=41253@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.