guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#41253] [PATCH v4] guix repl: Add script execution.


From: Konrad Hinsen
Subject: [bug#41253] [PATCH v4] guix repl: Add script execution.
Date: Sat, 13 Jun 2020 18:39:42 +0200

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 via email to

[Prev in Thread] Current Thread [Next in Thread]