From patchwork Wed Apr 6 19:19:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 38366 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 2AFA727BBEB; Wed, 6 Apr 2022 20:20:14 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 90C8F27BBE9 for ; Wed, 6 Apr 2022 20:20:13 +0100 (BST) Received: from localhost ([::1]:42276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncBCO-0003Vx-Of for patchwork@mira.cbaines.net; Wed, 06 Apr 2022 15:20:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncBCE-0003Vh-87 for guix-patches@gnu.org; Wed, 06 Apr 2022 15:20:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37037) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncBCD-00040I-VN for guix-patches@gnu.org; Wed, 06 Apr 2022 15:20:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ncBCD-0002uP-QO for guix-patches@gnu.org; Wed, 06 Apr 2022 15:20:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54729] [PATCH core-updates v2 1/2] build: haskell-build-system: Remove trailing #t. References: <8a396a9803fc35ee63f01e608f87ffb16863bc6d.1649171729.git.philip@munksgaard.me> In-Reply-To: <8a396a9803fc35ee63f01e608f87ffb16863bc6d.1649171729.git.philip@munksgaard.me> Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Apr 2022 19:20:01 +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 Cc: zimoun Received: via spool by 54729-submit@debbugs.gnu.org id=B54729.164927276811117 (code B ref 54729); Wed, 06 Apr 2022 19:20:01 +0000 Received: (at 54729) by debbugs.gnu.org; 6 Apr 2022 19:19:28 +0000 Received: from localhost ([127.0.0.1]:59165 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ncBBg-0002tE-Dd for submit@debbugs.gnu.org; Wed, 06 Apr 2022 15:19:28 -0400 Received: from mail-wr1-f49.google.com ([209.85.221.49]:38533) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ncBBe-0002sq-Nv for 54729@debbugs.gnu.org; Wed, 06 Apr 2022 15:19:27 -0400 Received: by mail-wr1-f49.google.com with SMTP id j12so4676838wrb.5 for <54729@debbugs.gnu.org>; Wed, 06 Apr 2022 12:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xZXE2N5vOvHKN5yXm5bcWpyYr4ZkLhwYjOSD6Z21NtM=; b=Xuqj73HGn5i8z8e0IpqxrbHXvdPrZR5575gkbixzw+yvZyZR0nY7MeLdBlkv7Xlv0m INa85OATR2fBRG5s1r/Zii8dumqZ7iUsxc7KPctxP9mID7VwtQqsxkG9bc9rJZc0zjpA hbb/oeDoR95sBqYOkVLYGpaWZ0htZYH6wyPI5bwnRo01YSUVXiT96/3J6Yap53/NmhK0 8e3dfBnPNjRu6Wk9oT5OcDOrjQLZAjiaQctQuWlsfxEfFWuXS6gHnxCNoh9+OlRVTDbT Z+2qYNYjy5iaXsYlU1/DNZ5Mvqk1wK4FTjUihanUZV/jr5R6qlDZHIc+iYO/N0YSxHv8 AMCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xZXE2N5vOvHKN5yXm5bcWpyYr4ZkLhwYjOSD6Z21NtM=; b=BFL+m11HGUh/sMRTp7GdnvybnTI59jdvwDr+OPU+F92UxxRzSupxfA/XHuC1HMw1XP gM4lBga8SSsoSjUptH+wOAEQGBHK33lXL2jM8uJKgDbJNHcQ2nEUEMZSPnp4hoXWA8i0 mNcZK4zBa/QkFILHo/oLI2iBcqDnfpn7yU7C4LKMVEW2Sir+YwgLnzQ9SyFZ6cY+G/vU khRbxGo/QCbgT9pxqj+f2ztbaxgpaFWlnIgK8nbEwxg0g5flQJzQwW8iAI8XdTg6IUbt /cI05815byTJ2O28TYOrTFdX4La2tc3lRz06p9WU8HDelg9E0pllB1DFGnMqU+09wNA3 pzTw== X-Gm-Message-State: AOAM5313MmiTxbNMK5A71MRozIrWhA/UeHHoNiu9A+DPAhhYUyjJeWv2 +LyT4osPuUipAtkK2ToMjTYHN7vvFyE= X-Google-Smtp-Source: ABdhPJy+dnNm4cRRlxfNUJOoIanymasw8sJRsnAwcBnJCj+qrb8CBBkH3lrlEXy7HEpdDa9jATb+Cw== X-Received: by 2002:a05:6000:2a8:b0:205:8817:8296 with SMTP id l8-20020a05600002a800b0020588178296mr7852023wry.309.1649272760755; Wed, 06 Apr 2022 12:19:20 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id u12-20020a5d6dac000000b00204119d37d0sm15230647wrs.26.2022.04.06.12.19.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 12:19:20 -0700 (PDT) From: zimoun Date: Wed, 6 Apr 2022 21:19:07 +0200 Message-Id: <20220406191908.2393054-1-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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(-) base-commit: e3e3381fdbc56f351063d9b4a49e99645b20d7d3 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 ;;; Copyright © 2018 Alex Vong ;;; Copyright © 2021 John Kehayias +;;; Copyright © 2022 Simon Tournier ;;; ;;; 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 From patchwork Wed Apr 6 19:19:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 38367 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5F0C427BBEA; Wed, 6 Apr 2022 20:20:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id BB18727BBE9 for ; Wed, 6 Apr 2022 20:20:15 +0100 (BST) Received: from localhost ([::1]:42320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncBCQ-0003Xs-Tj for patchwork@mira.cbaines.net; Wed, 06 Apr 2022 15:20:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncBCE-0003Vp-S7 for guix-patches@gnu.org; Wed, 06 Apr 2022 15:20:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37038) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncBCE-00040l-IX for guix-patches@gnu.org; Wed, 06 Apr 2022 15:20:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ncBCE-0002uX-BK for guix-patches@gnu.org; Wed, 06 Apr 2022 15:20:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54729] [PATCH core-updates v2 2/2] build: haskell-build-system: Support multiple libraries. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Apr 2022 19:20: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 Cc: Philip Munksgaard , zimoun Received: via spool by 54729-submit@debbugs.gnu.org id=B54729.164927277011127 (code B ref 54729); Wed, 06 Apr 2022 19:20:02 +0000 Received: (at 54729) by debbugs.gnu.org; 6 Apr 2022 19:19:30 +0000 Received: from localhost ([127.0.0.1]:59167 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ncBBh-0002tN-Q6 for submit@debbugs.gnu.org; Wed, 06 Apr 2022 15:19:30 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:36380) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ncBBe-0002sr-Pg for 54729@debbugs.gnu.org; Wed, 06 Apr 2022 15:19:27 -0400 Received: by mail-wr1-f42.google.com with SMTP id u3so4688556wrg.3 for <54729@debbugs.gnu.org>; Wed, 06 Apr 2022 12:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G/eDU2C54YUH9mTJCSxb2PuIDuSay4sTs+jgDyjAG/w=; b=qNYRVYQmhRTcX6a/NZcH+Si+PtBvkzznYo8psDwc1n2dUty/4AstiGbb+PAl/DVjOU NImh+ywErefI+eIIiT9TQMIk2Rr1dR9Tb8KtsGc9AQNd5ldg1NGBcmp6Lg5wUPqUDasA 6JnRPAkG9XZyg1lGxQ+xJSGs23DHQgK9w2KCGijGMtkHsiO9qA80UXm1l/Ru8Chbd0k/ 82j5nwFGkG7WAAX2PaqB0q+oPCVlVeOqW+kV0AnzQVqOe4pRhL0WEI1+S1llD3kwH9jX yXtypn7wZYX6ooRUymFMUFTqrTveF5RAYQ+9Q95m8o0FPNVpDjw4knC41PKsyFSiZ1eX POPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G/eDU2C54YUH9mTJCSxb2PuIDuSay4sTs+jgDyjAG/w=; b=v/uDudZ6Z/96VjTRXlRg48vl7lF0rZbce0iMs2/DG9Ty+IGMAcq2Hgl+JAIky/dcGs 21Y3WtIW3D1ea8xGhNF+WVqYgzaCPIJzDcvA3MDQA9D2WY2GHB6VRsZCcx8Fjs28gUoh mMlLwBjdxzLkKOTdtqwZLIy0KBqiuBBWj4hfqX7yqF/eRJpm33/G/1cVKHJ9LPv7r2zY zcwZG6fijZEeYegKhPvNAu9bSj5QWSQJUV796m7HRa16QoH6E1yiciRnj2IZ4iSQNNQu 6FpK0SF0SvCqaEj798W/g3taNBvwtc7KyXwpKNBHh59zcdL4XQI4IOPQUepMtnKD7Jq+ LoaA== X-Gm-Message-State: AOAM531Ln8CJFcVp9NHqlRcDagHFNgNrlT2NAhIHpmUqequzj3gzyXma 2/dUU6EmC+b2eERuUCeaDE2uLTzbyys= X-Google-Smtp-Source: ABdhPJzHtkMcl6H+spEDxvLugvbNh8rGwpug+J9P/laBIPnBc98yx/nDuh1ROq6pt2hIZt9GiqEf5w== X-Received: by 2002:a5d:49c9:0:b0:206:1327:5058 with SMTP id t9-20020a5d49c9000000b0020613275058mr7831013wrs.555.1649272761184; Wed, 06 Apr 2022 12:19:21 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id u12-20020a5d6dac000000b00204119d37d0sm15230647wrs.26.2022.04.06.12.19.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 12:19:20 -0700 (PDT) From: zimoun Date: Wed, 6 Apr 2022 21:19:08 +0200 Message-Id: <20220406191908.2393054-2-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220406191908.2393054-1-zimon.toutoune@gmail.com> References: <20220406191908.2393054-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches From: Philip Munksgaard Fixes . 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 . --- guix/build/haskell-build-system.scm | 87 ++++++++++++++++------------- 1 file changed, 49 insertions(+), 38 deletions(-) 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 ;;; Copyright © 2021 John Kehayias ;;; Copyright © 2022 Simon Tournier +;;; Copyright © 2022 Philip Munksgaard ;;; ;;; 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."