all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arun Isaac <arunisaac@systemreboot.net>
To: 26559@debbugs.gnu.org
Subject: bug#26559: [PATCH] build: emacs: Install only a subset of files.
Date: Wed, 19 Apr 2017 13:05:25 +0530	[thread overview]
Message-ID: <cc8200d5.AEMAJWr4p0UAAAAAAAAAAAOtUOAAAAACwQwAAAAAAAW9WABY9xNR@mailjet.com> (raw)

* 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


             reply	other threads:[~2017-04-19  7:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170419073525.2357-1-arunisaac@systemreboot.net>
     [not found] ` <cu7o9vsq1m4.fsf@systemreboot.net>
2017-04-19  7:35   ` Arun Isaac [this message]
2017-04-19  7:43     ` bug#26559: [PATCH] build: emacs: Install only a subset of files tumashu
2017-04-19  9:23       ` Arun Isaac
2017-04-19  9:57         ` tumashu
2017-04-19 14:26           ` Arun Isaac
2017-04-20  2:26             ` tumashu
2017-04-20  8:43               ` Arun Isaac
2017-04-20 11:50                 ` Alex Kost
2017-04-19  7:55     ` Arun Isaac
2017-04-20 11:39       ` Alex Kost
2017-04-20 12:52         ` Arun Isaac
2017-04-22 19:56           ` Alex Kost
2017-04-26 14:20             ` Arun Isaac
2017-05-02 10:10               ` Alex Kost
2017-05-04 18:39         ` Arun Isaac
2017-05-21  9:14           ` Alex Kost
2017-05-21 22:25             ` Ludovic Courtès
2017-05-23  0:48             ` Arun Isaac
2017-04-22 19:57     ` Alex Kost
2017-05-14 13:42       ` Arun Isaac
2017-04-26 14:09     ` bug#26559: [PATCH 1/3] " Arun Isaac
2017-05-04 18:35     ` Arun Isaac
2017-04-19  7:48 ` bug#26560: [PATCH] " Arun Isaac
2017-04-19  7:57   ` Arun Isaac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cc8200d5.AEMAJWr4p0UAAAAAAAAAAAOtUOAAAAACwQwAAAAAAAW9WABY9xNR@mailjet.com \
    --to=arunisaac@systemreboot.net \
    --cc=26559@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.