Strange behavior with emacs-build-system

  • Open
  • quality assurance status badge
Details
2 participants
  • Fredrik Salomonsson
  • zimoun
Owner
unassigned
Submitted by
Fredrik Salomonsson
Severity
normal
F
F
Fredrik Salomonsson wrote on 14 Sep 2022 04:59
(address . bug-guix@gnu.org)
87v8pqbr0o.fsf@d2.com
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))
(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.


--
s/Fred[re]+i[ck]+/Fredrik/g
Z
Z
zimoun wrote on 11 Oct 2022 11:51
86wn96ofhp.fsf@gmail.com
Hi,

On Wed, 14 Sep 2022 at 02:59, Fredrik Salomonsson <plattfot@posteo.net> wrote:

Toggle quote (11 lines)
> 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:

Toggle snippet (12 lines)
(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)))

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
F
F
Fredrik Salomonsson wrote on 11 Oct 2022 19:32
87k056qnag.fsf@d2.com
Hi,

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

Toggle quote (28 lines)
> On Wed, 14 Sep 2022 at 02:59, Fredrik Salomonsson <plattfot@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.

Toggle quote (7 lines)
> 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
F
F
Fredrik Salomonsson wrote on 12 Oct 2022 05:46
87edvdzot2.fsf@posteo.net
Fredrik Salomonsson <plattfot@posteo.net> writes:

Toggle quote (49 lines)
> Hi,
>
> zimoun <zimon.toutoune@gmail.com> writes:
>
>> On Wed, 14 Sep 2022 at 02:59, Fredrik Salomonsson <plattfot@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
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 57790@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 57790
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch