guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: --with-store-dir and/or --localstatedir seem to be ignored


From: Taylan Ulrich Kammer
Subject: Re: --with-store-dir and/or --localstatedir seem to be ignored
Date: Fri, 15 May 2015 16:03:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

address@hidden (Ludovic Courtès) writes:

>> * guix/build/utils.scm (%store-directory): Fall back to the value of
>>   %store-directory from (guix config) instead of "/gnu/store".
>
> This won’t work: (guix config) is meant as a “host-side” module, and
> anyway the daemon always defines ‘NIX_STORE’ in the build environment,
> so it’s unnecessary.
>
>> * guix/packages.scm (patch-and-repack): Likewise.
>
> [...]
>
>>  (define-module (guix packages)
>> +  #:use-module ((guix config) #:prefix config)
>>    #:use-module (guix utils)
>>    #:use-module (guix records)
>>    #:use-module (guix store)
>> @@ -445,7 +446,8 @@ IMPORTED-MODULES specify modules to use/import for use 
>> by SNIPPET."
>>  
>>            ;; SOURCE may be either a directory or a tarball.
>>            (and (if (file-is-directory? #+source)
>> -                   (let* ((store     (or (getenv "NIX_STORE") "/gnu/store"))
>> +                   (let* ((store     (or (getenv "NIX_STORE")
>> +                                         config:%store-directory))
>
> This won’t work: the code here is within a gexp, which will run in a
> different context where (guix config) is not available.

I see, thanks for the explanation!

Here's the updated patch, against core-updates:

>From 2dcd57e71c86c780e0e06ae5579c2f8e65b3de91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <address@hidden>
Date: Fri, 15 May 2015 10:59:44 +0200
Subject: [PATCH] Parameterize references to /gnu/store.

* gnu/packages/busybox.scm (busybox): Call %store-directory from (guix build
  utils) instead of referencing "/gnu/store" directly.

* guix/packages.scm (patch-and-repack): Likewise.
---
 gnu/packages/busybox.scm | 5 +++--
 guix/packages.scm        | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/busybox.scm b/gnu/packages/busybox.scm
index d200cd7..13630b3 100644
--- a/gnu/packages/busybox.scm
+++ b/gnu/packages/busybox.scm
@@ -53,8 +53,9 @@
 
            ;; There is no /usr/bin or /bin - replace it with /gnu/store
            (substitute* "testsuite/cpio.tests"
-              (("/usr/bin") "/gnu/store")
-              (("usr") "gnu"))
+              (("/usr/bin") (%store-directory))
+              (("usr") (car (filter (negate string-null?)
+                                    (string-split (%store-directory) #\/)))))
 
            (substitute* "testsuite/date/date-works-1"
              (("/bin/date") (which "date")))
diff --git a/guix/packages.scm b/guix/packages.scm
index a979f31..f6dda45 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -466,7 +466,7 @@ IMPORTED-MODULES specify modules to use/import for use by 
SNIPPET."
 
           ;; SOURCE may be either a directory or a tarball.
           (and (if (file-is-directory? #+source)
-                   (let* ((store     (or (getenv "NIX_STORE") "/gnu/store"))
+                   (let* ((store     (%store-directory))
                           (len       (+ 1 (string-length store)))
                           (base      (string-drop #+source len))
                           (dash      (string-index base #\-))
-- 
2.2.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]