[PATCH] build: haskell-build-system: Support packages w. multiple libraries

  • Open
  • quality assurance status badge
Details
4 participants
  • itd
  • Lars-Dominik Braun
  • Philip Munksgaard
  • zimoun
Owner
unassigned
Submitted by
Philip Munksgaard
Severity
normal
P
P
Philip Munksgaard wrote on 5 Apr 2022 17:15
(address . guix-patches@gnu.org)(name . Philip Munksgaard)(address . philip@munksgaard.me)
8a396a9803fc35ee63f01e608f87ffb16863bc6d.1649171729.git.philip@munksgaard.me
As discussed in #53655 [0], haskell-build-system.scm does not currently
support packages which contain multiple libraries, such as attoparsec
[1]. Such libraries are often used for internal or convenience libraries, as
detailed in the documentation [2].

The current state of affairs means that attoparsec and any other libraries
with similar structure cannot be built on guix, nor can any library or
executable that depends on such a library.

Instead of assuming that `runhaskell Setup.hs --gen-pkg-config=...` always
outputs a single file, we detect whether the result was a directory. If so, we
need to handle each file independently in lexicographic order by calling the
new private function `install-from-config-file`.

Because `install-transitive-deps` can now be called multiple times for each
call to `register`, it has also been amended to support the files already
installed.

---
guix/build/haskell-build-system.scm | 34 ++++++++++++++++++-----------
1 file changed, 21 insertions(+), 13 deletions(-)

Toggle diff (64 lines)
diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm
index ef6cb316ee..e827e23aba 100644
--- a/guix/build/haskell-build-system.scm
+++ b/guix/build/haskell-build-system.scm
@@ -217,11 +217,13 @@ (define* (register #:key name system inputs outputs #:allow-other-keys)
(if (not (vhash-assoc id seen))
(let ((dep-conf (string-append src "/" id ".conf"))
(dep-conf* (string-append dest "/" id ".conf")))
- (when (not (file-exists? dep-conf))
+ (unless (file-exists? dep-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?
- (loop (vhash-cons id #t seen)
- (append lst (conf-depends 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))))))
(let* ((out (assoc-ref outputs "out"))
@@ -234,13 +236,12 @@ (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"))
+ (config-output (string-append out "/" name ".conf"))
(params
- (list (string-append "--gen-pkg-config=" config-file))))
+ (list (string-append "--gen-pkg-config=" config-output))))
(run-setuphs "register" params)
- ;; The conf file is created only when there is a library to register.
- (when (file-exists? config-file)
- (mkdir-p config-dir)
+
+ (define (install-from-config-file 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)))
@@ -270,10 +271,17 @@ (define* (register #:key name system inputs outputs #:allow-other-keys)
(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")))
+ config-file-name+id ".conf"))))
+
+ ;; The conf file is created only when there is a library to register.
+ (when (file-exists? config-output)
+ (mkdir-p config-dir)
+ (if (file-is-directory? config-output)
+ (for-each install-from-config-file (find-files config-output))
+ (install-from-config-file config-output))
+ (invoke "ghc-pkg"
+ (string-append "--package-db=" config-dir)
+ "recache"))
#t))
(define* (check #:key tests? test-target #:allow-other-keys)
--
2.35.1
Z
Z
zimoun wrote on 6 Apr 2022 21:19
[PATCH core-updates v2 1/2] build: haskell-build-system: Remove trailing #t.
(address . 54729@debbugs.gnu.org)(name . zimoun)(address . zimon.toutoune@gmail.com)
20220406191908.2393054-1-zimon.toutoune@gmail.com
* guix/build/haskell-build-system.scm (configure, install, setup-compiler,
make-ghc-package-database, install-transitive-deps, check, haddock,
patch-cabal-file, generate-setuphs): Delete trailing #t.
---
guix/build/haskell-build-system.scm | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)

Toggle diff (91 lines)
diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm
index ef6cb316ee..e2e5904dce 100644
--- a/guix/build/haskell-build-system.scm
+++ b/guix/build/haskell-build-system.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2018, 2020 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
+;;; Copyright © 2022 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -118,8 +119,7 @@ (define* (configure #:key outputs inputs tests? (configure-flags '())
(setenv "CONFIG_SHELL" "sh"))
(run-setuphs "configure" params)
- (setenv "GHC_PACKAGE_PATH" ghc-path)
- #t))
+ (setenv "GHC_PACKAGE_PATH" ghc-path)))
(define* (build #:key parallel-build? #:allow-other-keys)
"Build a given Haskell package."
@@ -140,8 +140,7 @@ (define* (install #:key outputs #:allow-other-keys)
(new (string-append static subdir)))
(mkdir-p (dirname new))
(rename-file static-lib new)))
- (find-files lib "\\.a$"))))
- #t)
+ (find-files lib "\\.a$")))))
(define* (setup-compiler #:key system inputs outputs #:allow-other-keys)
"Setup the compiler environment."
@@ -175,8 +174,7 @@ (define (make-ghc-package-database system inputs outputs)
conf-files)
(invoke "ghc-pkg"
(string-append "--package-db=" %tmp-db-dir)
- "recache")
- #t))
+ "recache")))
(define* (register #:key name system inputs outputs #:allow-other-keys)
"Generate the compiler registration and binary package database files for a
@@ -273,21 +271,18 @@ (define (install-transitive-deps conf-file src dest)
config-file-name+id ".conf"))
(invoke "ghc-pkg"
(string-append "--package-db=" config-dir)
- "recache")))
- #t))
+ "recache")))))
(define* (check #:key tests? test-target #:allow-other-keys)
"Run the test suite of a given Haskell package."
(if tests?
(run-setuphs test-target '())
- (format #t "test suite not run~%"))
- #t)
+ (format #t "test suite not run~%")))
(define* (haddock #:key outputs haddock? haddock-flags #:allow-other-keys)
"Generate the Haddock documentation of a given Haskell package."
(when haddock?
- (run-setuphs "haddock" haddock-flags))
- #t)
+ (run-setuphs "haddock" haddock-flags)))
(define* (patch-cabal-file #:key cabal-revision #:allow-other-keys)
(when cabal-revision
@@ -296,8 +291,7 @@ (define* (patch-cabal-file #:key cabal-revision #:allow-other-keys)
((original)
(format #t "replacing ~s with ~s~%" original cabal-revision)
(copy-file cabal-revision original))
- (_ (error "Could not find a Cabal file to patch."))))
- #t)
+ (_ (error "Could not find a Cabal file to patch.")))))
(define* (generate-setuphs #:rest empty)
"Generate a default Setup.hs if needed."
@@ -307,8 +301,7 @@ (define* (generate-setuphs #:rest empty)
(with-output-to-file "Setup.hs"
(lambda ()
(format #t "import Distribution.Simple~%")
- (format #t "main = defaultMain~%"))))
- #t)
+ (format #t "main = defaultMain~%")))))
(define %standard-phases
(modify-phases gnu:%standard-phases

base-commit: e3e3381fdbc56f351063d9b4a49e99645b20d7d3
--
2.34.0
Z
Z
zimoun wrote on 6 Apr 2022 21:19
[PATCH core-updates v2 2/2] build: haskell-build-system: Support multiple libraries.
(address . 54729@debbugs.gnu.org)
20220406191908.2393054-2-zimon.toutoune@gmail.com
From: Philip Munksgaard <philip@munksgaard.me>


The patch handles correctly the multiple registration of some package using
their own internal sub-libraries. It allows to call 'install-transitive-deps'
multiple times and deals with packages requiring a multiple registration.

* guix/build/haskell-build-system.scm (register)[install-transitive-deps]:
Guard also the destination direction.
[install-config-file]: New procedure.

Co-Authored-by: zimoun <zimon.toutoune@gmail.com>.
---
guix/build/haskell-build-system.scm | 87 ++++++++++++++++-------------
1 file changed, 49 insertions(+), 38 deletions(-)

Toggle diff (124 lines)
diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm
index e2e5904dce..fb4aba28ea 100644
--- a/guix/build/haskell-build-system.scm
+++ b/guix/build/haskell-build-system.scm
@@ -6,6 +6,7 @@
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2021 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2022 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2022 Philip Munksgaard <philip@munksgaard.me>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -215,13 +216,50 @@ (define (install-transitive-deps conf-file src dest)
(if (not (vhash-assoc id seen))
(let ((dep-conf (string-append src "/" id ".conf"))
(dep-conf* (string-append dest "/" id ".conf")))
- (when (not (file-exists? dep-conf))
+ (unless (file-exists? dep-conf*)
+ (unless (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?
- (loop (vhash-cons id #t seen)
- (append lst (conf-depends 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))))))
+ (define (install-config-file conf-file dest output:doc output:lib)
+ ;; Copy CONF-FILE to DEST removing reference to OUTPUT:DOC from
+ ;; OUTPUT:LIB and using install-transitive-deps.
+ (let* ((contents (call-with-input-file conf-file read-string))
+ (id-rx (make-regexp "^id:[ \n\t]+([^ \t\n]+)$" regexp/newline))
+ (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." conf-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 output:doc
+ (substitute* conf-file
+ (("^haddock-html: .*") "\n")
+ (((format #f "^haddock-interfaces: ~a" output:doc))
+ (string-append "haddock-interfaces: " output:lib)))
+ ;; Move the referenced file to the "lib" (or "out") output.
+ (match (find-files output:doc "\\.haddock$")
+ ((haddock-file . rest)
+ (let* ((subdir (string-drop haddock-file (string-length output:doc)))
+ (new (string-append output:lib subdir)))
+ (mkdir-p (dirname new))
+ (rename-file haddock-file new)))
+ (_ #f)))
+ (install-transitive-deps conf-file %tmp-db-dir dest)
+ (rename-file conf-file
+ (string-append dest "/"
+ config-file-name+id ".conf"))))
+
(let* ((out (assoc-ref outputs "out"))
(doc (assoc-ref outputs "doc"))
(haskell (assoc-ref inputs "haskell"))
@@ -231,7 +269,6 @@ (define (install-transitive-deps conf-file src dest)
(config-dir (string-append lib
"/ghc-" version
"/" name ".conf.d"))
- (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))))
@@ -239,39 +276,13 @@ (define (install-transitive-deps conf-file src dest)
;; The conf file is created only when there is a library to register.
(when (file-exists? 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)))
-
- (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")))))
+ (if (file-is-directory? config-file)
+ (for-each (cut install-config-file <> config-dir doc lib)
+ (find-files config-file))
+ (install-config-file config-file config-dir doc lib))
+ (invoke "ghc-pkg"
+ (string-append "--package-db=" config-dir)
+ "recache"))))
(define* (check #:key tests? test-target #:allow-other-keys)
"Run the test suite of a given Haskell package."
--
2.34.0
Z
Z
zimoun wrote on 6 Apr 2022 21:23
Re: bug#54729: [PATCH] build: haskell-build-system: Support packages w. multiple libraries
(address . 54729@debbugs.gnu.org)
87zgkyow1r.fsf@gmail.com
Hi,

Thanks for your patch. I have send a v2 ready for core-updates.

Ricardo or Lars, can you push this v2 to core-updates?

The simple test is to use attoparsec@0.14 from bug#53655 [1]. The
rebuild of this package takes less than half hour.

I have checked and rebuilt all the ghc- packages; nothing broken.




Cheers,
simon
L
L
Lars-Dominik Braun wrote on 7 Apr 2022 08:08
(name . zimoun)(address . zimon.toutoune@gmail.com)
Yk5/xeYW4K4yDnLJ@noor.fritz.box
Hi simon,

Toggle quote (1 lines)
> Ricardo or Lars, can you push this v2 to core-updates?
I’d rather have this in a separate wip-haskell branch than let it sit
on core-updates indefinitely. Stackage also has a new release[1] using
GHC 9.0, which we could update to at the same time.

Any other Haskell changes we can batch into that branch?

Cheers,
Lars

P
P
Philip Munksgaard wrote on 7 Apr 2022 08:49
7108deb8-613a-4f74-a525-c4bf21ec9118@www.fastmail.com
Hi Lars

On Thu, 7 Apr 2022, at 08:08, Lars-Dominik Braun wrote:
Toggle quote (2 lines)
> Any other Haskell changes we can batch into that branch?

I don't know of any finished patches, but there are some issues that would be nice to have fixed, like https://issues.guix.gnu.org/52152(which also applies to attoparsec) and https://issues.guix.gnu.org/54752. However, I think it's more important to get this current patch merged.

Best,
Philip
Z
Z
zimoun wrote on 7 Apr 2022 09:35
(name . Lars-Dominik Braun)(address . lars@6xq.net)
86k0c14a7o.fsf@gmail.com
Hi Lars,

On Thu, 07 Apr 2022 at 08:08, Lars-Dominik Braun <lars@6xq.net> wrote:

Toggle quote (6 lines)
> I’d rather have this in a separate wip-haskell branch than let it sit
> on core-updates indefinitely. Stackage also has a new release[1] using
> GHC 9.0, which we could update to at the same time.
>
> Any other Haskell changes we can batch into that branch?

Ok, let’s do use this wip-haskell branch: fix the build system as this
v2 is doing and update LTS. Currently, the wip-haskell is at:
c1522b280137df2f670f47fa1e682e610406bb39 (Thu Sep 30 09:29:51 2021
+0200), so let me know once you have rebase it to the current master.


Cheers,
simon
P
P
Philip Munksgaard wrote on 7 Apr 2022 10:25
797b714d-4274-46eb-9858-a51a17550b0c@www.fastmail.com
Hi again

On Thu, 7 Apr 2022, at 08:49, Philip Munksgaard wrote:
Toggle quote (11 lines)
> Hi Lars
>
> On Thu, 7 Apr 2022, at 08:08, Lars-Dominik Braun wrote:
>> Any other Haskell changes we can batch into that branch?
>
> I don't know of any finished patches, but there are some issues that
> would be nice to have fixed, like https://issues.guix.gnu.org/52152
> (which also applies to attoparsec) and
> https://issues.guix.gnu.org/54752. However, I think it's more important
> to get this current patch merged.

I've also created a new issue for invalid dependencies generated by multiple libraries in one package:

P
P
Philip Munksgaard wrote on 13 Apr 2022 20:59
f1fedb67-1fcd-4cb1-9536-46d94d5684ba@www.fastmail.com
Hi again

On Thu, 7 Apr 2022, at 08:08, Lars-Dominik Braun wrote:
Toggle quote (4 lines)
> I’d rather have this in a separate wip-haskell branch than let it sit
> on core-updates indefinitely. Stackage also has a new release[1] using
> GHC 9.0, which we could update to at the same time.

Any news on this? Was the branch created? I can't seem to find it on https://git.savannah.gnu.org, and the changes haven't made it into master, as far as I can tell.

Best,
Philip
L
L
Lars-Dominik Braun wrote on 14 Apr 2022 20:21
(name . Philip Munksgaard)(address . philip@munksgaard.me)
YlhmLNPFwROULK5v@noor.fritz.box
Hi Philip,

Toggle quote (2 lines)
> Any news on this? Was the branch created? I can't seem to find it on https://git.savannah.gnu.org, and the changes haven't made it into master, as far as I can tell.

sorry, I’ve been busy rebasing my new python-build-system (PEP 517) on
top of master.

I created the branch wip-haskell and pushed zimoun’s v2 – I
hope that’s alright with you Philip? (I didn’t check the patches
thoroughly, just tried to build attoparsec.)

Cheers,
Lars
P
P
Philip Munksgaard wrote on 15 Apr 2022 10:19
(name . Lars-Dominik Braun)(address . lars@6xq.net)
4b2d1388-b5a1-4821-8ded-d75138352284@www.fastmail.com
Hi Lars

On Thu, 14 Apr 2022, at 20:21, Lars-Dominik Braun wrote:
Toggle quote (3 lines)
> sorry, I’ve been busy rebasing my new python-build-system (PEP 517) on
> top of master.

No worries, I just wanted to make sure it wasn't forgotten :-)

Toggle quote (4 lines)
> I created the branch wip-haskell and pushed zimoun’s v2 – I
> hope that’s alright with you Philip? (I didn’t check the patches
> thoroughly, just tried to build attoparsec.)

Yeah that sounds perfect.

Best,
Philip
I
Re: [PATCH] build: haskell-build-system: Support packages w. multiple libraries
(address . 54729@debbugs.gnu.org)
877d1uifzi.fsf@localhost
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
Toggle diff (47 lines)
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).
Regards
itd
I
(name . Lars-Dominik Braun)(address . lars@6xq.net)
87cz8c2a9f.fsf@localhost
Dear Haskell team,
dear all,

itd <itd@net.in.tum.de> writes:

Toggle quote (7 lines)
> thanks for the patch! I applied it, tried it, and ran into some build
> issues. [...]
> 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). [...]

if possible, I'd appreciate feedback on my previous mail. E.g., does my
attempt in using the originally proposed patch make sense? Any opinions
on my patch?

Thank you.

Regards
itd
P
P
Philip Munksgaard wrote on 23 Dec 2022 15:03
d1084bd9-3111-4267-8b78-1b4285cb1472@app.fastmail.com
Dear itd,

On Wed, 21 Dec 2022, at 13:48, itd wrote:
Toggle quote (4 lines)
> if possible, I'd appreciate feedback on my previous mail. E.g., does my
> attempt in using the originally proposed patch make sense? Any opinions
> on my patch?

Yes, I've been meaning to try out your patch, but I haven't had time yet. I will try to get to it over the holidays. Sorry for my tardiness.

Best holiday wishes,
Philip
L
L
Lars-Dominik Braun wrote on 6 Jan 2023 12:51
(name . itd)(address . itd@net.in.tum.de)
Y7gLUP2ybDO2Cjsh@noor.fritz.box
Hi,

Toggle quote (2 lines)
> > 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
I can reproduce the problem on wip-haskell, which also uses
attoparsec-0.14.4 and GHC 9.2.5.

Further analysis suggests that this is a different issue, which is simply
exposed by attoparsec’s multiple libraries. I applied the attached
patch to wip-haskell, which fixes the issue for me.

Cheers,
Lars
From 272dc241677872a235e19135885599a18ef5f102 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <lars@6xq.net>
Date: Fri, 6 Jan 2023 12:46:26 +0100
Subject: [PATCH] build: haskell-build-system: Process all transitive
dependencies.

A bug caused install-transitive-deps to stop looping if a dependency
file already existed in the target directory. For Haskell packages
with multiple libraries (like attoparsec) this resulted in missing
dependencies and error messages like this:

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


* guix/build/haskell-build-system.scm (register): Unconditionally loop
over all tails.
---
guix/build/haskell-build-system.scm | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

Toggle diff (30 lines)
diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm
index fb4aba28ea..72e12ba746 100644
--- a/guix/build/haskell-build-system.scm
+++ b/guix/build/haskell-build-system.scm
@@ -214,14 +214,16 @@ (define (install-transitive-deps conf-file src dest)
(() #t) ;done
((id . tail)
(if (not (vhash-assoc id seen))
- (let ((dep-conf (string-append src "/" id ".conf"))
- (dep-conf* (string-append dest "/" id ".conf")))
- (unless (file-exists? dep-conf*)
- (unless (file-exists? dep-conf)
+ (let* ((dep-conf (string-append src "/" id ".conf"))
+ (dep-conf* (string-append dest "/" id ".conf"))
+ (dep-conf-exists? (file-exists? dep-conf))
+ (dep-conf*-exists? (file-exists? dep-conf*))
+ (next-tail (append lst (if dep-conf-exists? (conf-depends dep-conf) '()))))
+ (unless dep-conf*-exists?
+ (unless dep-conf-exists?
(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?
- (loop (vhash-cons id #t seen)
- (append lst (conf-depends dep-conf)))))
+ (copy-file dep-conf dep-conf*)) ;XXX: maybe symlink instead?
+ (loop (vhash-cons id #t seen) next-tail))
(loop seen tail))))))
(define (install-config-file conf-file dest output:doc output:lib)
--
2.38.2
I
(name . Lars-Dominik Braun)(address . lars@6xq.net)
87zganu0c7.fsf@localhost
Hi,

Lars-Dominik Braun <lars@6xq.net> writes:

Toggle quote (3 lines)
> I can reproduce the problem on wip-haskell, which also uses
> attoparsec-0.14.4 and GHC 9.2.5.

thanks for checking!

Toggle quote (4 lines)
> Further analysis suggests that this is a different issue, which is simply
> exposed by attoparsec’s multiple libraries. I applied the attached
> patch to wip-haskell, which fixes the issue for me.

Thanks for looking into it. I can confirm that the wip-haskell changes
combined with this patch fix the issue for me as well.

Best regards
itd
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 54729@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 54729
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch