Subject: Re: Status: [PATCH 0/6] gnu: Add emacs-epkg.

From: Oleg Pykhalov <[email-masked]>
Date: Sat, 14 Apr 2018 20:50:47 +0300

Hello Ludovic,

Thank you for review!

I've applied all your suggestions except ‘set-emacs-load-path’.  First
of all this procedure is not exported.  Another pitfall is ‘Invalid
keyword’ error.

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 6258dbaed..d290a61b4 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -7733,7 +7733,8 @@ object has been freed.")
                   ,@%gnu-build-system-modules
                   (guix build emacs-utils))
        #:imported-modules (,@%gnu-build-system-modules
-                           (guix build emacs-utils))
+                           (guix build emacs-utils)
+                           (guix build emacs-build-system))
        #:phases
        (modify-phases %standard-phases
          (delete 'configure)
@@ -7744,22 +7745,8 @@ object has been freed.")
              #t))
          (add-after 'patch-elisp-shell-shebangs 'setenv-emacsloadpath
            (lambda* (#:key inputs #:allow-other-keys)
-             (define (el-dir store-dir)
-               (match (find-files store-dir "\\.el$")
-                 ((f1 f2 ...) (dirname f1))
-                 (_ "")))
-             (define emacs-prefix? (cut string-prefix? "emacs-" <>))
-             (let* ((emacs-load-paths
-                     (map (match-lambda
-                            (((? emacs-prefix? name) . dir)
-                             (string-append (el-dir dir) ":"))
-                            (_ ""))
-                          inputs))
-                    (emacs-load-path-value
-                     (string-concatenate emacs-load-paths)))
-               (format #t "environment variable `EMACSLOADPATH' set to ~a\n"
-                       emacs-load-path-value)
-               (setenv "EMACSLOADPATH" emacs-load-path-value))
+             ((@@ (guix build emacs-build-system) set-emacs-load-path)
+               inputs)
              #t))
          (add-after 'setenv-emacsloadpath 'setenv-shell
            (lambda _

--8<---------------cut here---------------start------------->8---
./pre-inst-env env GUIX_PACKAGE_PATH= guix build --no-grafts emacs-emacsql
;;; note: source file /home/natsu/src/guix/gnu/packages/emacs.scm
;;;       newer than compiled /home/natsu/src/guix/gnu/packages/emacs.go
;;; note: source file /home/natsu/src/guix/gnu/packages/emacs.scm
;;;       newer than compiled /home/natsu/.guix-profile/lib/guile/2.2/site-ccache/gnu/packages/emacs.go
;;; note: source file /home/natsu/src/guix/gnu/packages/emacs.scm
;;;       newer than compiled /run/current-system/profile/lib/guile/2.2/site-ccache/gnu/packages/emacs.go
substitute: updating list of substitutes from 'https://berlin.guixsd.org'... 100.0%
substitute: updating list of substitutes from 'https://mirror.hydra.gnu.org'... 100.0%
substitute: updating list of substitutes from 'https://hydra.gnu.org'... 100.0%
The following derivation will be built:
   /gnu/store/zjfh5lf4gaxrliwsihj9i80x9n15smkn-emacs-emacsql-2.0.3.drv
@ build-started /gnu/store/zjfh5lf4gaxrliwsihj9i80x9n15smkn-emacs-emacsql-2.0.3.drv - x86_64-linux /var/log/guix/drvs/zj//fh5lf4gaxrliwsihj9i80x9n15smkn-emacs-emacsql-2.0.3.drv.bz2
starting phase `set-SOURCE-DATE-EPOCH'
phase `set-SOURCE-DATE-EPOCH' succeeded after 0.0 seconds
starting phase `set-paths'
environment variable `PATH' set to `/gnu/store/k9slb2ysqp2n82pl6knb2isapav81dvx-tar-1.29/bin:/gnu/store/4r1g01m0isdfd4ahd8qigfp04276biv3-gzip-1.8/bin:/gnu/store/77l8sxh9py133cy1p9kypshji4q9wv0w-bzip2-1.0.6/bin:/gnu/store/kgaf671a9a76k0ql1pwwjxjbj80x22mj-xz-5.2.3/bin:/gnu/store/p7vdir85501lq7qsgrx5z2yrr0py26h1-file-5.32/bin:/gnu/store/rp61rxvajx4w1k0ci2nqi10y8xgds53b-diffutils-3.6/bin:/gnu/store/5gq1gn722zpz1crsnfmxij21zdxqj37x-patch-2.7.5/bin:/gnu/store/z24b9d81w7bfcyk3j73xixygwx2ymlhv-sed-4.4/bin:/gnu/store/0qxdnkyh0cqwflxhqa4v4vsjwff08j9p-findutils-4.6.0/bin:/gnu/store/1ymg8yf9imgw8ac4n3i611nsv1mb4643-gawk-4.1.4/bin:/gnu/store/5jhfm3r3h7cjl8qqc86rx70nw7bzizpf-grep-3.1/bin:/gnu/store/6i33ik7haav0hd5a797l3llkq04ghx6g-coreutils-8.28/bin:/gnu/store/vj24ah9a4kqsyhim2s4n6gvc4hsxhnli-make-4.2.1/bin:/gnu/store/icz3hd36aqpjz5slyp4hhr8wsfbgiml1-bash-minimal-4.4.12/bin:/gnu/store/37h89zknsp0p6nsszc1n4lyxc9s393ak-ld-wrapper-0/bin:/gnu/store/j7gsbkgq72qjas7plzvak40ymf0ybamq-binutils-2.28.1/bin:/gnu/store/cfdn69spjc44x4sd0acrwhxq6yay3rbc-gcc-5.5.0/bin:/gnu/store/n6acaivs0jwiwpidjr551dhdni5kgpcr-glibc-2.26.105-g0890d5379c/bin:/gnu/store/n6acaivs0jwiwpidjr551dhdni5kgpcr-glibc-2.26.105-g0890d5379c/sbin:/gnu/store/10sdmjxi2qv1z4v3pzsvhj7ycv62bi0n-emacs-minimal-25.3/bin:/gnu/store/vhdmylfq7vdfrpj0xqyf9kp833v6akbs-mysql-5.7.21/bin:/gnu/store/z0pyjzkv6c8mr3i9z6hmvnskf7471lbf-postgresql-10.3/bin'
environment variable `BASH_LOADABLES_PATH' unset
environment variable `C_INCLUDE_PATH' set to `/gnu/store/77l8sxh9py133cy1p9kypshji4q9wv0w-bzip2-1.0.6/include:/gnu/store/kgaf671a9a76k0ql1pwwjxjbj80x22mj-xz-5.2.3/include:/gnu/store/p7vdir85501lq7qsgrx5z2yrr0py26h1-file-5.32/include:/gnu/store/1ymg8yf9imgw8ac4n3i611nsv1mb4643-gawk-4.1.4/include:/gnu/store/vj24ah9a4kqsyhim2s4n6gvc4hsxhnli-make-4.2.1/include:/gnu/store/j7gsbkgq72qjas7plzvak40ymf0ybamq-binutils-2.28.1/include:/gnu/store/cfdn69spjc44x4sd0acrwhxq6yay3rbc-gcc-5.5.0/include:/gnu/store/n6acaivs0jwiwpidjr551dhdni5kgpcr-glibc-2.26.105-g0890d5379c/include:/gnu/store/vhdmylfq7vdfrpj0xqyf9kp833v6akbs-mysql-5.7.21/include:/gnu/store/z0pyjzkv6c8mr3i9z6hmvnskf7471lbf-postgresql-10.3/include:/gnu/store/yqahwgll57j88bq275m4xvifg9x3alsb-linux-libre-headers-4.9.59/include'
environment variable `CPLUS_INCLUDE_PATH' set to `/gnu/store/77l8sxh9py133cy1p9kypshji4q9wv0w-bzip2-1.0.6/include:/gnu/store/kgaf671a9a76k0ql1pwwjxjbj80x22mj-xz-5.2.3/include:/gnu/store/p7vdir85501lq7qsgrx5z2yrr0py26h1-file-5.32/include:/gnu/store/1ymg8yf9imgw8ac4n3i611nsv1mb4643-gawk-4.1.4/include:/gnu/store/vj24ah9a4kqsyhim2s4n6gvc4hsxhnli-make-4.2.1/include:/gnu/store/j7gsbkgq72qjas7plzvak40ymf0ybamq-binutils-2.28.1/include:/gnu/store/cfdn69spjc44x4sd0acrwhxq6yay3rbc-gcc-5.5.0/include:/gnu/store/n6acaivs0jwiwpidjr551dhdni5kgpcr-glibc-2.26.105-g0890d5379c/include:/gnu/store/vhdmylfq7vdfrpj0xqyf9kp833v6akbs-mysql-5.7.21/include:/gnu/store/z0pyjzkv6c8mr3i9z6hmvnskf7471lbf-postgresql-10.3/include:/gnu/store/yqahwgll57j88bq275m4xvifg9x3alsb-linux-libre-headers-4.9.59/include'
environment variable `LIBRARY_PATH' set to `/gnu/store/77l8sxh9py133cy1p9kypshji4q9wv0w-bzip2-1.0.6/lib:/gnu/store/kgaf671a9a76k0ql1pwwjxjbj80x22mj-xz-5.2.3/lib:/gnu/store/p7vdir85501lq7qsgrx5z2yrr0py26h1-file-5.32/lib:/gnu/store/1ymg8yf9imgw8ac4n3i611nsv1mb4643-gawk-4.1.4/lib:/gnu/store/j7gsbkgq72qjas7plzvak40ymf0ybamq-binutils-2.28.1/lib:/gnu/store/n6acaivs0jwiwpidjr551dhdni5kgpcr-glibc-2.26.105-g0890d5379c/lib:/gnu/store/hrhxx37z97j7pniyr437illc0b5qq9pa-glibc-2.26.105-g0890d5379c-static/lib:/gnu/store/q7jz2as54ycdvjg7zggxxjkxjrp6d5mr-glibc-utf8-locales-2.26.105-g0890d5379c/lib:/gnu/store/vhdmylfq7vdfrpj0xqyf9kp833v6akbs-mysql-5.7.21/lib:/gnu/store/z0pyjzkv6c8mr3i9z6hmvnskf7471lbf-postgresql-10.3/lib'
environment variable `GUIX_LOCPATH' set to `/gnu/store/q7jz2as54ycdvjg7zggxxjkxjrp6d5mr-glibc-utf8-locales-2.26.105-g0890d5379c/lib/locale'
environment variable `INFOPATH' set to `/gnu/store/k9slb2ysqp2n82pl6knb2isapav81dvx-tar-1.29/share/info:/gnu/store/4r1g01m0isdfd4ahd8qigfp04276biv3-gzip-1.8/share/info:/gnu/store/rp61rxvajx4w1k0ci2nqi10y8xgds53b-diffutils-3.6/share/info:/gnu/store/z24b9d81w7bfcyk3j73xixygwx2ymlhv-sed-4.4/share/info:/gnu/store/0qxdnkyh0cqwflxhqa4v4vsjwff08j9p-findutils-4.6.0/share/info:/gnu/store/1ymg8yf9imgw8ac4n3i611nsv1mb4643-gawk-4.1.4/share/info:/gnu/store/5jhfm3r3h7cjl8qqc86rx70nw7bzizpf-grep-3.1/share/info:/gnu/store/6i33ik7haav0hd5a797l3llkq04ghx6g-coreutils-8.28/share/info:/gnu/store/vj24ah9a4kqsyhim2s4n6gvc4hsxhnli-make-4.2.1/share/info:/gnu/store/icz3hd36aqpjz5slyp4hhr8wsfbgiml1-bash-minimal-4.4.12/share/info:/gnu/store/j7gsbkgq72qjas7plzvak40ymf0ybamq-binutils-2.28.1/share/info:/gnu/store/cfdn69spjc44x4sd0acrwhxq6yay3rbc-gcc-5.5.0/share/info:/gnu/store/n6acaivs0jwiwpidjr551dhdni5kgpcr-glibc-2.26.105-g0890d5379c/share/info:/gnu/store/10sdmjxi2qv1z4v3pzsvhj7ycv62bi0n-emacs-minimal-25.3/share/info'
phase `set-paths' succeeded after 0.0 seconds
starting phase `install-locale'
using 'en_US.utf8' locale for category "LC_ALL"
phase `install-locale' succeeded after 0.0 seconds
starting phase `unpack'
emacsql-2.0.3/
emacsql-2.0.3/.dir-locals.el
emacsql-2.0.3/.gitignore
emacsql-2.0.3/Makefile
emacsql-2.0.3/README.md
emacsql-2.0.3/UNLICENSE
emacsql-2.0.3/emacsql-compiler.el
emacsql-2.0.3/emacsql-mysql.el
emacsql-2.0.3/emacsql-pg.el
emacsql-2.0.3/emacsql-psql.el
emacsql-2.0.3/emacsql-sqlite.el
emacsql-2.0.3/emacsql-system.el
emacsql-2.0.3/emacsql.el
emacsql-2.0.3/sqlite/
emacsql-2.0.3/sqlite/.gitignore
emacsql-2.0.3/sqlite/Makefile
emacsql-2.0.3/sqlite/emacsql.c
emacsql-2.0.3/sqlite/sqlite3.c
emacsql-2.0.3/sqlite/sqlite3.h
emacsql-2.0.3/tests/
emacsql-2.0.3/tests/.nosearch
emacsql-2.0.3/tests/emacsql-compiler-tests.el
emacsql-2.0.3/tests/emacsql-external-tests.el
emacsql-2.0.3/tests/emacsql-tests.el
phase `unpack' succeeded after 0.0 seconds
starting phase `patch-usr-bin-file'
phase `patch-usr-bin-file' succeeded after 0.0 seconds
starting phase `patch-source-shebangs'
phase `patch-source-shebangs' succeeded after 0.0 seconds
starting phase `patch-generated-file-shebangs'
phase `patch-generated-file-shebangs' succeeded after 0.0 seconds
starting phase `patch-elisp-shell-shebangs'
phase `patch-elisp-shell-shebangs' succeeded after 0.0 seconds
starting phase `setenv-emacsloadpath'
Backtrace:
           5 (primitive-load "/gnu/store/qr6bdp56ccgnj02znamwngjvlpp…")
In ice-9/eval.scm:
   191:35  4 (_ #f)
In srfi/srfi-1.scm:
   863:16  3 (every1 #<procedure 92c860 at /gnu/store/dniwjwywb9lkd…> …)
In /gnu/store/dniwjwywb9lkdxwa6sn3hcpm4bbm6r32-module-import/guix/build/gnu-build-system.scm:
   711:27  2 (_ _)
In ice-9/eval.scm:
    619:8  1 (_ #(#(#<directory (guile-user) 7ce140>) (("s…" . #) …)))
In /gnu/store/dniwjwywb9lkdxwa6sn3hcpm4bbm6r32-module-import/guix/build/emacs-build-system.scm:
     77:0  0 (set-emacs-load-path #:inputs _)

/gnu/store/dniwjwywb9lkdxwa6sn3hcpm4bbm6r32-module-import/guix/build/emacs-build-system.scm:77:0: In procedure set-emacs-load-path:
Invalid keyword: (("source" . "/gnu/store/304az1rlv6nbmfq661yfv4r89y6z4dpb-emacs-emacsql-2.0.3.tar.gz") ("tar" . "/gnu/store/k9slb2ysqp2n82pl6knb2isapav81dvx-tar-1.29") ("gzip" . "/gnu/store/4r1g01m0isdfd4ahd8qigfp04276biv3-gzip-1.8") ("bzip2" . "/gnu/store/77l8sxh9py133cy1p9kypshji4q9wv0w-bzip2-1.0.6") ("xz" . "/gnu/store/kgaf671a9a76k0ql1pwwjxjbj80x22mj-xz-5.2.3") ("file" . "/gnu/store/p7vdir85501lq7qsgrx5z2yrr0py26h1-file-5.32") ("diffutils" . "/gnu/store/rp61rxvajx4w1k0ci2nqi10y8xgds53b-diffutils-3.6") ("patch" . "/gnu/store/5gq1gn722zpz1crsnfmxij21zdxqj37x-patch-2.7.5") ("sed" . "/gnu/store/z24b9d81w7bfcyk3j73xixygwx2ymlhv-sed-4.4") ("findutils" . "/gnu/store/0qxdnkyh0cqwflxhqa4v4vsjwff08j9p-findutils-4.6.0") ("gawk" . "/gnu/store/1ymg8yf9imgw8ac4n3i611nsv1mb4643-gawk-4.1.4") ("grep" . "/gnu/store/5jhfm3r3h7cjl8qqc86rx70nw7bzizpf-grep-3.1") ("coreutils" . "/gnu/store/6i33ik7haav0hd5a797l3llkq04ghx6g-coreutils-8.28") ("make" . "/gnu/store/vj24ah9a4kqsyhim2s4n6gvc4hsxhnli-make-4.2.1") ("bash" . "/gnu/store/icz3hd36aqpjz5slyp4hhr8wsfbgiml1-bash-minimal-4.4.12") ("ld-wrapper" . "/gnu/store/37h89zknsp0p6nsszc1n4lyxc9s393ak-ld-wrapper-0") ("binutils" . "/gnu/store/j7gsbkgq72qjas7plzvak40ymf0ybamq-binutils-2.28.1") ("gcc" . "/gnu/store/cfdn69spjc44x4sd0acrwhxq6yay3rbc-gcc-5.5.0") ("libc" . "/gnu/store/n6acaivs0jwiwpidjr551dhdni5kgpcr-glibc-2.26.105-g0890d5379c") ("libc:static" . "/gnu/store/hrhxx37z97j7pniyr437illc0b5qq9pa-glibc-2.26.105-g0890d5379c-static") ("locales" . "/gnu/store/q7jz2as54ycdvjg7zggxxjkxjrp6d5mr-glibc-utf8-locales-2.26.105-g0890d5379c") ("emacs-minimal" . "/gnu/store/10sdmjxi2qv1z4v3pzsvhj7ycv62bi0n-emacs-minimal-25.3") ("mysql" . "/gnu/store/vhdmylfq7vdfrpj0xqyf9kp833v6akbs-mysql-5.7.21") ("postgresql" . "/gnu/store/z0pyjzkv6c8mr3i9z6hmvnskf7471lbf-postgresql-10.3") ("emacs-finalize" . "/gnu/store/dz0glc49z7nlx37fcjdf3w9gd736cbib-emacs-finalize-2.0.0") ("emacs-pg" . "/gnu/store/jhqq4v9i6d9zl248z10nmdvk7l8m3h6g-emacs-pg-0.1-1.4f6516e") ("kernel-headers" . "/gnu/store/yqahwgll57j88bq275m4xvifg9x3alsb-linux-libre-headers-4.9.59") ("emacs-cl-generic" . "/gnu/store/d5lnalnrxa2ia2hjzbs2bqw4srlr9777-emacs-cl-generic-0.3"))
builder for `/gnu/store/zjfh5lf4gaxrliwsihj9i80x9n15smkn-emacs-emacsql-2.0.3.drv' failed with exit code 1
@ build-failed /gnu/store/zjfh5lf4gaxrliwsihj9i80x9n15smkn-emacs-emacsql-2.0.3.drv - 1 builder for `/gnu/store/zjfh5lf4gaxrliwsihj9i80x9n15smkn-emacs-emacsql-2.0.3.drv' failed with exit code 1
guix build: error: build failed: build of `/gnu/store/zjfh5lf4gaxrliwsihj9i80x9n15smkn-emacs-emacsql-2.0.3.drv' failed
--8<---------------cut here---------------end--------------->8---

I've fixed all linter warnings reported by this command:
--8<---------------cut here---------------start------------->8---
./pre-inst-env env GUIX_PACKAGE_PATH= guix lint $(PAGER= git log --oneline | head -n 6 | cut -d ' ' -f 4 | sed 's/\.//' | tr '\n' ' ')
--8<---------------cut here---------------end--------------->8---

Also I've tested an Emacs ‘epkg-list-packages’ procedure inside:
--8<---------------cut here---------------start------------->8---
./pre-inst-env env GUIX_PACKAGE_PATH= guix environment --no-grafts --ad-hoc emacs-epkg emacs
--8<---------------cut here---------------end--------------->8---

I could push a set of patches without ‘set-emacs-load-path’.  WDYT?

Oleg.