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

From: Fredrik Salomonsson <[email-masked]>
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