GNU bug report logs - #26559
[PATCH] build: emacs: Install only a subset of files.

Previous Next

Package: guix-patches;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Wed, 19 Apr 2017 07:37:01 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: bug#26559: closed (Re: bug#26559: [PATCH] build: emacs: Install
 only a subset of files.)
Date: Tue, 23 May 2017 00:49:01 +0000
[Message part 1 (text/plain, inline)]
Your bug report

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

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 26559 <at> debbugs.gnu.org.

-- 
26559: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26559
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Arun Isaac <arunisaac <at> systemreboot.net>
To: Alex Kost <alezost <at> gmail.com>
Cc: 26559-done <at> debbugs.gnu.org,
 Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: bug#26559: [PATCH] build: emacs: Install only a subset of files.
Date: Tue, 23 May 2017 06:18:00 +0530
Pushed with a few minor changes!

[Message part 3 (message/rfc822, inline)]
From: Arun Isaac <arunisaac <at> systemreboot.net>
To: guix-patches <at> gnu.org
Cc: Arun Isaac <arunisaac <at> systemreboot.net>
Subject: [PATCH] build: emacs: Install only a subset of files.
Date: Wed, 19 Apr 2017 13:05:25 +0530
* 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




This bug report was last modified 8 years and 3 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.