all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex Vong <alexvong1995@gmail.com>
To: 33077@debbugs.gnu.org
Cc: alexvong1995@gmail.com
Subject: [bug#33077] [PATCH 1/2] build-system/haskell: Use 'strip-store-file-name'.
Date: Thu, 18 Oct 2018 03:40:18 +0800	[thread overview]
Message-ID: <874ldkfjkt.fsf@gmail.com> (raw)
In-Reply-To: <87d0s8fk5p.fsf@gmail.com>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1: 0001-build-system-haskell-Use-strip-store-file-name.patch --]
[-- Type: text/x-diff, Size: 7097 bytes --]

From 0c4ece986917593b4f940c780e788009a38ce4b0 Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Thu, 18 Oct 2018 02:53:32 +0800
Subject: [PATCH 1/2] build-system/haskell: Use 'strip-store-file-name'.

See the discussion at
<https://lists.gnu.org/archive/html/guix-devel/2018-10/msg00250.html>.

* guix/build/haskell-build-system.scm (package-name-version): Remove it.
(configure): Use 'strip-store-file-name' instead of 'package-name-version'.
(setup-compiler): Likewise.
(make-ghc-package-database): Likewise.
(register): Likewise.
* gnu/packages/haskell.scm (ghc-cairo)[arguments]: Likewise.
* gnu/packages/agda.scm (agda)[arguments]: Likewise.
---
 gnu/packages/agda.scm               |  4 ++--
 gnu/packages/haskell.scm            |  4 ++--
 guix/build/haskell-build-system.scm | 19 ++++++++-----------
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/agda.scm b/gnu/packages/agda.scm
index 6bb38aac4..26c5012bb 100644
--- a/gnu/packages/agda.scm
+++ b/gnu/packages/agda.scm
@@ -85,6 +85,7 @@
            (lambda* (#:key outputs inputs tests? (configure-flags '())
                      #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
+                    (name-version (strip-store-file-name out))
                     (input-dirs (match inputs
                                   (((_ . dir) ...)
                                    dir)
@@ -95,8 +96,7 @@
                                     `(,(string-append "--bindir=" out "/bin"))
                                     `(,(string-append
                                         "--docdir=" out
-                                        "/share/doc/" ((@@ (guix build haskell-build-system)
-                                                           package-name-version) out)))
+                                        "/share/doc/" name-version))
                                     '("--libsubdir=$compiler/$pkg-$version")
                                     '("--package-db=../package.conf.d")
                                     '("--global")
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 0a90ac523..57435dca0 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -10619,6 +10619,7 @@ expose it from another module in the hierarchy.
            (lambda* (#:key outputs inputs tests? (configure-flags '())
                      #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
+                    (name-version (strip-store-file-name out))
                     (input-dirs (match inputs
                                   (((_ . dir) ...)
                                    dir)
@@ -10629,8 +10630,7 @@ expose it from another module in the hierarchy.
                                     `(,(string-append "--bindir=" out "/bin"))
                                     `(,(string-append
                                         "--docdir=" out
-                                        "/share/doc/" ((@@ (guix build haskell-build-system)
-                                                           package-name-version) out)))
+                                        "/share/doc/" name-version))
                                     '("--libsubdir=$compiler/$pkg-$version")
                                     '("--package-db=../package.conf.d")
                                     '("--global")
diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm
index 72714a29a..3cd49d4f4 100644
--- a/guix/build/haskell-build-system.scm
+++ b/guix/build/haskell-build-system.scm
@@ -78,6 +78,7 @@ and parameters ~s~%"
          (doc (assoc-ref outputs "doc"))
          (lib (assoc-ref outputs "lib"))
          (bin (assoc-ref outputs "bin"))
+         (name-version (strip-store-file-name out))
          (input-dirs (match inputs
                        (((_ . dir) ...)
                         dir)
@@ -88,7 +89,7 @@ and parameters ~s~%"
                          `(,(string-append "--bindir=" (or bin out) "/bin"))
                          `(,(string-append
                              "--docdir=" (or doc out)
-                             "/share/doc/" (package-name-version out)))
+                             "/share/doc/" name-version))
                          '("--libsubdir=$compiler/$pkg-$version")
                          `(,(string-append "--package-db=" %tmp-db-dir))
                          '("--global")
@@ -127,12 +128,6 @@ and parameters ~s~%"
   "Install a given Haskell package."
   (run-setuphs "copy" '()))
 
-(define (package-name-version store-dir)
-  "Given a store directory STORE-DIR return 'name-version' of the package."
-  (let* ((base (basename store-dir)))
-    (string-drop base
-                 (+ 1 (string-index base #\-)))))
-
 (define (grep rx port)
   "Given a regular-expression RX including a group, read from PORT until the
 first match and return the content of the group."
@@ -147,7 +142,7 @@ first match and return the content of the group."
 (define* (setup-compiler #:key system inputs outputs #:allow-other-keys)
   "Setup the compiler environment."
   (let* ((haskell (assoc-ref inputs "haskell"))
-         (name-version (package-name-version haskell)))
+         (name-version (strip-store-file-name haskell)))
     (cond
      ((string-match "ghc" name-version)
       (make-ghc-package-database system inputs outputs))
@@ -164,6 +159,7 @@ first match and return the content of the group."
 (define (make-ghc-package-database system inputs outputs)
   "Generate the GHC package database."
   (let* ((haskell  (assoc-ref inputs "haskell"))
+         (name-version (strip-store-file-name haskell))
          (input-dirs (match inputs
                        (((_ . dir) ...)
                         dir)
@@ -171,7 +167,7 @@ first match and return the content of the group."
          ;; Silence 'find-files' (see 'evaluate-search-paths')
          (conf-dirs (with-null-error-port
                      (search-path-as-list
-                      `(,(string-append "lib/" (package-name-version haskell)))
+                      `(,(string-append "lib/" name-version))
                       input-dirs #:pattern ".*\\.conf.d$")))
          (conf-files (append-map (cut find-files <> "\\.conf$") conf-dirs)))
     (mkdir-p %tmp-db-dir)
@@ -231,9 +227,10 @@ given Haskell package."
 
   (let* ((out (assoc-ref outputs "out"))
          (haskell  (assoc-ref inputs "haskell"))
+         (name-verion (strip-store-file-name haskell))
          (lib (string-append out "/lib"))
-         (config-dir (string-append lib "/"
-                                    (package-name-version haskell)
+         (config-dir (string-append lib
+                                    "/" name-verion
                                     "/" name ".conf.d"))
          (id-rx (make-regexp "^id: *(.*)$"))
          (config-file (string-append out "/" name ".conf"))
-- 
2.19.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  parent reply	other threads:[~2018-10-17 19:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 19:27 [bug#33077] [PATCH 0/2] Use 'strip-store-file-name' instead of 'package-name-version' Alex Vong
2018-10-17 19:37 ` Alex Vong
2018-10-17 19:51   ` Alex Vong
2018-10-17 19:40 ` Alex Vong [this message]
2018-10-17 19:41 ` [bug#33077] [PATCH 2/2] java-utils: Use 'strip-store-file-name' Alex Vong
2018-10-17 19:54 ` [bug#33077] [PATCH 1/2] build-system/haskell: " Alex Vong
2018-10-19 21:20   ` bug#33077: " Ludovic Courtès
2018-10-17 19:55 ` [bug#33077] [PATCH 2/2] java-utils: " Alex Vong

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=874ldkfjkt.fsf@gmail.com \
    --to=alexvong1995@gmail.com \
    --cc=33077@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.