From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxim Cournoyer Subject: bug#27222: [PATCH] emacs-build-system install phase doesn't honor directory hierarchy Date: Sun, 04 Jun 2017 22:07:16 -0700 Message-ID: <87vaobnhtn.fsf@gmail.com> References: <87h8zwptdn.fsf@gmail.com> <874lvwp7km.fsf@gmail.com> <87wp8rq57k.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHkFL-0006Dh-96 for bug-guix@gnu.org; Mon, 05 Jun 2017 01:08:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHkFH-0002Ll-4E for bug-guix@gnu.org; Mon, 05 Jun 2017 01:08:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:53692) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dHkFG-0002LP-Rx for bug-guix@gnu.org; Mon, 05 Jun 2017 01:08:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dHkFG-0007Jz-GR for bug-guix@gnu.org; Mon, 05 Jun 2017 01:08:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: (Arun Isaac's message of "Mon, 05 Jun 2017 00:55:11 +0530") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Arun Isaac Cc: Alex Kost , 27222@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Hello, Arun Isaac writes: >> As far as I understand it, it was done for purpose: some packages >> include "uninteresting" (for tests, maintenance, etc.) *.el files in >> subdirs, that's why they are excluded by default. So probably a better >> solution would be to fix 'ert-runner' package (as it is done in commit >> b1d32ec0e23bfec1dab4c56909228a494b2b0d60, for example). WDYT? > > I agree. The solution is to fix the ert-runner package, not the > emacs-build-system. > >> This change also doesn't prevent excluding subfolders if they are truly >> unnecessary (such as tests subfolder), but this should happen due to >> explicit regexp in the exclude option, not because *all* subfolders are >> excluded. > > We adopted the policy of excluding *all* subfolders from MELPA. From > their "Recipe Format" section at https://github.com/melpa/melpa > > "Note that elisp in subdirectories is never included by default, so you > might find it convenient to separate auxiliiary files such as tests into > subdirectories to keep packaging simple." Oh. I didn't know MELPA had such a policy. This is a good point. It's nice to try to stick to whatever MELPA does, as they've pretty much become the authority in Elisp packaging IIUC. > I think this is a good policy. If we include subfolders by default, > we'll have to modify many packages with #:exclude arguments to get rid > of unnecessary subfolders. However, if we exclude subfolders by default, > we'll only have to modify fewer packages with #:include arguments. Although, for the sake of cleanliness, they enforce a project layout that discourage the organization of a project in subdirectories, which I find a bit strange. But if the lack of complaints about it in the MELPA issues tracker tells anything, it doesn't seem to be much of a bother for most projects (this might have to do with the fact that until recently most Elisp projects were organized as a single file of thousands of lines of code ;). >> I also think these arguments are redundant! I suggested to remove this >> duplication at: >> >> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26559#41 > > And, I did respond at > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26559#53 > >> ... 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. > Do you know of some way in which we can avoid duplication of the > arguments? Even the gnu-build-system duplicates default values of > arguments. I've decided to go with the flow and modify ert-runner so that it includes the elisp files under the 'reporters' subdirectory. I've also factorized out the default args of the include and exclude option of the emacs-build-system install phase. Please see the two patches attached. Maxim --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-build-system-emacs-Factorize-include-exclude-default.patch Content-Transfer-Encoding: quoted-printable From=20626eb2b0551aee16836b7ec796a8ad1759be5a52 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sat, 3 Jun 2017 23:43:02 -0700 Subject: [PATCH 1/2] build-system: emacs: Factorize include/exclude default args The `install' phase of the emac-build-system builder side contained argumen= ts duplicated from the higer level `emacs-build' procedure. This change factorizes them so that: 1. They are not duplicated; 2. They can be reused and extended easily when defining Emacs packages. * guix/build/emacs-build-system.scm (%default-include): New symbol. (%default-exclude): Likewise. (install)[include]: Use %default-include variable. [exclude]: Use %default exclude variable. =2D-- guix/build-system/emacs.scm | 11 ++++++++--- guix/build/emacs-build-system.scm | 11 +++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm index 9a46ecfd2..02296829c 100644 =2D-- a/guix/build-system/emacs.scm +++ b/guix/build-system/emacs.scm @@ -17,6 +17,8 @@ ;;; along with GNU Guix. If not, see . =20 (define-module (guix build-system emacs) + #:use-module ((guix build emacs-build-system) + #:select (%default-include %default-exclude)) #:use-module (guix store) #:use-module (guix utils) #:use-module (guix packages) @@ -28,7 +30,10 @@ #:use-module (srfi srfi-26) #:export (%emacs-build-system-modules emacs-build =2D emacs-build-system)) + emacs-build-system) + #:re-export (%default-include ;for convenience + %default-exclude)) + =20 ;; Commentary: ;; @@ -83,8 +88,8 @@ (phases '(@ (guix build emacs-build-system) %standard-phases)) (outputs '("out")) =2D (include ''("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/= .*\\.info$")) =2D (exclude ''("^\\.dir-locals\\.el$" "-pkg\\.el$" "^= [^/]*tests?\\.el$")) + (include (quote %default-include)) + (exclude (quote %default-exclude)) (search-paths '()) (system (%current-system)) (guile #f) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-sys= tem.scm index 50af4be36..bda699ddf 100644 =2D-- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -29,6 +29,8 @@ #:use-module (ice-9 regex) #:use-module (ice-9 match) #:export (%standard-phases + %default-include + %default-exclude emacs-build)) =20 ;; Commentary: @@ -42,6 +44,11 @@ ;; archive signature. (define %install-suffix "/share/emacs/site-lisp/guix.d") =20 +;; These are the default inclusion/exclusion regexps for the install phase. +(define %default-include '("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.info= $")) +(define %default-exclude '("^\\.dir-locals\\.el$" "-pkg\\.el$" + "^[^/]*tests?\\.el$")) + (define gnu:unpack (assoc-ref gnu:%standard-phases 'unpack)) =20 (define (store-file->elisp-source-file file) @@ -96,8 +103,8 @@ store in '.el' files." #t)) =20 (define* (install #:key outputs =2D (include '("^[^/]*\\.el$" "^[^/]*\\.info$" "^doc/.*\\.= info$")) =2D (exclude '("^\\.dir-locals\\.el$" "-pkg\\.el$" "^[^/]*= tests?\\.el$")) + (include %default-include) + (exclude %default-exclude) #:allow-other-keys) "Install the package contents." =20 =2D-=20 2.13.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-gnu-emacs-Fix-ert-runner-by-adding-reporters-subdir.patch Content-Transfer-Encoding: quoted-printable From=20ffb86810fe945a6cded4b5363ef0b8ce4ea58d02 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 4 Jun 2017 20:57:03 -0700 Subject: [PATCH 2/2] gnu: emacs: Fix ert-runner by adding 'reporters' subdir Previous this change, ert-runner would fail with error: "Invalid reporter: = dot". * gnu/packages/emacs.scm (ert-runner)[include]: Add regexp to match elisp files under the 'reporters' subdirectory. =2D-- gnu/packages/emacs.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm index 81a74d1fb..52118099e 100644 =2D-- a/gnu/packages/emacs.scm +++ b/gnu/packages/emacs.scm @@ -4814,7 +4814,8 @@ Emacs.") ;; determined by emacs' standard initialization ;; procedure (list "")))) =2D #t)))))) + #t)))) + #:include (cons* "^reporters/.*\\.el$" %default-include))) (home-page "https://github.com/rejeep/ert-runner.el") (synopsis "Opinionated Ert testing workflow") (description "@code{ert-runner} is a tool for Emacs projects tested =2D-=20 2.13.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEFVwTvgZwWPWnh370K8v/MDHLu9sFAlk05wQACgkQK8v/MDHL u9t06g//V3nrdc3MsSaJsiAi7vTCMor9f7SMkTId8j6g3P7XczsAL53DIkdPvREz DzQKgCffP1/Ox/MVt6G/lM7gwSBsw0ea7BqAxRsAH+hpJi/ArqA7Z6mPpkIX/n7q 71qZpvHmIMSq3Tx23X3T7q1A6B5vfqLxfcMCgVAW+YOH3WOwuxhZ5KOqZ//b+rST fhkzw+lSmWViK6sYVGvTFvBmsNGggva0IkiRbklMKn6APvGniQo0IEAcPJlHBvaD WoBAoMGoTEkTXRl7tLecoTho6hV/ldvk7nO0H9xQzW7a/C0ZqhCoOotrzlnCrz88 utBsmTmCtglWoTDivLJ867XJW5vdgqSzg+wzqqnupMhsMbYCr+U39DhzJn+hKQWa T+Y+RNy/WX2TRl2eFYX2YKbPb1GmtNAGApklxvzQ0CLHSwwShBWKaHWXQWQG9vOQ B0h2luEDdtaH0fRpzFYVEhTEAC3Q5WsKFrlW7ZySEtiB1lFhzfiTHo2rad5DrQ9s gL8CrBpyH38gb4bUYkUTPuCvsZhQfFeZ7zF4BCd2pgKiBXBypRwpxsAubo+A1w1k K8ZqFyK2eITCMZXdUKOLn5yG4B9Ytl2I6tHw5MyDVZCfnUaU7SusIPm4Z8/pMhla vJ75kt31CjSm1rLTi0u2pUxiFH1UUEMJfrlWuTeEkqM47LUlWLE= =wiLK -----END PGP SIGNATURE----- --==-=-=--