unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#57790: Strange behavior with emacs-build-system
@ 2022-09-14  2:59 Fredrik Salomonsson
  2022-10-11  9:51 ` zimoun
  0 siblings, 1 reply; 4+ messages in thread
From: Fredrik Salomonsson @ 2022-09-14  2:59 UTC (permalink / raw)
  To: 57790

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#57790: Strange behavior with emacs-build-system
  2022-09-14  2:59 bug#57790: Strange behavior with emacs-build-system Fredrik Salomonsson
@ 2022-10-11  9:51 ` zimoun
  2022-10-11 17:32   ` Fredrik Salomonsson
  0 siblings, 1 reply; 4+ messages in thread
From: zimoun @ 2022-10-11  9:51 UTC (permalink / raw)
  To: Fredrik Salomonsson, 57790

Hi,

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

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#57790: Strange behavior with emacs-build-system
  2022-10-11  9:51 ` zimoun
@ 2022-10-11 17:32   ` Fredrik Salomonsson
  2022-10-12  3:46     ` Fredrik Salomonsson
  0 siblings, 1 reply; 4+ messages in thread
From: Fredrik Salomonsson @ 2022-10-11 17:32 UTC (permalink / raw)
  To: zimoun, 57790

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.

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#57790: Strange behavior with emacs-build-system
  2022-10-11 17:32   ` Fredrik Salomonsson
@ 2022-10-12  3:46     ` Fredrik Salomonsson
  0 siblings, 0 replies; 4+ messages in thread
From: Fredrik Salomonsson @ 2022-10-12  3:46 UTC (permalink / raw)
  To: zimoun, 57790

Fredrik Salomonsson <plattfot@posteo.net> writes:

> 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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-12  3:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14  2:59 bug#57790: Strange behavior with emacs-build-system Fredrik Salomonsson
2022-10-11  9:51 ` zimoun
2022-10-11 17:32   ` Fredrik Salomonsson
2022-10-12  3:46     ` Fredrik Salomonsson

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).