unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCHES] for Haskell packages
@ 2015-06-06 12:36 Eric Bavier
  2015-06-10 19:42 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Bavier @ 2015-06-06 12:36 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 157 bytes --]

Hello Guix,

Attached are three patches to help our haskell-build-system and profile
creation work a bit better in the presence of Haskell libraries.

`~Eric

[-- Attachment #2: 0001-profiles-Search-for-ghc-conf-files-only-if-package-d.patch --]
[-- Type: application/octet-stream, Size: 1165 bytes --]

From 75a4305391cd246a6e8db5b11223f9ce243edd35 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Sat, 6 Jun 2015 06:38:58 -0500
Subject: [PATCH 1/3] profiles: Search for ghc conf files only if package db
 exists.

This avoids having 'find-files' report warnings about searching in
non-existent directories.

* guix/profiles.scm (ghc-package-cache-file)[conf-files]: Only search
  for *.conf files if the search directory exists.
---
 guix/profiles.scm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index 28150af..33a0511 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -500,7 +500,10 @@ entries of MANIFEST, or #f if MANIFEST does not have any GHC packages."
           (string-append #$output "/" db-subdir))
 
         (define (conf-files top)
-          (find-files (string-append top "/" db-subdir) "\\.conf$"))
+          (let ((db (string-append top "/" db-subdir)))
+            (if (file-exists? db)
+                (find-files db "\\.conf$")
+                '())))
 
         (define (copy-conf-file conf)
           (let ((base (basename conf)))
-- 
2.2.1


[-- Attachment #3: 0002-profiles-Process-ghc-conf-files-only-once.patch --]
[-- Type: application/octet-stream, Size: 1218 bytes --]

From 08d67857d9726a2fddbc834c34caaae3e5a5d4f2 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Sat, 6 Jun 2015 06:43:19 -0500
Subject: [PATCH 2/3] profiles: Process ghc conf files only once.

A package may be listed in the manifest inputs multiple times.  Avoid
copying ghc *.conf files twice by deleting duplicates.

* guix/profiles.scm (ghc-package-cache-file)[conf-files]: Delete
  duplicate manifest inputs before copying conf files.
---
 guix/profiles.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index 33a0511..5c19c95 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -512,7 +512,8 @@ entries of MANIFEST, or #f if MANIFEST does not have any GHC packages."
         (system* (string-append #+ghc "/bin/ghc-pkg") "init" db-dir)
         (for-each copy-conf-file
                   (append-map conf-files
-                              '#$(manifest-inputs manifest)))
+                              (delete-duplicates
+                               '#$(manifest-inputs manifest))))
         (let ((success
                (zero?
                 (system* (string-append #+ghc "/bin/ghc-pkg") "recache"
-- 
2.2.1


[-- Attachment #4: 0003-build-system-haskell-install-config-for-any-package-.patch --]
[-- Type: application/octet-stream, Size: 1828 bytes --]

From 480d18c683d3d74fab46578c93fb4cbf81d1a8be Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Sat, 6 Jun 2015 07:28:57 -0500
Subject: [PATCH 3/3] build-system/haskell: install config for any package that
 creates it.

A Cabal package is allowed to declare an "empty" library, in an
otherwise executable-only package, for the purpose of allowing Cabal
to use it as a dependency for other packages.  See e.g. hspec-discover.

* guix/build/haskell-build-system.scm (register): Unconditionally call
  setup script with "register", and install any config file generated.
---
 guix/build/haskell-build-system.scm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm
index d382ee4..c0cb789 100644
--- a/guix/build/haskell-build-system.scm
+++ b/guix/build/haskell-build-system.scm
@@ -166,13 +166,13 @@ generate the cache as it would clash in user profiles."
                                     (package-name-version haskell)
                                     "/package.conf.d"))
          (id-rx (make-regexp "^id: *(.*)$"))
-         (lib-rx (make-regexp "lib.*\\.(a|so)"))
-         (config-file (string-append config-dir "/" name ".conf"))
+         (config-file (string-append out "/" name ".conf"))
          (params
           (list (string-append "--gen-pkg-config=" config-file))))
-    (unless (null? (find-files lib lib-rx))
+    (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)
-      (run-setuphs "register" params)
       (let ((config-file-name+id
              (call-with-ascii-input-file config-file (cut grep id-rx <>))))
         (rename-file config-file
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCHES] for Haskell packages
  2015-06-06 12:36 Eric Bavier
@ 2015-06-10 19:42 ` Ludovic Courtès
  0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2015-06-10 19:42 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

Federico would be the expert, but it looks good to me:

Eric Bavier <ericbavier@openmailbox.org> skribis:

> From 75a4305391cd246a6e8db5b11223f9ce243edd35 Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Sat, 6 Jun 2015 06:38:58 -0500
> Subject: [PATCH 1/3] profiles: Search for ghc conf files only if package db
>  exists.
>
> This avoids having 'find-files' report warnings about searching in
> non-existent directories.
>
> * guix/profiles.scm (ghc-package-cache-file)[conf-files]: Only search
>   for *.conf files if the search directory exists.

OK, makes sense.

> From 08d67857d9726a2fddbc834c34caaae3e5a5d4f2 Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Sat, 6 Jun 2015 06:43:19 -0500
> Subject: [PATCH 2/3] profiles: Process ghc conf files only once.
>
> A package may be listed in the manifest inputs multiple times.  Avoid
> copying ghc *.conf files twice by deleting duplicates.
>
> * guix/profiles.scm (ghc-package-cache-file)[conf-files]: Delete
>   duplicate manifest inputs before copying conf files.

OK.

> From 480d18c683d3d74fab46578c93fb4cbf81d1a8be Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Sat, 6 Jun 2015 07:28:57 -0500
> Subject: [PATCH 3/3] build-system/haskell: install config for any package that
>  creates it.
>
> A Cabal package is allowed to declare an "empty" library, in an
> otherwise executable-only package, for the purpose of allowing Cabal
> to use it as a dependency for other packages.  See e.g. hspec-discover.
>
> * guix/build/haskell-build-system.scm (register): Unconditionally call
>   setup script with "register", and install any config file generated.

OK!

Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHES] for Haskell packages
@ 2015-06-11  7:39 Federico Beffa
  0 siblings, 0 replies; 3+ messages in thread
From: Federico Beffa @ 2015-06-11  7:39 UTC (permalink / raw)
  To: ludo, Eric Bavier; +Cc: Guix-devel

ludo@gnu.org (Ludovic Courtès) writes:

> Federico would be the expert, but it looks good to me:

... I'm far from an expert, but I think these are good improvements.

Regards,
Fede

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-11  7:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-11  7:39 [PATCHES] for Haskell packages Federico Beffa
  -- strict thread matches above, loose matches on Subject: below --
2015-06-06 12:36 Eric Bavier
2015-06-10 19:42 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).