[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 11:03:25 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Alex Vorobiev <address@hidden> writes:
> Hi,
> I have built guix-0.8.2 and specified both --with-store-dir and --
> localstatedir (both directories are world-writable) but when I started
> guix-daemon (as myself) and tried to install a package I got:
>
> $ guix package -i mc
> guix package: error: build failed: creating directory `/gnu': Permission
> denied
>
> Am I doing anything wrong? Why would it want to go to /gnu? I am using
> RHEL-6.5.
>
> Thanks,
> Alex
The local state dir would be 'var' (e.g. /var, /usr/var, /usr/local/var,
depending on the value for $prefix), and I've used that option before
and believe it works fine. (At the very least I've seen --prefix affect
its default value.)
So I believe your problem is about --with-store-dir only.
I've grepped a fresh guix clone for the raw string '/gnu/store' in .c,
.cc, .scm, and .sh files, and outside of comments and docstrings, found
the following:
guix/build/utils.scm:
(define (%store-directory)
"Return the directory name of the store."
(or (getenv "NIX_STORE")
"/gnu/store"))
guix/packages.scm (patch-and-repack):
(let* ((store (or (getenv "NIX_STORE") "/gnu/store"))
gnu/packages/busybox.scm (busybox):
(substitute* "testsuite/cpio.tests"
(("/usr/bin") "/gnu/store")
(("usr") "gnu"))
(There are also some matches in the tests/ directory but I think they're
harmless.)
Those should probably use %store-directory from (guix config). Here's a
patch doing that, but note that:
- In the busybox recipe, the "gnu" is replaced by (car (filter (negate
string-null?) (string-split (%store-directory) #\/))) meaning it
assumes (%store-directory) not to be the root directory. (Note that
this uses the %store-directory procedure from (guix build utils); see
next point.)
- (guix build utils) has its own %store-directory bound to a procedure
doing environment variable look-up on NIX_STORE instead of
NIX_STORE_DIR (which determines the value of %store-directory from
(guix config)); I preserved this semantics by importing
%store-directory from (guix config) with a rename and falling back to
it only if NIX_STORE is unset.
- Similarly, packages.scm checks NIX_STORE and not NIX_STORE_DIR, and I
preserved this semantics by falling back to %store-directory only if
NIX_STORE is unset.
Are these decisions right?
The patch:
>From 97b43ab87a35fce3b197edf75f8545cfac5860f7 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/build/utils.scm (%store-directory): Fall back to the value of
%store-directory from (guix config) instead of "/gnu/store".
* guix/packages.scm (patch-and-repack): Likewise.
---
gnu/packages/busybox.scm | 5 +++--
guix/build/utils.scm | 3 ++-
guix/packages.scm | 4 +++-
3 files changed, 8 insertions(+), 4 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/build/utils.scm b/guix/build/utils.scm
index 676a012..903cea9 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -19,6 +19,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix build utils)
+ #:use-module ((guix config) #:prefix config)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-60)
@@ -80,7 +81,7 @@
(define (%store-directory)
"Return the directory name of the store."
(or (getenv "NIX_STORE")
- "/gnu/store"))
+ config:%store-directory))
(define (store-file-name? file)
"Return true if FILE is in the store."
diff --git a/guix/packages.scm b/guix/packages.scm
index c955b35..d312d05 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -18,6 +18,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(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))
(len (+ 1 (string-length store)))
(base (string-drop #+source len))
(dash (string-index base #\-))
--
2.2.1
Taylan
- --with-store-dir and/or --localstatedir seem to be ignored, Alex Vorobiev, 2015/05/15
- Re: --with-store-dir and/or --localstatedir seem to be ignored,
Taylan Ulrich Kammer <=
- Re: --with-store-dir and/or --localstatedir seem to be ignored, Ludovic Courtès, 2015/05/15
- Re: --with-store-dir and/or --localstatedir seem to be ignored, Taylan Ulrich Kammer, 2015/05/15
- Re: --with-store-dir and/or --localstatedir seem to be ignored, Ludovic Courtès, 2015/05/15
- Re: --with-store-dir and/or --localstatedir seem to be ignored, Taylan Ulrich Kammer, 2015/05/15
- Re: --with-store-dir and/or --localstatedir seem to be ignored, Ludovic Courtès, 2015/05/15
- ftp Re: --with-store-dir and/or --localstatedir seem to be ignored, Alex Vorobiev, 2015/05/15
- Re: ftp Re: --with-store-dir and/or --localstatedir seem to be ignored, Ludovic Courtès, 2015/05/16
- Re: ftp Re: --with-store-dir and/or --localstatedir seem to be ignored, Alex Vorobiev, 2015/05/20
- Re: ftp Re: --with-store-dir and/or --localstatedir seem to be ignored, Ludovic Courtès, 2015/05/21
- Re: --with-store-dir and/or --localstatedir seem to be ignored, Mark H Weaver, 2015/05/19