From: itd <itd@net.in.tum.de>
To: 54729@debbugs.gnu.org
Subject: [bug#54729] [PATCH] build: haskell-build-system: Support packages w. multiple libraries
Date: Fri, 23 Sep 2022 11:42:41 +0200 [thread overview]
Message-ID: <877d1uifzi.fsf@localhost> (raw)
In-Reply-To: <8a396a9803fc35ee63f01e608f87ffb16863bc6d.1649171729.git.philip@munksgaard.me>
[-- Attachment #1: Type: text/plain, Size: 2943 bytes --]
Hi,
thanks for the patch! I applied it, tried it, and ran into some build
issues. Maybe I missed something; here is (roughly) what I tried:
$ # apply diff to current master
$ git checkout a57c4eff6bbdcff79294fa15ecb95ab2b3c55bb4
$ git checkout origin/wip-haskell -- guix/build/haskell-build-system.scm
$ # bump ghc-attoparsec version
$ git diff gnu/packages/haskell-xyz.scm
diff --git a/gnu/packages/haskell-xyz.scm b/gnu/packages/haskell-xyz.scm
index db653f8c93..c4da66aa4a 100644
--- a/gnu/packages/haskell-xyz.scm
+++ b/gnu/packages/haskell-xyz.scm
@@ -589,7 +589,7 @@ (define-public ghc-atomic-write-0.2.0.7
(define-public ghc-attoparsec
(package
(name "ghc-attoparsec")
- (version "0.13.2.5")
+ (version "0.14.4")
(source
(origin
(method url-fetch)
@@ -599,10 +599,12 @@ (define-public ghc-attoparsec
".tar.gz"))
(sha256
(base32
- "0vv88m5m7ynjrg114psp4j4s69f1a5va3bvn293vymqrma7g7q11"))))
+ "0v4yjz4qi8bwhbyavqxlhsfb1iv07v10gxi64khmsmi4hvjpycrz"))))
(build-system haskell-build-system)
(arguments
- `(#:phases
+ `(#:cabal-revision
+ ("2" "00jyrn2asz1kp698l3fyh19xxxz4npf1993y041x9b9cq239smn0")
+ #:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-for-newer-quickcheck
(lambda _
$ # build ghc-attoparsec-iso8601 which depends on ghc-attoparsec
$ guix shell -D guix help2man git strace --pure # & bootstrap & ...
$ ./pre-inst-env guix build ghc-attoparsec-iso8601
After some time, this build failed with:
> phase `setup-compiler' succeeded after 0.1 seconds
> starting phase `configure'
> running "runhaskell Setup.hs" with command "configure" and parameters ("--prefix=/gnu/store/70ddgy9ayd4239dp37b7kvcsdxkg5nrj-ghc-attoparsec-iso8601-1.0.2.0" "--libdir=/gnu/store/70ddgy9ayd4239dp37b7kvcsdxkg5nrj-ghc-attoparsec-iso8601-1.0.2.0/lib" "--docdir=/gnu/store/70ddgy9ayd4239dp37b7kvcsdxkg5nrj-ghc-attoparsec-iso8601-1.0.2.0/share/doc/ghc-attoparsec-iso8601-1.0.2.0" "--libsubdir=$compiler/$pkg-$version" "--package-db=/tmp/guix-build-ghc-attoparsec-iso8601-1.0.2.0.drv-0/package.conf.d" "--global" "--enable-tests" "--enable-shared" "--enable-executable-dynamic" "--ghc-option=-fPIC" "--ghc-option=-optl=-Wl,-rpath=/gnu/store/70ddgy9ayd4239dp37b7kvcsdxkg5nrj-ghc-attoparsec-iso8601-1.0.2.0/lib/$compiler/$pkg-$version")
> Configuring attoparsec-iso8601-1.0.2.0...
> Error:
> The following packages are broken because other packages they depend on are missing. These broken packages must be rebuilt before they can be used.
> installed package attoparsec-0.14.4 is broken due to missing package scientific-0.3.7.0-9XG3zUjXOw970JFcruv0cZ
Ignorant of the patch provided here, I tried to build newer versions of
ghc-attoparsec / its dependants and ended up with the attached patch.
Using this patch, the build succeeds (but I am not sure if the patch's
approach is sensible).
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-update-haskell-build-system-for-newer-attoparsec.patch --]
[-- Type: text/x-diff, Size: 6392 bytes --]
From 959dc9de2d4aa39b7490b4c90e28820edf0d00f9 Mon Sep 17 00:00:00 2001
From: itd <itd@net.in.tum.de>
Date: Fri, 23 Sep 2022 10:58:09 +0200
Subject: [PATCH] WIP update haskell-build-system for newer attoparsec
---
guix/build/haskell-build-system.scm | 86 +++++++++++++++++------------
1 file changed, 51 insertions(+), 35 deletions(-)
diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm
index ef6cb316ee..d4c4ed4c8c 100644
--- a/guix/build/haskell-build-system.scm
+++ b/guix/build/haskell-build-system.scm
@@ -219,7 +219,10 @@ (define* (register #:key name system inputs outputs #:allow-other-keys)
(dep-conf* (string-append dest "/" id ".conf")))
(when (not (file-exists? dep-conf))
(error (format #f "File ~a does not exist. This usually means the dependency ~a is missing. Was checking conf-file ~a." dep-conf id conf-file)))
- (copy-file dep-conf dep-conf*) ;XXX: maybe symlink instead?
+ ;; Different libraries of same package may share
+ ;; dependencies. Hence, file may exist already.
+ (when (not (file-exists? dep-conf*))
+ (copy-file dep-conf dep-conf*)) ;XXX: maybe symlink instead?
(loop (vhash-cons id #t seen)
(append lst (conf-depends dep-conf))))
(loop seen tail))))))
@@ -234,46 +237,59 @@ (define* (register #:key name system inputs outputs #:allow-other-keys)
"/ghc-" version
"/" name ".conf.d"))
(id-rx (make-regexp "^id:[ \n\t]+([^ \t\n]+)$" regexp/newline))
- (config-file (string-append out "/" name ".conf"))
+ (maybe-config-file (string-append out "/" name ".conf"))
(params
- (list (string-append "--gen-pkg-config=" config-file))))
+ (list (string-append "--gen-pkg-config=" maybe-config-file))))
(run-setuphs "register" params)
;; The conf file is created only when there is a library to register.
- (when (file-exists? config-file)
+ (when (file-exists? maybe-config-file)
(mkdir-p config-dir)
- (let* ((contents (call-with-input-file config-file read-string))
- (config-file-name+id (match:substring (first (list-matches id-rx contents)) 1)))
+ ;; If more that one library is defined, they share conf file as
+ ;; parent directory.
+ (let* ((config-files (if (file-is-directory? maybe-config-file)
+ (find-files maybe-config-file)
+ (list maybe-config-file))))
+ (map
+ (lambda (config-file)
+ (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)))
+ (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"
- ;; field in the generated .conf file.
- (when doc
- (substitute* config-file
- (("^haddock-html: .*") "\n")
- (((format #f "^haddock-interfaces: ~a" doc))
- (string-append "haddock-interfaces: " lib)))
- ;; Move the referenced file to the "lib" (or "out") output.
- (match (find-files doc "\\.haddock$")
- ((haddock-file . rest)
- (let* ((subdir (string-drop haddock-file (string-length doc)))
- (new (string-append lib subdir)))
- (mkdir-p (dirname new))
- (rename-file haddock-file new)))
- (_ #f)))
- (install-transitive-deps config-file %tmp-db-dir config-dir)
- (rename-file config-file
- (string-append config-dir "/"
- config-file-name+id ".conf"))
- (invoke "ghc-pkg"
- (string-append "--package-db=" config-dir)
- "recache")))
+ ;; Remove reference to "doc" output from "lib" (or "out") by rewriting the
+ ;; "haddock-interfaces" field and removing the optional "haddock-html"
+ ;; field in the generated .conf file.
+ (when doc
+ (substitute* config-file
+ (("^haddock-html: .*") "\n")
+ (((format #f "^haddock-interfaces: ~a" doc))
+ (string-append "haddock-interfaces: " lib)))
+ ;; Move the referenced file to the "lib" (or "out") output.
+ (match (find-files doc "\\.haddock$")
+ ((haddock-file . rest)
+ (let* ((subdir (string-drop haddock-file (string-length doc)))
+ (new (string-append lib subdir)))
+ (mkdir-p (dirname new))
+ (rename-file haddock-file new)))
+ (_ #f)))
+ (install-transitive-deps config-file %tmp-db-dir config-dir)
+ ;; Make current conf file available for possible
+ ;; subsequent conf files.
+ (copy-file config-file
+ (string-append %tmp-db-dir "/"
+ config-file-name+id ".conf"))
+ (rename-file config-file
+ (string-append config-dir "/"
+ config-file-name+id ".conf"))
+ (invoke "ghc-pkg"
+ (string-append "--package-db=" config-dir)
+ "recache")))
+ config-files)))
#t))
(define* (check #:key tests? test-target #:allow-other-keys)
base-commit: a57c4eff6bbdcff79294fa15ecb95ab2b3c55bb4
--
2.37.3
[-- Attachment #3: Type: text/plain, Size: 13 bytes --]
Regards
itd
next prev parent reply other threads:[~2022-09-23 9:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 15:15 [bug#54729] [PATCH] build: haskell-build-system: Support packages w. multiple libraries Philip Munksgaard
2022-04-06 19:19 ` [bug#54729] [PATCH core-updates v2 1/2] build: haskell-build-system: Remove trailing #t zimoun
2022-04-06 19:19 ` [bug#54729] [PATCH core-updates v2 2/2] build: haskell-build-system: Support multiple libraries zimoun
2022-04-06 19:23 ` [bug#54729] [PATCH] build: haskell-build-system: Support packages w. " zimoun
2022-04-07 6:08 ` Lars-Dominik Braun
2022-04-07 6:49 ` Philip Munksgaard
2022-04-07 8:25 ` Philip Munksgaard
2022-04-07 7:35 ` zimoun
2022-04-13 18:59 ` Philip Munksgaard
2022-04-14 18:21 ` Lars-Dominik Braun
2022-04-15 8:19 ` Philip Munksgaard
2022-09-23 9:42 ` itd [this message]
2022-12-21 12:48 ` itd
2022-12-23 14:03 ` Philip Munksgaard
2023-01-06 11:51 ` Lars-Dominik Braun
2023-01-12 17:30 ` itd
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=877d1uifzi.fsf@localhost \
--to=itd@net.in.tum.de \
--cc=54729@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.