GNU bug report logs - #57790
Strange behavior with emacs-build-system

Previous Next

Package: guix;

Reported by: Fredrik Salomonsson <plattfot <at> posteo.net>

Date: Wed, 14 Sep 2022 03:00:02 UTC

Severity: normal

To reply to this bug, email your comments to 57790 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#57790; Package guix. (Wed, 14 Sep 2022 03:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Fredrik Salomonsson <plattfot <at> posteo.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Wed, 14 Sep 2022 03:00:02 GMT) Full text and rfc822 format available.

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

From: Fredrik Salomonsson <plattfot <at> posteo.net>
To: bug-guix <at> gnu.org
Subject: Strange behavior with emacs-build-system
Date: Wed, 14 Sep 2022 02:59:03 +0000
Hi,

I encountered a strange behavior when using a guix.scm file to build and
run test in an emacs project. The project is called issue.el[0].

I have the following guix.scm:

---✀----------------------------------------------------------------------------
(use-modules
  ((guix licenses) #:prefix license:)
  (guix packages)
  (guix gexp)
  (guix download)
  (guix git-download)
  (guix build-system emacs)
  (guix build emacs-utils)
  (gnu packages)
  (gnu packages emacs)
  (gnu packages emacs-xyz)
  (ice-9 popen)
  (ice-9 rdelim)
  )

(define %git-commit
  (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f2" OPEN_READ)))

(define (skip-git-directory file stat)
  "Skip the `.git` directory when collecting the sources."
  (let ((name (basename file)))
    (not (string=? name ".git"))))

(package
 (name "emacs-issue-el")
 (version (git-version (emacs-header-parse "version" "issue.el") "HEAD" %git-commit))
 (source (local-file (dirname (current-filename))
                     #:recursive? #t
                     #:select? skip-git-directory))
 (build-system emacs-build-system)
 (arguments
  (list #:tests? (not (%current-target-system))
        #:test-command #~'("ert-runner")))
 (native-inputs (list emacs-ert-runner))
 (propagated-inputs
  (list
   emacs-org-jira))
 (home-page "https://sr.ht/~plattfot/issue.el")
 (synopsis "List issues from various issue trackers in emacs")
 (description
  "List issues from various issue trackers in a tabulated buffer in
@code{Emacs} and act on them.  Current supported issue tracker is
@code{jira}.")
 (license license:gpl3+))

--------------------------------------------------------------------------------

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.

[0] https://git.sr.ht/~plattfot/issue.el

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




Information forwarded to bug-guix <at> gnu.org:
bug#57790; Package guix. (Tue, 11 Oct 2022 10:53:01 GMT) Full text and rfc822 format available.

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

From: zimoun <zimon.toutoune <at> gmail.com>
To: Fredrik Salomonsson <plattfot <at> posteo.net>, 57790 <at> debbugs.gnu.org
Subject: Re: bug#57790: Strange behavior with emacs-build-system
Date: Tue, 11 Oct 2022 11:51:14 +0200
Hi,

On Wed, 14 Sep 2022 at 02:59, Fredrik Salomonsson <plattfot <at> posteo.net> 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---

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


Cheers,
simon




Information forwarded to bug-guix <at> gnu.org:
bug#57790; Package guix. (Tue, 11 Oct 2022 17:33:01 GMT) Full text and rfc822 format available.

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

From: Fredrik Salomonsson <plattfot <at> posteo.net>
To: zimoun <zimon.toutoune <at> gmail.com>, 57790 <at> debbugs.gnu.org
Subject: Re: bug#57790: Strange behavior with emacs-build-system
Date: Tue, 11 Oct 2022 17:32:07 +0000
Hi,

zimoun <zimon.toutoune <at> gmail.com> writes:

> On Wed, 14 Sep 2022 at 02:59, Fredrik Salomonsson <plattfot <at> posteo.net> 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




Information forwarded to bug-guix <at> gnu.org:
bug#57790; Package guix. (Wed, 12 Oct 2022 03:48:02 GMT) Full text and rfc822 format available.

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

From: Fredrik Salomonsson <plattfot <at> posteo.net>
To: zimoun <zimon.toutoune <at> gmail.com>, 57790 <at> debbugs.gnu.org
Subject: Re: bug#57790: Strange behavior with emacs-build-system
Date: Wed, 12 Oct 2022 03:46:49 +0000
Fredrik Salomonsson <plattfot <at> posteo.net> writes:

> Hi,
>
> zimoun <zimon.toutoune <at> gmail.com> writes:
>
>> On Wed, 14 Sep 2022 at 02:59, Fredrik Salomonsson <plattfot <at> posteo.net> 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.

I just tested it and it at least fixed my issue. I haven't tested any
other emacs package yet. Also I'm not sure if this is the best solution.
But we now know it is the `unpack` phase that is the cause.

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




This bug report was last modified 1 year and 169 days ago.

Previous Next


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