[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/10: build-system/haskell: Accept line breaks in config files.
From: |
guix-commits |
Subject: |
07/10: build-system/haskell: Accept line breaks in config files. |
Date: |
Mon, 27 Sep 2021 06:56:35 -0400 (EDT) |
lbraun pushed a commit to branch wip-haskell
in repository guix.
commit d5a2a975721ab22c1192ae01fb0815cbcfe07d30
Author: Lars-Dominik Braun <lars@6xq.net>
AuthorDate: Fri Sep 17 10:17:33 2021 +0200
build-system/haskell: Accept line breaks in config files.
Long id’s will break to the next line.
* guix/build/haskell-build-system.scm (grep): Remove.
(register): Modify regular expression to account for newlines between
key and value, fail if package id is empty.
---
guix/build/haskell-build-system.scm | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/guix/build/haskell-build-system.scm
b/guix/build/haskell-build-system.scm
index 7d50bae..4d0bf6f 100644
--- a/guix/build/haskell-build-system.scm
+++ b/guix/build/haskell-build-system.scm
@@ -143,17 +143,6 @@ and parameters ~s~%"
(find-files lib "\\.a$"))))
#t)
-(define (grep rx port)
- "Given a regular-expression RX including a group, read from PORT until the
-first match and return the content of the group."
- (let ((line (read-line port)))
- (if (eof-object? line)
- #f
- (let ((rx-result (regexp-exec rx line)))
- (if rx-result
- (match:substring rx-result 1)
- (grep rx port))))))
-
(define* (setup-compiler #:key system inputs outputs #:allow-other-keys)
"Setup the compiler environment."
(let* ((haskell (assoc-ref inputs "haskell"))
@@ -242,7 +231,7 @@ given Haskell package."
(config-dir (string-append lib
"/ghc-" version
"/" name ".conf.d"))
- (id-rx (make-regexp "^id: *(.*)$"))
+ (id-rx (make-regexp "^id:[ \n\t]+([^ \t\n]+)$" regexp/newline))
(config-file (string-append out "/" name ".conf"))
(params
(list (string-append "--gen-pkg-config=" config-file))))
@@ -250,8 +239,15 @@ given Haskell package."
;; The conf file is created only when there is a library to register.
(when (file-exists? config-file)
(mkdir-p config-dir)
- (let ((config-file-name+id
- (call-with-ascii-input-file config-file (cut grep id-rx <>))))
+ (let* ((contents (call-with-input-file config-file read-string))
+ (config-file-name+id (match:substring (first (list-matches id-rx
contents)) 1)))
+
+ (when (or
+ (and
+ (string? config-file-name+id)
+ (string-null? config-file-name+id))
+ (not config-file-name+id))
+ (error (format #f "The package id for ~a is empty. This is a bug."
config-file)))
;; Remove reference to "doc" output from "lib" (or "out") by rewriting
the
;; "haddock-interfaces" field and removing the optional "haddock-html"
- branch wip-haskell created (now 1c4e765), guix-commits, 2021/09/27
- 01/10: guix: haskell-build-system: Always pass -package-db option., guix-commits, 2021/09/27
- 03/10: import: stackage: Update %default-lts-version to 18.10., guix-commits, 2021/09/27
- 04/10: import: hackage: Update GHC’s standard libraries., guix-commits, 2021/09/27
- 08/10: import: hackage: Support mirror:// URLs, guix-commits, 2021/09/27
- 09/10: build-system/haskell: Explain failure., guix-commits, 2021/09/27
- 06/10: build-system/haskell: Do not rely on compiler name., guix-commits, 2021/09/27
- 10/10: gnu: Update Haskell ecosystem., guix-commits, 2021/09/27
- 05/10: import: stackage: Support input changes., guix-commits, 2021/09/27
- 02/10: gnu: ghc-8: Update to 8.10., guix-commits, 2021/09/27
- 07/10: build-system/haskell: Accept line breaks in config files.,
guix-commits <=