GNU bug report logs - #55464
(current-filename) is #f when guix pull'ing

Previous Next

Package: guix;

Reported by: Attila Lendvai <attila <at> lendvai.name>

Date: Mon, 16 May 2022 21:05:01 UTC

Severity: normal

Full log


Message #11 received at 55464 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Attila Lendvai <attila <at> lendvai.name>
Cc: 55464 <at> debbugs.gnu.org
Subject: Re: bug#55464: (current-filename) is #f when guix pull'ing
Date: Wed, 18 May 2022 11:14:13 +0200
Hi,

Attila Lendvai <attila <at> 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’.




This bug report was last modified 3 years and 25 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.