bug-guix
[Top][All Lists]
Advanced

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

bug#55464: (current-filename) is #f when guix pull'ing


From: Ludovic Courtès
Subject: bug#55464: (current-filename) is #f when guix pull'ing
Date: Wed, 18 May 2022 11:14:13 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi,

Attila Lendvai <attila@lendvai.name> skribis:

> the actual context where i'm encountering this is a package definition where 
> i want to load some hashes from a file relative the to the .scm file:
>
> (define-public foo
>   (let ((hashes
>     (with-input-from-file
>         (string-append (dirname (current-filename))
>                        "/foo.hashes")
>       read)))
>     (package ...)))

Not fully answering your question, but if “foo.hashes” contains hashes
for origins and similar, you could make “foo.hashes” contain something
like:

  (list (base32 …) …)

and, in the .scm, write:

  (include "foo.hashes")

The ‘include’ directive includes the file at macro-expansion time,
similar to #include in C.

Back to the original issue, I suppose ‘current-filename’ return #f when
this .scm is first loaded, before it’s compiled.  Anyway, it’s probably
best to load it at macro-expansion time as you suggested.

HTH,
Ludo’.





reply via email to

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