[PATCH] build: emacs: Install only a subset of files.

  • Done
  • quality assurance status badge
Details
4 participants
  • Alex Kost
  • Arun Isaac
  • Ludovic Courtès
  • tumashu
Owner
unassigned
Submitted by
Arun Isaac
Severity
normal
A
A
Arun Isaac wrote on 19 Apr 2017 09:35
(address . guix-patches@gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
cc8200d5.AEMAJWr4p0UAAAAAAAAAAAOtUOAAAAACwQwAAAAAAAW9WABY9xNR@mailjet.com
* guix/build/emacs-build-system.scm (install): Install files matching
#:include while excluding files matching #:exclude.
* guix/build-system/emacs.scm (emacs-build): Add keyword arguments #:include
and #:exclude.
---
guix/build-system/emacs.scm | 6 ++++++
guix/build/emacs-build-system.scm | 24 +++++++++++++++++++++---
2 files changed, 27 insertions(+), 3 deletions(-)

Toggle diff (73 lines)
diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
index a7982002b..e6c021c7e 100644
--- a/guix/build-system/emacs.scm
+++ b/guix/build-system/emacs.scm
@@ -83,6 +83,10 @@
(phases '(@ (guix build emacs-build-system)
%standard-phases))
(outputs '("out"))
+ (include ''(".*.el$" ".*.el.in$" "^dir$"
+ ".*.info$" ".*.texi$" ".*.texinfo$"
+ "doc/dir" "doc/*.info$" "doc/*.texi$" "doc/*.texinfo$"))
+ (exclude ''("^.dir-locals.el$" "^test.el$" "^tests.el$" ".*-test.el$" ".*-tests.el$"))
(search-paths '())
(system (%current-system))
(guile #f)
@@ -108,6 +112,8 @@
#:tests? ,tests?
#:phases ,phases
#:outputs %outputs
+ #:include ,include
+ #:exclude ,exclude
#:search-paths ',(map search-path-specification->sexp
search-paths)
#:inputs %build-inputs)))
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index 44e8b0d31..579596d72 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -28,6 +28,7 @@
#:use-module (ice-9 rdelim)
#:use-module (ice-9 regex)
#:use-module (ice-9 match)
+ #:use-module (ice-9 ftw)
#:export (%standard-phases
emacs-build))
@@ -93,14 +94,31 @@ store in '.el' files."
(substitute-cmd))))
#t))
-(define* (install #:key outputs #:allow-other-keys)
+(define* (install #:key outputs
+ (include '(".*.el$" ".*.el.in$" "^dir$"
+ ".*.info$" ".*.texi$" ".*.texinfo$"
+ "^doc/dir" "^doc/*.info$" "^doc/*.texi$" "^doc/*.texinfo$"))
+ (exclude '("^.dir-locals.el$" "^test.el$" "^tests.el$" ".*-test.el$" ".*-tests.el$"))
+ #:allow-other-keys)
"Install the package contents."
+
+ (define (include-file? file)
+ (and (any (cut string-match <> file) include)
+ (not (any (cut string-match <> file) exclude))))
+
(let* ((out (assoc-ref outputs "out"))
(elpa-name-ver (store-directory->elpa-name-version out))
(src-dir (getcwd))
(tgt-dir (string-append out %install-suffix "/" elpa-name-ver)))
- (copy-recursively src-dir tgt-dir)
- #t))
+ (ftw src-dir
+ (lambda (file stat flag)
+ (let ((stripped-file (substring file (string-length src-dir))))
+ (when (and (eq? flag 'regular)
+ (include-file? (string-trim stripped-file #\/)))
+ (format #t "`~a' -> `~a'~%"
+ file (string-append tgt-dir stripped-file))
+ (install-file file tgt-dir)))
+ #t))))
(define* (move-doc #:key outputs #:allow-other-keys)
"Move info files from the ELPA package directory to the info directory."
--
2.12.2
T
T
tumashu wrote on 19 Apr 2017 09:43
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(address . 26559@debbugs.gnu.org)
6c8662dc.6f62.15b852a19eb.Coremail.tumashu@163.com
What about package-pkg.el file?.








At 2017-04-19 15:35:25, "Arun Isaac" <arunisaac@systemreboot.net> wrote:
Toggle quote (86 lines)
>* guix/build/emacs-build-system.scm (install): Install files matching
> #:include while excluding files matching #:exclude.
>* guix/build-system/emacs.scm (emacs-build): Add keyword arguments #:include
> and #:exclude.
>---
> guix/build-system/emacs.scm | 6 ++++++
> guix/build/emacs-build-system.scm | 24 +++++++++++++++++++++---
> 2 files changed, 27 insertions(+), 3 deletions(-)
>
>diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
>index a7982002b..e6c021c7e 100644
>--- a/guix/build-system/emacs.scm
>+++ b/guix/build-system/emacs.scm
>@@ -83,6 +83,10 @@
> (phases '(@ (guix build emacs-build-system)
> %standard-phases))
> (outputs '("out"))
>+ (include ''(".*.el$" ".*.el.in$" "^dir$"
>+ ".*.info$" ".*.texi$" ".*.texinfo$"
>+ "doc/dir" "doc/*.info$" "doc/*.texi$" "doc/*.texinfo$"))
>+ (exclude ''("^.dir-locals.el$" "^test.el$" "^tests.el$" ".*-test.el$" ".*-tests.el$"))
> (search-paths '())
> (system (%current-system))
> (guile #f)
>@@ -108,6 +112,8 @@
> #:tests? ,tests?
> #:phases ,phases
> #:outputs %outputs
>+ #:include ,include
>+ #:exclude ,exclude
> #:search-paths ',(map search-path-specification->sexp
> search-paths)
> #:inputs %build-inputs)))
>diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
>index 44e8b0d31..579596d72 100644
>--- a/guix/build/emacs-build-system.scm
>+++ b/guix/build/emacs-build-system.scm
>@@ -28,6 +28,7 @@
> #:use-module (ice-9 rdelim)
> #:use-module (ice-9 regex)
> #:use-module (ice-9 match)
>+ #:use-module (ice-9 ftw)
> #:export (%standard-phases
> emacs-build))
>
>@@ -93,14 +94,31 @@ store in '.el' files."
> (substitute-cmd))))
> #t))
>
>-(define* (install #:key outputs #:allow-other-keys)
>+(define* (install #:key outputs
>+ (include '(".*.el$" ".*.el.in$" "^dir$"
>+ ".*.info$" ".*.texi$" ".*.texinfo$"
>+ "^doc/dir" "^doc/*.info$" "^doc/*.texi$" "^doc/*.texinfo$"))
>+ (exclude '("^.dir-locals.el$" "^test.el$" "^tests.el$" ".*-test.el$" ".*-tests.el$"))
>+ #:allow-other-keys)
> "Install the package contents."
>+
>+ (define (include-file? file)
>+ (and (any (cut string-match <> file) include)
>+ (not (any (cut string-match <> file) exclude))))
>+
> (let* ((out (assoc-ref outputs "out"))
> (elpa-name-ver (store-directory->elpa-name-version out))
> (src-dir (getcwd))
> (tgt-dir (string-append out %install-suffix "/" elpa-name-ver)))
>- (copy-recursively src-dir tgt-dir)
>- #t))
>+ (ftw src-dir
>+ (lambda (file stat flag)
>+ (let ((stripped-file (substring file (string-length src-dir))))
>+ (when (and (eq? flag 'regular)
>+ (include-file? (string-trim stripped-file #\/)))
>+ (format #t "`~a' -> `~a'~%"
>+ file (string-append tgt-dir stripped-file))
>+ (install-file file tgt-dir)))
>+ #t))))
>
> (define* (move-doc #:key outputs #:allow-other-keys)
> "Move info files from the ELPA package directory to the info directory."
>--
>2.12.2
>
>
>
>
Attachment: file
A
A
Arun Isaac wrote on 19 Apr 2017 09:55
Re: [PATCH] build: emacs: Install only a subset of files.
(address . 26559@debbugs.gnu.org)
bf6d9203.AEUAJJ_62WgAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABY9xfl@mailjet.com
This is a work in progress patch for the discussion at

All feedback welcome!

Arun Isaac writes:

Toggle quote (5 lines)
> + (include ''(".*.el$" ".*.el.in$" "^dir$"
> + ".*.info$" ".*.texi$" ".*.texinfo$"
> + "doc/dir" "doc/*.info$" "doc/*.texi$" "doc/*.texinfo$"))
> + (exclude ''("^.dir-locals.el$" "^test.el$" "^tests.el$" ".*-test.el$" ".*-tests.el$"))

I've copied all this from MELPA's default :files property described at
https://github.com/melpa/melpa. I have no idea what the rationale for
some of these regexes are.

Currently, include and exclude are a list of regexes that file names are
matched against. Should this be combined into one big regex?

Would it be a good idea to add a third keyword argument, say
#:documentation, that will select info documentation files and install
them separately in some other directory?
A
A
Arun Isaac wrote on 19 Apr 2017 11:23
Re: bug#26559: [PATCH] build: emacs: Install only a subset of files.
(address . 26559@debbugs.gnu.org)
c9a183fe.AEQAJcMSQmcAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABY9yyc@mailjet.com
tumashu writes:

Toggle quote (2 lines)
> What about package-pkg.el file?.

What about it? I am not familiar with this file. Could you please
elaborate?
T
T
tumashu wrote on 19 Apr 2017 11:57
Re:bug#26559: [PATCH] build: emacs: Install only a subset of files.
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(name . 26559@debbugs.gnu.org)(address . 26559@debbugs.gnu.org)
6068eafc.9594.15b85a56839.Coremail.tumashu@163.com
*.pkg.el seem to be used by emacs package.el, which can not be compile without warn. I can not find the document.
this need to be verify.


At 2017-04-19 17:23:24, "Arun Isaac" <arunisaac@systemreboot.net> wrote:
Toggle quote (10 lines)
>
>tumashu writes:
>
>> What about package-pkg.el file?.
>
>What about it? I am not familiar with this file. Could you please
>elaborate?
>
>
>
Attachment: file
A
A
Arun Isaac wrote on 19 Apr 2017 16:26
Re: bug#26559: [PATCH] build: emacs: Install only a subset of files.
(name . 26559@debbugs.gnu.org)(address . 26559@debbugs.gnu.org)
968f0dff.ADsAAHQpxPwAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABY93OF@mailjet.com
tumashu writes:

Toggle quote (3 lines)
> *.pkg.el seem to be used by emacs package.el, which can not be compile
> without warn. I can not find the document. this need to be verify.

In the current implementation, *.pkg.el files will be installed due to
the ".*.el" regexp in #:include. So, this is not an issue.
T
T
tumashu wrote on 20 Apr 2017 04:26
Re:bug#26559: [PATCH] build: emacs: Install only a subset of files.
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(name . 26559@debbugs.gnu.org)(address . 26559@debbugs.gnu.org)
49e327f1.35e2.15b892e80c0.Coremail.tumashu@163.com
PACKAGE-pkg.el seem to *only* useful to package.el, it is useless for guix emacs package.

The below is come from package.el's commentary


#+BEGIN_COMMENT

;; A package is described by its name and version. The distribution
;; format is either a tar file or a single .el file.

;; A tar file should be named "NAME-VERSION.tar". The tar file must
;; unpack into a directory named after the package and version:
;; "NAME-VERSION". It must contain a file named "PACKAGE-pkg.el"
;; which consists of a call to define-package. It may also contain a
;; "dir" file and the info files it references.

;; A .el file is named "NAME-VERSION.el" in the remote archive, but is
;; installed as simply "NAME.el" in a directory named "NAME-VERSION".

#+END_COMMENT








At 2017-04-19 22:26:06, "Arun Isaac" <arunisaac@systemreboot.net> wrote:
Toggle quote (11 lines)
>
>tumashu writes:
>
>> *.pkg.el seem to be used by emacs package.el, which can not be compile
>> without warn. I can not find the document. this need to be verify.
>
>In the current implementation, *.pkg.el files will be installed due to
>the ".*.el" regexp in #:include. So, this is not an issue.
>
>
>
Attachment: file
A
A
Arun Isaac wrote on 20 Apr 2017 10:43
Re: bug#26559: [PATCH] build: emacs: Install only a subset of files.
(address . 26559@debbugs.gnu.org)
1c00c312.AEEAJsZ1aH8AAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABY-HSy@mailjet.com
tumashu writes:

Toggle quote (2 lines)
> it is useless for guix emacs package.

If it is unnecessary we can simply include one more regexp to the
#:exclude keyword argument so that it does not get installed.
A
A
Alex Kost wrote on 20 Apr 2017 13:39
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(address . 26559@debbugs.gnu.org)
877f2fqpeb.fsf@gmail.com
Arun Isaac (2017-04-19 13:25 +0530) wrote:

Toggle quote (5 lines)
> This is a work in progress patch for the discussion at
> https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00274.html
>
> All feedback welcome!

Great, thanks for working on it!

Toggle quote (11 lines)
> Arun Isaac writes:
>
>> + (include ''(".*.el$" ".*.el.in$" "^dir$"
>> + ".*.info$" ".*.texi$" ".*.texinfo$"
>> + "doc/dir" "doc/*.info$" "doc/*.texi$" "doc/*.texinfo$"))
>> + (exclude ''("^.dir-locals.el$" "^test.el$" "^tests.el$" ".*-test.el$" ".*-tests.el$"))
>
> I've copied all this from MELPA's default :files property described at
> https://github.com/melpa/melpa . I have no idea what the rationale for
> some of these regexes are.

What regexps are not clear for you?

Toggle quote (3 lines)
> Currently, include and exclude are a list of regexes that file names are
> matched against. Should this be combined into one big regex?

I think it is not needed, it is more clean to separate regexps.

Toggle quote (4 lines)
> Would it be a good idea to add a third keyword argument, say
> #:documentation, that will select info documentation files and install
> them separately in some other directory?

Regarding documentation: note that it is already installed into the
proper place. I mean if the package has ".info" files, they are
installed into "share/info" (look at 'move-doc' procedure in (guix build
emacs-build-system) module). For example, 'emacs-debbugs' has the info
manual and it is installed appropriately. So I think #:documentation is
not needed.

Also I would like to note that this patch (when it will be ready)
shouldn't be committed alone: there are some emacs packages that should
be adjusted to include additional files. One that comes to mind is
'emacs-slime' - it *must* contain *.lisp files (and other files as
Otherwise, it wouldn't work at all.

So I think this patch should be committed with the according fixes for
such "complex" packages (not sure if there are other ones along with
'emacs-slime').

--
Alex
A
A
Alex Kost wrote on 20 Apr 2017 13:50
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(address . 26559@debbugs.gnu.org)
8760hzqovi.fsf@gmail.com
Arun Isaac (2017-04-20 14:13 +0530) wrote:

Toggle quote (7 lines)
> tumashu writes:
>
>> it is useless for guix emacs package.
>
> If it is unnecessary we can simply include one more regexp to the
> #:exclude keyword argument so that it does not get installed.

Yes, it is completely unnecessary for Guix, so it can be excluded.

--
Alex
A
A
Arun Isaac wrote on 20 Apr 2017 14:52
(address . 26559@debbugs.gnu.org)
628c0262.AEEAJtCcXW0AAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABY-K8Y@mailjet.com
Toggle quote (11 lines)
>>> + (include ''(".*.el$" ".*.el.in$" "^dir$"
>>> + ".*.info$" ".*.texi$" ".*.texinfo$"
>>> + "doc/dir" "doc/*.info$" "doc/*.texi$" "doc/*.texinfo$"))
>>> + (exclude ''("^.dir-locals.el$" "^test.el$" "^tests.el$" ".*-test.el$" ".*-tests.el$"))
>>
>> I've copied all this from MELPA's default :files property described at
>> https://github.com/melpa/melpa . I have no idea what the rationale for
>> some of these regexes are.
>
> What regexps are not clear for you?

I don't understand what ".*.el.in$", "^dir$" and "doc/dir" are for.

Toggle quote (5 lines)
>> Currently, include and exclude are a list of regexes that file names are
>> matched against. Should this be combined into one big regex?
>
> I think it is not needed, it is more clean to separate regexps.

Ok. Also, please suggest better names if #:include and #:exclude are not
clear. Perhaps #:include-files and #:exclude-files, or #:install-files
and #:no-install-files ? Any other style changes to the code are also
welcome.

Toggle quote (7 lines)
> Regarding documentation: note that it is already installed into the
> proper place. I mean if the package has ".info" files, they are
> installed into "share/info" (look at 'move-doc' procedure in (guix build
> emacs-build-system) module). For example, 'emacs-debbugs' has the info
> manual and it is installed appropriately. So I think #:documentation is
> not needed.

Yeah, move-doc is good. I forgot about it.

Toggle quote (7 lines)
> Also I would like to note that this patch (when it will be ready)
> shouldn't be committed alone: there are some emacs packages that should
> be adjusted to include additional files. One that comes to mind is
> 'emacs-slime' - it *must* contain *.lisp files (and other files as
> listed at <https://github.com/melpa/melpa/blob/master/recipes/slime>).
> Otherwise, it wouldn't work at all.

For specific packages, we can always override the #:include and
#:exclude keyword arguments. Or, even replace the 'install phase if it
comes to that.

Toggle quote (4 lines)
> So I think this patch should be committed with the according fixes for
> such "complex" packages (not sure if there are other ones along with
> 'emacs-slime').

Is there some standard workflow for testing packages when there is a
build system change? There are currently 154 packages in
gnu/packages/emacs.scm. Should I test them all?
A
A
Alex Kost wrote on 22 Apr 2017 21:56
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(address . 26559@debbugs.gnu.org)
87shl09pyg.fsf@gmail.com
Arun Isaac (2017-04-20 18:22 +0530) wrote:

Toggle quote (13 lines)
>>>> + (include ''(".*.el$" ".*.el.in$" "^dir$"
>>>> + ".*.info$" ".*.texi$" ".*.texinfo$"
>>>> + "doc/dir" "doc/*.info$" "doc/*.texi$" "doc/*.texinfo$"))
>>>> + (exclude ''("^.dir-locals.el$" "^test.el$" "^tests.el$" ".*-test.el$" ".*-tests.el$"))
>>>
>>> I've copied all this from MELPA's default :files property described at
>>> https://github.com/melpa/melpa . I have no idea what the rationale for
>>> some of these regexes are.
>>
>> What regexps are not clear for you?
>
> I don't understand what ".*.el.in$", "^dir$" and "doc/dir" are for.

"dir" file is for documentation (to make the according manual entry
appear in the top Info directory). These "dir" files are not needed for
Guix, as Guix generates "dir" after updating a profile
("<guix-profile>/share/info/dir").

Usually files with ".in" ending are used as templates to generate other
files from them (in this case ".el" from ".el.in"). It looks like there
are packages that have ".el.in" files but not ".el" files, and
package-build (used by melpa) just renames such files. At least that's
what I understood from:


But I'm sure we don't have the packages with ".el.in" files, and if we
will, most likely gnu-build-system will be used for them, so I suggest
to remove ".el.in" regexp from the "include" list.

Toggle quote (9 lines)
>>> Currently, include and exclude are a list of regexes that file names are
>>> matched against. Should this be combined into one big regex?
>>
>> I think it is not needed, it is more clean to separate regexps.
>
> Ok. Also, please suggest better names if #:include and #:exclude are not
> clear. Perhaps #:include-files and #:exclude-files, or #:install-files
> and #:no-install-files ?

I think include/exclude is OK. But maybe other people (if anyone else
reads this thread :-)) have other opinions.

[...]
Toggle quote (11 lines)
>> Also I would like to note that this patch (when it will be ready)
>> shouldn't be committed alone: there are some emacs packages that should
>> be adjusted to include additional files. One that comes to mind is
>> 'emacs-slime' - it *must* contain *.lisp files (and other files as
>> listed at <https://github.com/melpa/melpa/blob/master/recipes/slime>).
>> Otherwise, it wouldn't work at all.
>
> For specific packages, we can always override the #:include and
> #:exclude keyword arguments. Or, even replace the 'install phase if it
> comes to that.

Yes, that's what I meant.

Toggle quote (7 lines)
>> So I think this patch should be committed with the according fixes for
>> such "complex" packages (not sure if there are other ones along with
>> 'emacs-slime').
>
> Is there some standard workflow for testing packages when there is a
> build system change?

AFAIK, there is no standard workflow :-)

Toggle quote (3 lines)
> There are currently 154 packages in
> gnu/packages/emacs.scm. Should I test them all?

I think it would be too much work. I quickly looked at the emacs
packages, and I believe that only slime, auctex and yasnippet need to be
adjusted to include non-standard files. Of course, there may be other
packages that I'm not aware of, but they can be fixed later.

--
Alex
A
A
Alex Kost wrote on 22 Apr 2017 21:57
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(address . 26559@debbugs.gnu.org)
87r30k9pwu.fsf@gmail.com
Arun Isaac (2017-04-19 13:05 +0530) wrote:

Toggle quote (21 lines)
> * guix/build/emacs-build-system.scm (install): Install files matching
> #:include while excluding files matching #:exclude.
> * guix/build-system/emacs.scm (emacs-build): Add keyword arguments #:include
> and #:exclude.
> ---
> guix/build-system/emacs.scm | 6 ++++++
> guix/build/emacs-build-system.scm | 24 +++++++++++++++++++++---
> 2 files changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
> index a7982002b..e6c021c7e 100644
> --- a/guix/build-system/emacs.scm
> +++ b/guix/build-system/emacs.scm
> @@ -83,6 +83,10 @@
> (phases '(@ (guix build emacs-build-system)
> %standard-phases))
> (outputs '("out"))
> + (include ''(".*.el$" ".*.el.in$" "^dir$"
> + ".*.info$" ".*.texi$" ".*.texinfo$"
> + "doc/dir" "doc/*.info$" "doc/*.texi$" "doc/*.texinfo$"))

I think only ".*.el$", ".*.info$", and probably "doc/*.info$" are needed
here. The rest regexps look useless to me.

Note, however, that 'move-doc' procedure should be adjusted to find info
in "doc" subdir (for "doc/*.info$" regex).

Toggle quote (1 lines)
> + (exclude ''("^.dir-locals.el$" "^test.el$" "^tests.el$" ".*-test.el$" ".*-tests.el$"))
Don't forget to add ".*-pkg.el" here.

[...]
Toggle quote (7 lines)
> -(define* (install #:key outputs #:allow-other-keys)
> +(define* (install #:key outputs
> + (include '(".*.el$" ".*.el.in$" "^dir$"
> + ".*.info$" ".*.texi$" ".*.texinfo$"
> + "^doc/dir" "^doc/*.info$" "^doc/*.texi$" "^doc/*.texinfo$"))
> + (exclude '("^.dir-locals.el$" "^test.el$" "^tests.el$" ".*-test.el$" ".*-tests.el$"))

It doesn't look right that these regexps are duplicated in 2 places.
I'm not very familiar with build systems, but what if the
'include'/'exclude' arguments of 'install' procedure would simply be
empty lists? I think it wouldn't do harm if you leave these regexps
only in 'emacs-build' procedure or would it?

--
Alex
A
A
Arun Isaac wrote on 26 Apr 2017 16:09
[PATCH 2/3] gnu: emacs-slime: Add arguments to work with new `install' phase.
(address . 26559@debbugs.gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
05f43388.ADsAAHWtufMAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABZAKqN@mailjet.com
* gnu/packages/emacs.scm (emacs-slime)[arguments]: Add #:include and #:exclude
arguments.
---
gnu/packages/emacs.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 14d851184..9c919c49d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2333,7 +2333,10 @@ in @code{html-mode}.")
(native-inputs
`(("texinfo" ,texinfo)))
(arguments
- `(#:phases
+ `(#:include '("\\.el$" "\\.lisp$" "\\.asd$" "\\.goo$"
+ "\\.ss$" "\\.k$" "\\.scm$" "\\.rb$" "\\.sml$")
+ #:exclude '("^contrib/test/")
+ #:phases
(modify-phases %standard-phases
(add-before 'install 'configure
(lambda* _
--
2.12.2
A
A
Arun Isaac wrote on 26 Apr 2017 16:09
[PATCH 3/3] gnu: emacs-auctex: Add arguments to work with new `install' phase.
(address . 26559@debbugs.gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
03c35e3d.AEMAJpkR4_oAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABZAKsn@mailjet.com
* gnu/packages/emacs.scm (emacs-auctex)[arguments]: Add #:include and
#:exclude arguments.
---
gnu/packages/emacs.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 9c919c49d..d9cdcf2b5 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1197,7 +1197,10 @@ as a library for other Emacs packages.")
(build-system emacs-build-system)
;; We use 'emacs' because AUCTeX requires dbus at compile time
;; ('emacs-minimal' does not provide dbus).
- (arguments `(#:emacs ,emacs))
+ (arguments
+ `(#:emacs ,emacs
+ #:include '("\\.el$" "^images/" "^latex/" "\\.info$")
+ #:exclude '("^tests/" "^latex/README")))
(native-inputs
`(("perl" ,perl)))
(home-page "https://www.gnu.org/software/auctex/")
--
2.12.2
A
A
Arun Isaac wrote on 26 Apr 2017 16:09
[PATCH 1/3] build: emacs: Install only a subset of files.
(address . 26559@debbugs.gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
cb98c181.AEMAJpkR4roAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABZAKsn@mailjet.com
* guix/build/emacs-build-system.scm (install): Install files matching
#:include while excluding files matching #:exclude.
* guix/build-system/emacs.scm (emacs-build): Add keyword arguments #:include
and #:exclude.
---
guix/build-system/emacs.scm | 4 ++++
guix/build/emacs-build-system.scm | 25 +++++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)

Toggle diff (71 lines)
diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
index a7982002b..9a46ecfd2 100644
--- a/guix/build-system/emacs.scm
+++ b/guix/build-system/emacs.scm
@@ -83,6 +83,8 @@
(phases '(@ (guix build emacs-build-system)
%standard-phases))
(outputs '("out"))
+ (include ''("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$"))
+ (exclude ''("^\\.dir-locals\\.el$" "-pkg\\.el$" "^[^/]*tests?\\.el$"))
(search-paths '())
(system (%current-system))
(guile #f)
@@ -108,6 +110,8 @@
#:tests? ,tests?
#:phases ,phases
#:outputs %outputs
+ #:include ,include
+ #:exclude ,exclude
#:search-paths ',(map search-path-specification->sexp
search-paths)
#:inputs %build-inputs)))
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index 44e8b0d31..fefdbb96e 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -28,6 +28,7 @@
#:use-module (ice-9 rdelim)
#:use-module (ice-9 regex)
#:use-module (ice-9 match)
+ #:use-module (ice-9 ftw)
#:export (%standard-phases
emacs-build))
@@ -93,14 +94,30 @@ store in '.el' files."
(substitute-cmd))))
#t))
-(define* (install #:key outputs #:allow-other-keys)
+(define* (install #:key outputs
+ (include '("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$"))
+ (exclude '("^\\.dir-locals\\.el$" "-pkg\\.el$" "^[^/]*tests?\\.el$"))
+ #:allow-other-keys)
"Install the package contents."
+
+ (define src-dir (getcwd))
+
+ (define (install-file? file stat)
+ (let ((stripped-file (string-trim (substring file (string-length src-dir)) #\/)))
+ (and (any (cut string-match <> stripped-file) include)
+ (not (any (cut string-match <> stripped-file) exclude)))))
+
(let* ((out (assoc-ref outputs "out"))
(elpa-name-ver (store-directory->elpa-name-version out))
- (src-dir (getcwd))
(tgt-dir (string-append out %install-suffix "/" elpa-name-ver)))
- (copy-recursively src-dir tgt-dir)
- #t))
+ (for-each
+ (lambda (file)
+ (let* ((stripped-file (substring file (string-length src-dir)))
+ (tgt-file (string-append tgt-dir stripped-file)))
+ (format #t "`~a' -> `~a'~%" file tgt-file)
+ (install-file file (dirname tgt-file))))
+ (find-files src-dir install-file?)))
+ #t)
(define* (move-doc #:key outputs #:allow-other-keys)
"Move info files from the ELPA package directory to the info directory."
--
2.12.2
A
A
Arun Isaac wrote on 26 Apr 2017 16:20
Re: bug#26559: [PATCH] build: emacs: Install only a subset of files.
(address . 26559@debbugs.gnu.org)
ee075e95.AEUAJc4AQSAAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABZAKzU@mailjet.com
In the new patchset, I have cleaned up and removed some of the regexps,
as you suggested. I have also rewritten the logic using `find-files'
rather than with `ftw'.

Toggle quote (3 lines)
> Note, however, that 'move-doc' procedure should be adjusted to find
> info in "doc" subdir (for "doc/*.info$" regex).

I don't think the `move-doc' phase needs to be changed. It finds .info
files with `find-files' which is recursive.

Toggle quote (6 lines)
> It doesn't look right that these regexps are duplicated in 2 places.
> I'm not very familiar with build systems, but what if the
> 'include'/'exclude' arguments of 'install' procedure would simply be
> empty lists? I think it wouldn't do harm if you leave these regexps
> only in 'emacs-build' procedure or would it?

I am not too familiar with build systems, but I think the
include/exclude arguments need to be duplicated in two places. For
example, look at arguments #:strip-flags and #:strip-directories in the
`strip' phase of the gnu-build-system. Even there, the default values of
the arguments are repeated in two places.

Toggle quote (5 lines)
> I think it would be too much work. I quickly looked at the emacs
> packages, and I believe that only slime, auctex and yasnippet need to be
> adjusted to include non-standard files. Of course, there may be other
> packages that I'm not aware of, but they can be fixed later.

I've provided patches for emacs-slime and emacs-auctex packages as
well. I believe I got all the required files, but please check.

As it stands, emacs-yasnippet does not seem to need any changes. But, I
think the package is already broken. It needs a snippets directory
pulled from a git submodule. And, even the current package does not pull
this submodule. So, I believe the yasnippet package is already
broken. But, I don't use yasnippet, and I'm not too sure.
A
A
Alex Kost wrote on 2 May 2017 12:10
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(address . 26559@debbugs.gnu.org)
871ss736ys.fsf@gmail.com
Arun Isaac (2017-04-26 19:50 +0530) wrote:

Toggle quote (4 lines)
> In the new patchset, I have cleaned up and removed some of the regexps,
> as you suggested. I have also rewritten the logic using `find-files'
> rather than with `ftw'.

Great, thanks!

Toggle quote (6 lines)
>> Note, however, that 'move-doc' procedure should be adjusted to find
>> info in "doc" subdir (for "doc/*.info$" regex).
>
> I don't think the `move-doc' phase needs to be changed. It finds .info
> files with `find-files' which is recursive.

Oh, right.

Toggle quote (12 lines)
>> It doesn't look right that these regexps are duplicated in 2 places.
>> I'm not very familiar with build systems, but what if the
>> 'include'/'exclude' arguments of 'install' procedure would simply be
>> empty lists? I think it wouldn't do harm if you leave these regexps
>> only in 'emacs-build' procedure or would it?
>
> I am not too familiar with build systems, but I think the
> include/exclude arguments need to be duplicated in two places. For
> example, look at arguments #:strip-flags and #:strip-directories in the
> `strip' phase of the gnu-build-system. Even there, the default values of
> the arguments are repeated in two places.

Hm, ok, although I still think that these arguments are not needed to be
duplicated in 'install' procedure, but I'm not the one to judge about it.

Toggle quote (8 lines)
>> I think it would be too much work. I quickly looked at the emacs
>> packages, and I believe that only slime, auctex and yasnippet need to be
>> adjusted to include non-standard files. Of course, there may be other
>> packages that I'm not aware of, but they can be fixed later.
>
> I've provided patches for emacs-slime and emacs-auctex packages as
> well. I believe I got all the required files, but please check.

I personally don't use these packages, but I think they should be OK
now, thank you!

Toggle quote (4 lines)
> As it stands, emacs-yasnippet does not seem to need any changes. But, I
> think the package is already broken. It needs a snippets directory
> pulled from a git submodule.

Oh, right; last time I checked "yasnippet" (several years ago) this
"snippets" directory was a part of the repo.

Toggle quote (4 lines)
> And, even the current package does not pull
> this submodule. So, I believe the yasnippet package is already
> broken. But, I don't use yasnippet, and I'm not too sure.

Yeah, you are probably right, without snippets, yasnippet is… well,
let's say limited. But let's leave this problem for those who use
yasnippet :-)

Thank you for this work! I hope someone else will look at this thread
and will say "OK". As for me, I don't have any further comments and I
think it is ready to be committed. In the worst case there would be a
couple of broken emacs packages but they could be easily fixed.

--
Alex
A
A
Alex Kost wrote on 2 May 2017 12:10
Re: bug#26559: [PATCH 2/3] gnu: emacs-slime: Add arguments to work with new `install' phase.
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(address . 26559@debbugs.gnu.org)
87ziev1sdt.fsf@gmail.com
Arun Isaac (2017-04-26 19:39 +0530) wrote:

Toggle quote (18 lines)
> * gnu/packages/emacs.scm (emacs-slime)[arguments]: Add #:include and #:exclude
> arguments.
> ---
> gnu/packages/emacs.scm | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
> index 14d851184..9c919c49d 100644
> --- a/gnu/packages/emacs.scm
> +++ b/gnu/packages/emacs.scm
> @@ -2333,7 +2333,10 @@ in @code{html-mode}.")
> (native-inputs
> `(("texinfo" ,texinfo)))
> (arguments
> - `(#:phases
> + `(#:include '("\\.el$" "\\.lisp$" "\\.asd$" "\\.goo$"
> + "\\.ss$" "\\.k$" "\\.scm$" "\\.rb$" "\\.sml$")

All these additional files are placed in "contrib" directory, so what
about the following list:

#:include '("\\.el$" "\\.lisp$" "\\.asd$" "^contrib/")

Toggle quote (2 lines)
> + #:exclude '("^contrib/test/")

and excluding Makefile from there:

#:exclude '("^contrib/test/" "^contrib/Makefile")

Toggle quote (5 lines)
> + #:phases
> (modify-phases %standard-phases
> (add-before 'install 'configure
> (lambda* _

--
Alex
A
A
Arun Isaac wrote on 4 May 2017 08:04
(address . 26559@debbugs.gnu.org)
9f1f4e0e.AEEAKP-1KagAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABZCsSK@mailjet.com
Toggle quote (16 lines)
>> (arguments
>> - `(#:phases
>> + `(#:include '("\\.el$" "\\.lisp$" "\\.asd$" "\\.goo$"
>> + "\\.ss$" "\\.k$" "\\.scm$" "\\.rb$" "\\.sml$")
>
> All these additional files are placed in "contrib" directory, so what
> about the following list:
>
> #:include '("\\.el$" "\\.lisp$" "\\.asd$" "^contrib/")
>
>> + #:exclude '("^contrib/test/")
>
> and excluding Makefile from there:
>
> #:exclude '("^contrib/test/" "^contrib/Makefile")

Yes, this is a good idea. I'll send a new patchset as soon as possible.
A
A
Arun Isaac wrote on 4 May 2017 20:35
[PATCH 2/3] gnu: emacs-slime: Add arguments to work with new `install' phase.
(address . 26559@debbugs.gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
69fb1b9c.AEQAKESq4HQAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABZC3TE@mailjet.com
* gnu/packages/emacs.scm (emacs-slime)[arguments]: Add #:include and #:exclude
arguments.
---
gnu/packages/emacs.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 74f0ff8b5..8c27407a7 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -2333,7 +2333,9 @@ in @code{html-mode}.")
(native-inputs
`(("texinfo" ,texinfo)))
(arguments
- `(#:phases
+ `(#:include '("\\.el$" "\\.lisp$" "\\.asd$" "contrib")
+ #:exclude '("^contrib/test/" "^contrib/Makefile$" "^contrib/README.md$")
+ #:phases
(modify-phases %standard-phases
(add-before 'install 'configure
(lambda* _
--
2.12.2
A
A
Arun Isaac wrote on 4 May 2017 20:35
[PATCH 3/3] gnu: emacs-auctex: Add arguments to work with new `install' phase.
(address . 26559@debbugs.gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
54844865.AEEAKSDn3pcAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABZC3TW@mailjet.com
* gnu/packages/emacs.scm (emacs-auctex)[arguments]: Add #:include and
#:exclude arguments.
---
gnu/packages/emacs.scm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Toggle diff (18 lines)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 8c27407a7..b15767606 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -1197,7 +1197,10 @@ as a library for other Emacs packages.")
(build-system emacs-build-system)
;; We use 'emacs' because AUCTeX requires dbus at compile time
;; ('emacs-minimal' does not provide dbus).
- (arguments `(#:emacs ,emacs))
+ (arguments
+ `(#:emacs ,emacs
+ #:include '("\\.el$" "^images/" "^latex/" "\\.info$")
+ #:exclude '("^tests/" "^latex/README")))
(native-inputs
`(("perl" ,perl)))
(home-page "https://www.gnu.org/software/auctex/")
--
2.12.2
A
A
Arun Isaac wrote on 4 May 2017 20:35
[PATCH 1/3] build: emacs: Install only a subset of files.
(address . 26559@debbugs.gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
8e661119.AEEAKSDn4NYAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABZC3To@mailjet.com
* guix/build/emacs-build-system.scm (install): Install files matching
#:include while excluding files matching #:exclude.
* guix/build-system/emacs.scm (emacs-build): Add keyword arguments #:include
and #:exclude.
---
guix/build-system/emacs.scm | 4 ++++
guix/build/emacs-build-system.scm | 25 +++++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)

Toggle diff (71 lines)
diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
index a7982002b..9a46ecfd2 100644
--- a/guix/build-system/emacs.scm
+++ b/guix/build-system/emacs.scm
@@ -83,6 +83,8 @@
(phases '(@ (guix build emacs-build-system)
%standard-phases))
(outputs '("out"))
+ (include ''("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$"))
+ (exclude ''("^\\.dir-locals\\.el$" "-pkg\\.el$" "^[^/]*tests?\\.el$"))
(search-paths '())
(system (%current-system))
(guile #f)
@@ -108,6 +110,8 @@
#:tests? ,tests?
#:phases ,phases
#:outputs %outputs
+ #:include ,include
+ #:exclude ,exclude
#:search-paths ',(map search-path-specification->sexp
search-paths)
#:inputs %build-inputs)))
diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index 44e8b0d31..fefdbb96e 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -28,6 +28,7 @@
#:use-module (ice-9 rdelim)
#:use-module (ice-9 regex)
#:use-module (ice-9 match)
+ #:use-module (ice-9 ftw)
#:export (%standard-phases
emacs-build))
@@ -93,14 +94,30 @@ store in '.el' files."
(substitute-cmd))))
#t))
-(define* (install #:key outputs #:allow-other-keys)
+(define* (install #:key outputs
+ (include '("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info$"))
+ (exclude '("^\\.dir-locals\\.el$" "-pkg\\.el$" "^[^/]*tests?\\.el$"))
+ #:allow-other-keys)
"Install the package contents."
+
+ (define src-dir (getcwd))
+
+ (define (install-file? file stat)
+ (let ((stripped-file (string-trim (substring file (string-length src-dir)) #\/)))
+ (and (any (cut string-match <> stripped-file) include)
+ (not (any (cut string-match <> stripped-file) exclude)))))
+
(let* ((out (assoc-ref outputs "out"))
(elpa-name-ver (store-directory->elpa-name-version out))
- (src-dir (getcwd))
(tgt-dir (string-append out %install-suffix "/" elpa-name-ver)))
- (copy-recursively src-dir tgt-dir)
- #t))
+ (for-each
+ (lambda (file)
+ (let* ((stripped-file (substring file (string-length src-dir)))
+ (tgt-file (string-append tgt-dir stripped-file)))
+ (format #t "`~a' -> `~a'~%" file tgt-file)
+ (install-file file (dirname tgt-file))))
+ (find-files src-dir install-file?)))
+ #t)
(define* (move-doc #:key outputs #:allow-other-keys)
"Move info files from the ELPA package directory to the info directory."
--
2.12.2
A
A
Arun Isaac wrote on 4 May 2017 20:39
Re: bug#26559: [PATCH] build: emacs: Install only a subset of files.
(address . 26559@debbugs.gnu.org)
a21b65d1.AEEAKSDtWVwAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABZC3V1@mailjet.com
I've sent a new patchset. Now, we just have to wait for someone else to
look at this thread...
A
A
Arun Isaac wrote on 14 May 2017 15:42
(name . Alex Kost)(address . alezost@gmail.com)(address . 26559@debbugs.gnu.org)
5a0587f7.AEQAKXg1cDoAAAAAAAAAAAO2CuIAAAACwQwAAAAAAAW9WABZGF7v@mailjet.com
Ludo said (in another thread) that we should prefer `string-drop' to
`substring'. I'll make that change along with any others suggested by
others who review this patch.
A
A
Alex Kost wrote on 21 May 2017 11:14
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(address . 26559@debbugs.gnu.org)
87o9umh8r7.fsf@gmail.com
Arun Isaac (2017-05-05 00:09 +0530) wrote:

Toggle quote (3 lines)
> I've sent a new patchset. Now, we just have to wait for someone else to
> look at this thread...

This thread is already 1 month old, IMO it's not necessary to wait any
longer. I think you can just commit these patches. If there will be
some breakage caused by this change, we will fix it.

--
Alex
L
L
Ludovic Courtès wrote on 22 May 2017 00:25
(name . Alex Kost)(address . alezost@gmail.com)
87mva5g84p.fsf@gnu.org
Alex Kost <alezost@gmail.com> skribis:

Toggle quote (9 lines)
> Arun Isaac (2017-05-05 00:09 +0530) wrote:
>
>> I've sent a new patchset. Now, we just have to wait for someone else to
>> look at this thread...
>
> This thread is already 1 month old, IMO it's not necessary to wait any
> longer. I think you can just commit these patches. If there will be
> some breakage caused by this change, we will fix it.

I agree with this strategy!

Thanks,
Ludo’.
A
A
Arun Isaac wrote on 23 May 2017 02:48
(name . Alex Kost)(address . alezost@gmail.com)
c2d92c1d.AEEAK4YvdBMAAAAAAAAAAAPCi7MAAAACwQwAAAAAAAW9WABZI4bY@mailjet.com
Pushed with a few minor changes!
Closed
?