Subject: bug#57790: Strange behavior with emacs-build-system

From: Fredrik Salomonsson <[email-masked]>
Date: Tue, 11 Oct 2022 17:32:07 +0000

Hi,

zimoun <[email-masked]> writes:

> On Wed, 14 Sep 2022 at 02:59, Fredrik Salomonsson <[email-masked]> wrote:
>
>> If I name the local clone `issue.el` (name of the directory);
>> `guix build -f guix.scm` will fail. It will just copy the file
>> `issue.el` and then `ert-runner` fails as there is no test directory.
>>
>> But if I name the local clone something else, e.g. `issue-el` then it
>> will copy all the files, `ert-runner` will be happy and
>> `guix build -f guix.scm` will succeed.
>>
>> I'm not sure if this is an issue in `emacs-build-system`, `local-file`
>> or plain old user error.
>
> Well, I guess it comes from ’unpack’; which reads:
>
> --8<---------------cut here---------------start------------->8---
> (define* (unpack #:key source #:allow-other-keys)
>   "Unpack SOURCE into the build directory.  SOURCE may be a compressed
> archive, a directory, or an Emacs Lisp file."
>   (if (string-suffix? ".el" source)
>       (begin
>         (mkdir "source")
>         (chdir "source")
>         (copy-file source (store-file->elisp-source-file source))
>         #t)
>       (gnu:unpack #:source source)))
> --8<---------------cut here---------------end--------------->8---

Ah, yeah that would make sense.

> Well, I guess again that the ’source’ should contain something like,
>
>     (file-name (git-file-name name version)
>
> to avoid the issue.  But the naive approach does not work with
> ’local-file’.

Would `file-is-directory?` work? E.g.

  (if (and (string-suffix? ".el" source)
           (not (file-is-directory? source)))
  …)

I'm currently at work so I cannot test this right now.

-- 
s/Fred[re]+i[ck]+/Fredrik/g