From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id wEMWBNiBLWMSsQAAbAwnHQ (envelope-from ) for ; Fri, 23 Sep 2022 11:52:24 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id cNzcA9iBLWMASAEAauVa8A (envelope-from ) for ; Fri, 23 Sep 2022 11:52:24 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AC1539FB6 for ; Fri, 23 Sep 2022 11:52:23 +0200 (CEST) Received: from localhost ([::1]:47994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obfM6-00050d-Lo for larch@yhetil.org; Fri, 23 Sep 2022 05:52:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obfD5-0005Nt-Ci for guix-patches@gnu.org; Fri, 23 Sep 2022 05:43:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40385) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obfD5-0005D3-4M for guix-patches@gnu.org; Fri, 23 Sep 2022 05:43:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1obfD4-0006Ex-Js for guix-patches@gnu.org; Fri, 23 Sep 2022 05:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54729] [PATCH] build: haskell-build-system: Support packages w. multiple libraries Resent-From: itd Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 23 Sep 2022 09:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54729 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54729@debbugs.gnu.org Received: via spool by 54729-submit@debbugs.gnu.org id=B54729.166392617623971 (code B ref 54729); Fri, 23 Sep 2022 09:43:02 +0000 Received: (at 54729) by debbugs.gnu.org; 23 Sep 2022 09:42:56 +0000 Received: from localhost ([127.0.0.1]:39463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obfCx-0006EZ-TP for submit@debbugs.gnu.org; Fri, 23 Sep 2022 05:42:56 -0400 Received: from mailout3.rbg.tum.de ([131.159.0.8]:34673) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obfCv-0006EK-1g for 54729@debbugs.gnu.org; Fri, 23 Sep 2022 05:42:55 -0400 Received: from mailrelay1.rbg.tum.de (mailrelay1.in.tum.de [131.159.254.14]) by mailout3.rbg.tum.de (Postfix) with ESMTPS id CBDF3100131 for <54729@debbugs.gnu.org>; Fri, 23 Sep 2022 11:42:46 +0200 (CEST) Received: by mailrelay1.rbg.tum.de (Postfix, from userid 112) id C77821A8; Fri, 23 Sep 2022 11:42:46 +0200 (CEST) Received: from mailrelay1.rbg.tum.de (localhost [127.0.0.1]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 8F21C1A1 for <54729@debbugs.gnu.org>; Fri, 23 Sep 2022 11:42:42 +0200 (CEST) Received: from mail.net.in.tum.de (mail.net.in.tum.de [131.159.15.233]) by mailrelay1.rbg.tum.de (Postfix) with ESMTP id 8D813CD for <54729@debbugs.gnu.org>; Fri, 23 Sep 2022 11:42:42 +0200 (CEST) Received: from amnesix.net.in.tum.de (amnesix.net.in.tum.de [131.159.20.238]) by mail.net.in.tum.de (Postfix) with ESMTP id 68E7228C100B; Fri, 23 Sep 2022 11:42:42 +0200 (CEST) From: itd In-Reply-To: <8a396a9803fc35ee63f01e608f87ffb16863bc6d.1649171729.git.philip@munksgaard.me> References: <8a396a9803fc35ee63f01e608f87ffb16863bc6d.1649171729.git.philip@munksgaard.me> Date: Fri, 23 Sep 2022 11:42:41 +0200 Message-ID: <877d1uifzi.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663926743; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=8P1Afx+OHjzrUYp2HExYd9g5uizWVxP0wQ3KfxsyoT0=; b=VWuVTdD92lySOxn8q6I5W7RZtVdjiB3V1/tZF9G4i/Mutdv/2TWT2t68wj37suUTGSJs9E WjsCG6hBRmJO7GYrIHPg3YPCEIAyxzwZcTWLqm5YACrolwHl5ZgXP5EqzGyTvjAM7IMlHq 25T9e2e+fACx3HTiHiwaF9IFUaVyLHRbeWsZqIOhMtCQc4+mxB4h2c9aD878YP1vHBhHEB 9dU1xXbDN0CxYcKfUkDDdw0makzGRZefjURNwsE1hDgVvms3XgY5RJ5no/mjCQOoeTM6br 5Smkae6wgt6JRCYNWzZS4jE0dNPgVOsjHEMhLhEiVy7gZVZ99+cpuGsO/PwZ1A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663926743; a=rsa-sha256; cv=none; b=SIRfy2B45utqj+QR/3uzyj6Z6e63NKCaI9aJmDc8hOHhaOoBJEMa/WiHEaJmaBqQotsaBw eXrurqzTaEwqYFzgL7g8paML8EBXxuwpsFSxVkNdaECRKJKjAFuAh4IUzH8yUtjc1UGi+/ Pp38jdGl1efCp6FgLEVKPZeOUqHsf7bOvVWhAYSQzBSpRuj3FsjLbNyqzGjgzTSXPDCJzP vfFqernhp1Kk472gA5wHjNB19wsgtBt/D6oB2EuGTxPS1/zu084XMfcPtcHe5wrDwww84N SO+QuNfZkQLti95qKZl+fqUBzM3qpHTGld+lwV/wfi3liCXR1hoyk0VjlPt6WA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=tum.de (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 3.55 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=tum.de (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: AC1539FB6 X-Spam-Score: 3.55 X-Migadu-Scanner: scn1.migadu.com X-TUID: lLC/duVIhScS --=-=-= Content-Type: text/plain 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). --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-WIP-update-haskell-build-system-for-newer-attoparsec.patch >From 959dc9de2d4aa39b7490b4c90e28820edf0d00f9 Mon Sep 17 00:00:00 2001 From: itd 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 --=-=-= Content-Type: text/plain Regards itd --=-=-=--