From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0kAj-0007be-7g for guix-patches@gnu.org; Wed, 19 Apr 2017 03:37:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0kAg-0006py-4g for guix-patches@gnu.org; Wed, 19 Apr 2017 03:37:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:57250) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d0kAg-0006pu-1V for guix-patches@gnu.org; Wed, 19 Apr 2017 03:37:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d0kAf-0004N1-S6 for guix-patches@gnu.org; Wed, 19 Apr 2017 03:37:01 -0400 Subject: bug#26559: [PATCH] build: emacs: Install only a subset of files. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0k9Y-0006mX-GT for guix-patches@gnu.org; Wed, 19 Apr 2017 03:35:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0k9V-0006Gt-EC for guix-patches@gnu.org; Wed, 19 Apr 2017 03:35:52 -0400 Received: from o146.p8.mailjet.com ([87.253.233.146]:38256) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d0k9V-0006Fa-2u for guix-patches@gnu.org; Wed, 19 Apr 2017 03:35:49 -0400 Message-Id: From: Arun Isaac Date: Wed, 19 Apr 2017 13:05:25 +0530 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 26559@debbugs.gnu.org * 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 #:includ= e 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$" "do= c/*.texinfo$")) + (exclude ''("^.dir-locals.el$" "^test.el$" "^tests.e= l$" ".*-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-sys= tem.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)) =20 @@ -93,14 +94,31 @@ store in '.el' files." (substitute-cmd)))) #t)) =20 -(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$" "^do= c/*.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)))) =20 (define* (move-doc #:key outputs #:allow-other-keys) "Move info files from the ELPA package directory to the info directory." --=20 2.12.2 =