unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#28185] [PATCH] build: emacs-build-system: Make the install phase more helpful.
@ 2017-08-22 17:13 Christopher Baines
  2017-08-29  6:25 ` Arun Isaac
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Christopher Baines @ 2017-08-22 17:13 UTC (permalink / raw)
  To: 28185

Modify the install phase to detect when nothing has been installed, and error
if this happens. This is preferable to continuing, and allowing the next phase
to fail.

Also, when nothing can be found to be installed, print out each file that was
considered, along with the regular expressions that were used to include and
exclude it.

* gnu/build/emacs-build-system.scm (install-file?): Add additional error
  checking and logging.
---
 guix/build/emacs-build-system.scm | 45 ++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 13 deletions(-)

diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm
index bda699ddf..d67d7b49c 100644
--- a/guix/build/emacs-build-system.scm
+++ b/guix/build/emacs-build-system.scm
@@ -110,22 +110,41 @@ store in '.el' files."
 
   (define source (getcwd))
 
-  (define (install-file? file stat)
-    (let ((stripped-file (string-trim (string-drop file (string-length source)) #\/)))
-      (and (any (cut string-match <> stripped-file) include)
-           (not (any (cut string-match <> stripped-file) exclude)))))
+  (define* (install-file? file stat #:key verbose?)
+    (let* ((stripped-file (string-trim
+                           (string-drop file (string-length source)) #\/)))
+      (define (match-stripped-file action regex)
+        (let ((result (string-match regex stripped-file)))
+          (if (and result verbose?)
+              (format #t "info: ~A ~A as it matches \"~A\"\n"
+                      stripped-file action regex))
+          result))
+
+      (if verbose?
+          (format #t "info: considering installing ~A\n" stripped-file))
+
+      (and (any (cut match-stripped-file "included" <>) include)
+           (not (any (cut match-stripped-file "excluded" <>) exclude)))))
 
   (let* ((out (assoc-ref outputs "out"))
          (elpa-name-ver (store-directory->elpa-name-version out))
-         (target-directory (string-append out %install-suffix "/" elpa-name-ver)))
-    (for-each
-     (lambda (file)
-       (let* ((stripped-file (string-drop file (string-length source)))
-              (target-file (string-append target-directory stripped-file)))
-         (format #t "`~a' -> `~a'~%" file target-file)
-         (install-file file (dirname target-file))))
-     (find-files source install-file?)))
-  #t)
+         (target-directory (string-append out %install-suffix "/" elpa-name-ver))
+         (files-to-install (find-files source install-file?)))
+    (if (null? files-to-install)
+        (begin
+          (format #t "error: No files found to install.\n")
+          (find-files source (lambda (file stat)
+                               (install-file? file stat #:verbose? #t)))
+          #f)
+        (begin
+          (for-each
+           (lambda (file)
+             (let* ((stripped-file (string-drop file (string-length source)))
+                    (target-file (string-append target-directory stripped-file)))
+               (format #t "`~a' -> `~a'~%" file target-file)
+               (install-file file (dirname target-file))))
+           files-to-install)
+          #t))))
 
 (define* (move-doc #:key outputs #:allow-other-keys)
   "Move info files from the ELPA package directory to the info directory."
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-09-01 21:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-22 17:13 [bug#28185] [PATCH] build: emacs-build-system: Make the install phase more helpful Christopher Baines
2017-08-29  6:25 ` Arun Isaac
2017-08-29  6:31   ` Jelle Licht
2017-08-29  7:46     ` Arun Isaac
     [not found] ` <3c5556d2.ADkAAC0m-p4AAAAAAAAAAAPmDT4AAAACwQwAAAAAAAW9WABZpQjV@mailjet.com>
2017-08-29  6:58   ` Christopher Baines
2017-08-29 21:46     ` Ludovic Courtès
2017-08-30  6:48       ` Christopher Baines
2017-08-29 21:50 ` Ludovic Courtès
2017-08-30  7:28   ` Christopher Baines
2017-08-30  8:39     ` Ludovic Courtès
2017-08-30  6:48 ` Christopher Baines
2017-08-30  8:07 ` Arun Isaac
     [not found] ` <6f595802.AEMAPOK4d0UAAAAAAAAAAAPmDT4AAAACwQwAAAAAAAW9WABZpnJ1@mailjet.com>
2017-08-31 21:41   ` Christopher Baines
2017-09-01  5:02     ` Arun Isaac
     [not found]     ` <d5168f7c.AEAAPQNLdNwAAAAAAAAAAAPmDT4AAAACwQwAAAAAAAW9WABZqOnq@mailjet.com>
2017-09-01 21:08       ` bug#28185: " Christopher Baines

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).