Re: [PATCH] gnu: guix-0.8.1: Add gnutls to propagated inputs.

2015-05-13 Thread Taylan Ulrich Kammer
l...@gnu.org (Ludovic Courtès) writes:

> The new tarball is 41 MiB instead of 37 MiB, which sounds acceptable.
>
> Pushed, thanks!

Thanks for taking care of it. :-)

(We actually moved about two weeks ago and my workflow still hasn't
re-stabilized; apologies for delays.)

Taylan



Re: [PATCH] Add guile-emacs!

2015-05-14 Thread Taylan Ulrich Kammer
Christopher Allan Webber  writes:

> Okay, how about a version of guile-emacs that works and incorporates
> feedback from this thread?  Yeah?  Anyone?
>
> Whoo guile-emacs! :)

Yay! :-)

I would have thought these would go to guile.scm and emacs.scm.  What do
others think?

> +(define-public guile-for-guile-emacs
> [...]
> +(inputs
> + `(("gettext" ,gnu-gettext)

Sure it shouldn't be in native-inputs?  I'm guessing autogen uses it.

> +(define-public guile-emacs
> [...]
> + (substitute-keyword-arguments `(#:parallel-build? #f 

A comment explaining why parallel builds are disabled would be good.

> + ;; Tests aren't passing for now.
> + ;; Obviously we should re-enable this!
> + #:tests? #f

Tests should generally always be enabled so the second line of the
comment would be redundant; just a nitpick. :-)


Otherwise looks good to me.  Thanks!

Taylan



Re: [PATCH] Add guile-emacs!

2015-05-14 Thread Taylan Ulrich Kammer
Christopher Allan Webber  writes:

>>> +(define-public guile-for-guile-emacs
>>> [...]
>>> +(inputs
>>> + `(("gettext" ,gnu-gettext)
>>
>> Sure it shouldn't be in native-inputs?  I'm guessing autogen uses it.
>
> So, could someone describe the difference between inputs and
> native-inputs?  The manual provides no clarity!  I never know where it
> goes and why... I just mime what other packages are doing.

Perhaps a bug report should be opened about the absence of documentation
on native and propagated inputs...

When an input is in native-inputs instead of inputs, then it is ensured
during cross-compilation that the version present during the build of
the package will be for the platform on which the build is happening;
this is necessary if executables from the input will be run during the
build, such as the autotools suite, bash, gcc, etc.  (The latter are
implicit native inputs of the gnu-build-system AFAIK.)

Gettext will probably be run on the source code to extract localizable
strings; if so then it should be a native input.

If it were just a shared library like libpng, or a program that will be
used during use of the package (such as the 'git' input to 'magit'),
then it needn't be a native input since no executables from it will be
run during the build and it doesn't matter if it's for another platform.

Hope that helps!
Taylan



[PATCH] doc: Document native-inputs and propagated-inputs.

2015-05-14 Thread Taylan Ulrich Kammer
>From 0f001497234df55e3c131c10f84ddf184261ee09 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 
Date: Thu, 14 May 2015 22:37:04 +0200
Subject: [PATCH] doc: Document native-inputs and propagated-inputs.

* doc/guix.texi (Defining Packages): Add `native-inputs' and
  `propagated-inputs' fields to the example package recipe, and explain them.
---
 doc/guix.texi | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 049292d..1826b25 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -1716,6 +1716,8 @@ package looks like this:
 (build-system gnu-build-system)
 (arguments `(#:configure-flags '("--enable-silent-rules")))
 (inputs `(("gawk" ,gawk)))
+(native-inputs `(("pkg-config" ,pkg-config)))
+(propagated-inputs `(("libfoo" ,libfoo)))
 (synopsis "Hello, GNU world: An example GNU package")
 (description "Guess what GNU Hello prints!")
 (home-page "http://www.gnu.org/software/hello/";)
@@ -1791,6 +1793,23 @@ of ensuring that they are present (@pxref{Build Systems}).
 However, any other dependencies need to be specified in the
 @code{inputs} field.  Any dependency not specified here will simply be
 unavailable to the build process, possibly leading to a build failure.
+
+@item
+The @code{native inputs} field specifies inputs for which it should be
+ensured that the version present at build-time is for the architecture
+on which the build is running.  This is necessary for cross-compilation
+when programs from the input will be executed at build-time.  This field
+will frequently have build tools such as autotools components, libtool,
+pkg-config, or gettext.
+
+@item
+The @code{propagated inputs} field specifies inputs whose installation
+should be forced alongside the installation of the package.  For
+example, some shared libraries expect another shared library, on which
+they depend, to be linked alongside them.  In that case said dependency
+should be installed alongside the library, so that when a program wants
+to use the library it can correctly link against both the library and
+its dependency.
 @end itemize
 
 Once a package definition is in place, the
-- 
2.2.1




Re: [PATCH] Add guile-emacs!

2015-05-14 Thread Taylan Ulrich Kammer
Taylan Ulrich Kammer  writes:

> Perhaps a bug report should be opened about the absence of documentation
> on native and propagated inputs...

FYI, instead of a bug report, I just sent a patch to add them to the
documentation.  (Hoping my documentation skills are good enough.)

Taylan



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

2015-05-15 Thread Taylan Ulrich Kammer
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:

>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* ((st

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

2015-05-15 Thread Taylan Ulrich Kammer
l...@gnu.org (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?=
 
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



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

2015-05-15 Thread Taylan Ulrich Kammer
l...@gnu.org (Ludovic Courtès) writes:

>> * gnu/packages/busybox.scm (busybox): Call %store-directory from (guix build
>>   utils) instead of referencing "/gnu/store" directly.
>
> Could you push this part to master...
>
>> * guix/packages.scm (patch-and-repack): Likewise.
>
> ... and that part to ‘core-updates’?

Indeed, done.


(For clearness's sake: this means these patches don't fix the bug, if
there is one, since the only thing that functionally changed is the
busybox recipe; the other change is merely aesthetic since the code was
doing the same thing as the function it now calls.)

Taylan