[PATCH]

2014-04-14 Thread Ludovic Courtès
The patch below allows files such as /nix/store/foo to be protected from
GC if a root refers to them.  This makes it easy for a build hook to use
such files for its temporary working files.

WDYT?

Thanks,
Ludo’.

diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 96e891f..299bf5f 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -287,10 +287,7 @@ static void foundRoot(StoreAPI & store,
 const Path & path, const Path & target, Roots & roots)
 {
 Path storePath = toStorePath(target);
-if (store.isValidPath(storePath))
 roots[path] = storePath;
-else
-printMsg(lvlInfo, format("skipping invalid root from `%1%' to `%2%'") % path % storePath);
 }


Re: [Nix-dev] [PATCH]

2014-04-14 Thread Shea Levy
Hi Ludo’,

On Mon, Apr 14, 2014 at 03:38:01PM +0200, Ludovic Courtès wrote:
> The patch below allows files such as /nix/store/foo to be protected from
> GC if a root refers to them.  This makes it easy for a build hook to use
> such files for its temporary working files.
> 
> WDYT?
> 

It seems a bit odd to me to be using the store as a temporary file
location. What's wrong with $TMPDIR?

> 
> Thanks,
> Ludo’.
> 

> diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
> index 96e891f..299bf5f 100644
> --- a/src/libstore/gc.cc
> +++ b/src/libstore/gc.cc
> @@ -287,10 +287,7 @@ static void foundRoot(StoreAPI & store,
>  const Path & path, const Path & target, Roots & roots)
>  {
>  Path storePath = toStorePath(target);
> -if (store.isValidPath(storePath))

Hm, don't we at least want to check that it's in the store at all?

> 
>  roots[path] = storePath;
> -else
> -printMsg(lvlInfo, format("skipping invalid root from `%1%' to 
> `%2%'") % path % storePath);
>  }

~Shea

> ___
> nix-dev mailing list
> nix-...@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev




Re: [Nix-dev] [PATCH] Allow roots to refer to arbitrary files in the store

2014-04-14 Thread Ludovic Courtès
(Oops, forgot the Subject line; sorry!)

Shea Levy  skribis:

> On Mon, Apr 14, 2014 at 03:38:01PM +0200, Ludovic Courtès wrote:
>> The patch below allows files such as /nix/store/foo to be protected from
>> GC if a root refers to them.  This makes it easy for a build hook to use
>> such files for its temporary working files.
>> 
>> WDYT?
>> 
>
> It seems a bit odd to me to be using the store as a temporary file
> location. What's wrong with $TMPDIR?

Well, this is useful for build hooks, because it guarantees that any
garbage they leave there will eventually be reclaimed.

>> diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
>> index 96e891f..299bf5f 100644
>> --- a/src/libstore/gc.cc
>> +++ b/src/libstore/gc.cc
>> @@ -287,10 +287,7 @@ static void foundRoot(StoreAPI & store,
>>  const Path & path, const Path & target, Roots & roots)
>>  {
>>  Path storePath = toStorePath(target);
>> -if (store.isValidPath(storePath))
>
> Hm, don't we at least want to check that it's in the store at all?

‘toStorePath’ does that:

if (!isInStore(path))
throw Error(format("path `%1%' is not in the Nix store") % path);

Thanks,
Ludo’.



Re: [Nix-dev] [PATCH] Allow roots to refer to arbitrary files in the store

2014-04-14 Thread Ludovic Courtès
l...@gnu.org (Ludovic Courtès) skribis:

> Shea Levy  skribis:
>
>> On Mon, Apr 14, 2014 at 03:38:01PM +0200, Ludovic Courtès wrote:
>>> The patch below allows files such as /nix/store/foo to be protected from
>>> GC if a root refers to them.  This makes it easy for a build hook to use
>>> such files for its temporary working files.
>>> 
>>> WDYT?
>>> 
>>
>> It seems a bit odd to me to be using the store as a temporary file
>> location. What's wrong with $TMPDIR?
>
> Well, this is useful for build hooks, because it guarantees that any
> garbage they leave there will eventually be reclaimed.

It also guarantees that this thing lives on the same file system as the
store, which means that rename(2) can be used to move it to its final
location in the store.

Ludo’.



Re: Installing a C tool chain

2014-04-14 Thread Andreas Enge
On Sat, Apr 05, 2014 at 10:44:55PM +0200, Ludovic Courtès wrote:
> Comments welcome!

This could be a useful package! Do I need to set any more environment
variables in my .bashrc? So far, I have
export PATH=$HOME/.guix-profile/bin:$PATH
export LIBRARY_PATH=$HOME/.guix-profile/lib
export CPATH=$HOME/.guix-profile/include
export MANPATH=$HOME/.guix-profile/share/man:/usr/share/man
export 
PKG_CONFIG_PATH=$HOME/.guix-profile/lib/pkgconfig:/usr/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig
export PYTHONPATH=$HOME/.guix-profile/lib/python2.7/site-packages
export PERL5LIB=$HOME/.guix-profile/lib/perl5/site_perl
export XDG_DATA_DIRS=$HOME/.guix-profile/share


When I do a "./configure" of mpc, none of the standard headers are recognised;
I obtain something like:

configure:12920: checking for ANSI C header files
configure:13024: result: yes
configure:13035: checking locale.h usability
configure:13035: gcc -std=gnu99 -c -g -Werror -g -std=c99 -pedantic 
-Wno-long-long -Wall -Wextra -Wdeclaration-after-statement -Wundef -Wshadow 
-Wmissing-prototypes -Wno-unused-value -Wlogical-op 
-I/usr/local/gmp-6.0.0a/include -I/usr/local/mpfr-3.1.2/include  conftest.c >&5
In file included from /home/enge/.guix-profile/include/stdio.h:27:0,
 from conftest.c:24:
/home/enge/.guix-profile/include/features.h:232:36: error: "_XOPEN_SOURCE" is 
not defined [-Werror=undef]
 #if ((!defined __STRICT_ANSI__ || (_XOPEN_SOURCE - 0) >= 500) && \
^
/home/enge/.guix-profile/include/features.h:247:30: error: "_POSIX_C_SOURCE" is 
not defined [-Werror=undef]
 #if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE
  ^
/home/enge/.guix-profile/include/features.h:255:6: error: "_POSIX_C_SOURCE" is 
not defined [-Werror=undef]
 #if (_POSIX_C_SOURCE - 0) >= 199309L
  ^
/home/enge/.guix-profile/include/features.h:259:6: error: "_POSIX_C_SOURCE" is 
not defined [-Werror=undef]
 #if (_POSIX_C_SOURCE - 0) >= 199506L
  ^
/home/enge/.guix-profile/include/features.h:263:6: error: "_POSIX_C_SOURCE" is 
not defined [-Werror=undef]
 #if (_POSIX_C_SOURCE - 0) >= 200112L
  ^
/home/enge/.guix-profile/include/features.h:271:6: error: "_POSIX_C_SOURCE" is 
not defined [-Werror=undef]
 #if (_POSIX_C_SOURCE - 0) >= 200809L
  ^
cc1: all warnings being treated as errors
configure:13035: $? = 1
configure: failed program was:
...
configure:13035: result: no
configure:13035: checking locale.h presence
configure:13035: gcc -std=gnu99 -E -I/usr/local/gmp-6.0.0a/include 
-I/usr/local/mpfr-3.1.2/include  conftest.c
configure:13035: $? = 0
configure:13035: result: yes
configure:13035: WARNING: locale.h: present but cannot be compiled
configure:13035: WARNING: locale.h: check for missing prerequisite headers?
configure:13035: WARNING: locale.h: see the Autoconf documentation
configure:13035: WARNING: locale.h: section "Present But Cannot Be Compiled"
configure:13035: WARNING: locale.h: proceeding with the compiler's result


and so on for other header files.


When compiling pari/gp, I get messages such as
/home/enge/.guix-profile/bin/gcc  -c -I. -I../src/headers -I../src/language 
-I/usr/include -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer  -Wextra 
-Wno-missing-field-initializers  -o gp_rl.o ../src/gp/gp_rl.c
In file included from /usr/include/features.h:323:0,
 from /usr/include/stdlib.h:25,
 from ../src/headers/pari.h:18,
 from ../src/gp/gp_rl.c:19:
/usr/include/bits/predefs.h:27:0: warning: "__STDC_IEC_559__" redefined 
[enabled by default]
 #define __STDC_IEC_559__  1
 ^
In file included from :0:0:
/home/enge/.guix-profile/include/stdc-predef.h:41:0: note: this is the location 
of the previous definition
 # define __STDC_IEC_559__  1
 ^

Andreas




Re: Installing a C tool chain

2014-04-14 Thread Ludovic Courtès
Andreas Enge  skribis:

> On Sat, Apr 05, 2014 at 10:44:55PM +0200, Ludovic Courtès wrote:
>> Comments welcome!

[...]

> When I do a "./configure" of mpc, none of the standard headers are recognised;
> I obtain something like:
>
> configure:12920: checking for ANSI C header files
> configure:13024: result: yes
> configure:13035: checking locale.h usability
> configure:13035: gcc -std=gnu99 -c -g -Werror -g -std=c99 -pedantic 
> -Wno-long-long -Wall -Wextra -Wdeclaration-after-statement -Wundef -Wshadow 
> -Wmissing-prototypes -Wno-unused-value -Wlogical-op 
> -I/usr/local/gmp-6.0.0a/include -I/usr/local/mpfr-3.1.2/include  conftest.c 
> >&5
> In file included from /home/enge/.guix-profile/include/stdio.h:27:0,
>  from conftest.c:24:
> /home/enge/.guix-profile/include/features.h:232:36: error: "_XOPEN_SOURCE" is 
> not defined [-Werror=undef]
>  #if ((!defined __STRICT_ANSI__ || (_XOPEN_SOURCE - 0) >= 500) && \

This is because you’re compiling with -Wundef -Werror, something that
libc 2.19 headers apparently don’t support.

Can you try without -Werror?

Ludo’.



Re: Installing a C tool chain

2014-04-14 Thread Andreas Enge
On Mon, Apr 14, 2014 at 09:16:31PM +0200, Ludovic Courtès wrote:
> This is because you’re compiling with -Wundef -Werror, something that
> libc 2.19 headers apparently don’t support.

I tried without both, and then it works. Do you have a source and suggestion
on what to do in such a case? Is it deprecated to use -Werror with the
autotoools?

Pari/GP now also works without modifying anything; maybe this was just a
problem of needing to start a new shell, as sometimes new binaries in the path
are not taken into account due to caching.

Andreas




Re: Installing a C tool chain

2014-04-14 Thread Ludovic Courtès
Andreas Enge  skribis:

> On Mon, Apr 14, 2014 at 09:16:31PM +0200, Ludovic Courtès wrote:
>> This is because you’re compiling with -Wundef -Werror, something that
>> libc 2.19 headers apparently don’t support.
>
> I tried without both, and then it works. Do you have a source and suggestion
> on what to do in such a case?

All I know is that feature test macros have been cleaned up in 2.19, so
perhaps it led to a change in behavior.

> Is it deprecated to use -Werror with the autotoools?

In general, using -Werror is very risky, because a slight change in a
third-party header, or in compiler warnings, can cause the project to
fail to build.  In Guile building with -Werror is opt-in for this
reason.

Cheers,
Ludo’.



[PATCH] gnu: Add glibc-hurd-headers

2014-04-14 Thread Manolis Ragkousis
This patch adds glibc-hurd-headers so I can use them to bootstrap
build libihash which needs glibc.

Take notice that it needs the patch "glibc-make-4.0.patch" for the
configure check to pass. I should bring up this issue to the hurd
guys.
From 8b828821c6b79a461ef067e9ae6a768c0df6378b Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis 
Date: Tue, 15 Apr 2014 00:45:19 +
Subject: [PATCH] gnu: Add glibc-hurd-headers.

* gnu/packages/base.scm (glibc/hurd-headers): New variable.
---
 gnu/packages/base.scm | 53 +++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index e6a2242..9546d92 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -32,10 +32,13 @@
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages hurd)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages perl)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
   #:use-module (guix utils)
@@ -508,6 +511,56 @@ with the Linux kernel.")
(license lgpl2.0+)
(home-page "http://www.gnu.org/software/libc/";)))
 
+(define-public glibc/hurd-headers
+  (package (inherit glibc)
+   (name "glibc-hurd-headers")
+   (source (origin
+ (method git-fetch)
+ (uri (git-reference
+   (url "git://git.sv.gnu.org/hurd/glibc")
+   (commit "14258ada6a678171a59b1e095863e83b47f9d21c")))
+ (sha256
+  (base32
+   "016x7fz5500rlgwxi9dpwm6971c3xl3jkgllgjfk5s5czwvx5yh2"))
+ (patches (list (search-patch "glibc-make-4.0.patch")
+
+   (propagated-inputs `(("gnumach-headers" ,gnumach-headers)
+("hurd-headers" ,hurd-headers)))
+   (native-inputs `(("mig" ,mig)
+("perl" ,perl)))
+   
+   (arguments
+(substitute-keyword-arguments
+`(#:strip-binaries? #f
+  #:out-of-source? #t
+  #:tests? #f 
+  #:configure-flags (list 
+ "--host=i686-pc-gnu"
+ "--enable-addons"
+ ;;"--disable-sanity-checks"
+ (string-append "libc_cv_localedir="
+(assoc-ref %outputs "locales")
+"/share/locale")
+ (string-append "--with-headers="
+(assoc-ref %build-inputs "gnumach-headers")
+"/include:"
+(assoc-ref %build-inputs "hurd-headers")
+"/include")
+ 
+ ;; Use our Bash instead of /bin/sh.
+ (string-append "BASH_SHELL="
+(assoc-ref %build-inputs "bash")
+"/bin/bash"))
+  ,@(package-arguments glibc))
+  ((#:phases phases)
+   `(alist-replace
+ 'install
+ (lambda _
+   (zero? (system* "make" "install-headers")))
+ (alist-delete
+ 'build
+ ,phases)))
+
 (define-public tzdata
   (package
 (name "tzdata")
-- 
1.9.0



Re: [PATCH] gnu: Add glibc-hurd-headers

2014-04-14 Thread Ludovic Courtès
Manolis Ragkousis  skribis:

> Take notice that it needs the patch "glibc-make-4.0.patch" for the
> configure check to pass. I should bring up this issue to the hurd
> guys.

That’s a sign that the Hurd’s libc should be rebased on top of libc 2.19.

> +(define-public glibc/hurd-headers
> +  (package (inherit glibc)
> +   (name "glibc-hurd-headers")

The indentation is wrong (see this file for examples.)

> +   (arguments
> +(substitute-keyword-arguments
> +`(#:strip-binaries? #f
> +  #:out-of-source? #t
> +  #:tests? #f 
> +  #:configure-flags (list 
> + "--host=i686-pc-gnu"
> + "--enable-addons"
> + ;;"--disable-sanity-checks"
> + (string-append "libc_cv_localedir="
> +(assoc-ref %outputs 
> "locales")
> +"/share/locale")
> + (string-append "--with-headers="
> +(assoc-ref %build-inputs 
> "gnumach-headers")
> +"/include:"
> +(assoc-ref %build-inputs 
> "hurd-headers")
> +"/include")
> + 
> + ;; Use our Bash instead of /bin/sh.
> + (string-append "BASH_SHELL="
> +(assoc-ref %build-inputs 
> "bash")
> +"/bin/bash"))
> +  ,@(package-arguments glibc))
> +  ((#:phases phases)
> +   `(alist-replace
> + 'install
> + (lambda _
> +   (zero? (system* "make" "install-headers")))
> + (alist-delete
> + 'build
> + ,phases)))

This looks good to me, but unnecessarily complex: get rid of
‘substitute-keyword-arguments’:

  (arguments
'(#:out-of-source? #t
  #:tests? #f
  #:configure-flags ...
  #:phases (alist-replace ... %standard-phases)))

HTH,
Ludo’.



Re: [PATCH] gnu: Add glibc-hurd-headers

2014-04-14 Thread Manolis Ragkousis
> This looks good to me, but unnecessarily complex: get rid of
> ‘substitute-keyword-arguments’:

The problem is that we need the phases from the glibc package except the
two I changed.
I would end up just copying them. Is there a better way to use the
inherited phases and just change the ones we need to?


Manolis