From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-ID: <87h9refc0y.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtBWp-0005f0-38 for guix-devel@gnu.org; Fri, 15 May 2015 05:03:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtBWi-0003H5-Mg for guix-devel@gnu.org; Fri, 15 May 2015 05:03:35 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:33960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtBWi-0003Gv-BP for guix-devel@gnu.org; Fri, 15 May 2015 05:03:28 -0400 Received: by wicmc15 with SMTP id mc15so33983368wic.1 for ; Fri, 15 May 2015 02:03:27 -0700 (PDT) In-Reply-To: (Alex Vorobiev's message of "Fri, 15 May 2015 04:07:39 +0000 (UTC)") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Alex Vorobiev Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain Alex Vorobiev 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Parameterize-references-to-gnu-store.patch >From 97b43ab87a35fce3b197edf75f8545cfac5860f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?= 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 . (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 . (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 --=-=-= Content-Type: text/plain Taylan --=-=-=--