aboutsummaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-01-06 17:33:02 +0100
committerLudovic Courtès <ludo@gnu.org>2013-01-06 17:33:02 +0100
commit4050e5d6cfe8f7af29f10b2f1b3c7febdc10946a (patch)
tree574828c84e7bfb0b6850db4f30fc38bd8143584e /nix
parent79580eb698d07e4b21334ddfbcbcf620d27b5e41 (diff)
parent233e76769ae3a438bff7117c68f2c88739a28db0 (diff)
downloadpatches-4050e5d6cfe8f7af29f10b2f1b3c7febdc10946a.tar
patches-4050e5d6cfe8f7af29f10b2f1b3c7febdc10946a.tar.gz
Merge branch 'master' into core-updates
Conflicts: build-aux/download.scm distro/packages/autotools.scm distro/packages/base.scm distro/packages/bootstrap.scm distro/packages/lsh.scm distro/packages/make-bootstrap.scm distro/packages/ncurses.scm distro/packages/perl.scm tests/derivations.scm tests/union.scm
Diffstat (limited to 'nix')
-rw-r--r--nix/libutil/gcrypt-hash.cc10
-rw-r--r--nix/libutil/gcrypt-hash.hh10
-rw-r--r--nix/libutil/md5.h10
-rw-r--r--nix/libutil/sha1.h10
-rw-r--r--nix/libutil/sha256.h10
-rw-r--r--nix/nix-daemon/guix-daemon.cc73
-rw-r--r--nix/nix-daemon/shared.hh10
-rw-r--r--nix/scripts/list-runtime-roots.in12
8 files changed, 97 insertions, 48 deletions
diff --git a/nix/libutil/gcrypt-hash.cc b/nix/libutil/gcrypt-hash.cc
index de7e5afc1a..b364a5747a 100644
--- a/nix/libutil/gcrypt-hash.cc
+++ b/nix/libutil/gcrypt-hash.cc
@@ -1,20 +1,20 @@
-/* Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
+/* GNU Guix --- Functional package management for GNU
Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
- This file is part of Guix.
+ This file is part of GNU Guix.
- Guix is free software; you can redistribute it and/or modify it
+ GNU Guix is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.
- Guix is distributed in the hope that it will be useful, but
+ GNU Guix is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with Guix. If not, see <http://www.gnu.org/licenses/>. */
+ along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/nix/libutil/gcrypt-hash.hh b/nix/libutil/gcrypt-hash.hh
index 1e26398540..d2d40d5fb2 100644
--- a/nix/libutil/gcrypt-hash.hh
+++ b/nix/libutil/gcrypt-hash.hh
@@ -1,20 +1,20 @@
-/* Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
+/* GNU Guix --- Functional package management for GNU
Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
- This file is part of Guix.
+ This file is part of GNU Guix.
- Guix is free software; you can redistribute it and/or modify it
+ GNU Guix is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.
- Guix is distributed in the hope that it will be useful, but
+ GNU Guix is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with Guix. If not, see <http://www.gnu.org/licenses/>. */
+ along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
/* An OpenSSL-like interface to GNU libgcrypt cryptographic hash
functions. */
diff --git a/nix/libutil/md5.h b/nix/libutil/md5.h
index 7fa29087d7..4583a458b3 100644
--- a/nix/libutil/md5.h
+++ b/nix/libutil/md5.h
@@ -1,20 +1,20 @@
-/* Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
+/* GNU Guix --- Functional package management for GNU
Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
- This file is part of Guix.
+ This file is part of GNU Guix.
- Guix is free software; you can redistribute it and/or modify it
+ GNU Guix is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.
- Guix is distributed in the hope that it will be useful, but
+ GNU Guix is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with Guix. If not, see <http://www.gnu.org/licenses/>. */
+ along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
#include <gcrypt-hash.hh>
diff --git a/nix/libutil/sha1.h b/nix/libutil/sha1.h
index 0eca8e310d..d2d071e058 100644
--- a/nix/libutil/sha1.h
+++ b/nix/libutil/sha1.h
@@ -1,20 +1,20 @@
-/* Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
+/* GNU Guix --- Functional package management for GNU
Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
- This file is part of Guix.
+ This file is part of GNU Guix.
- Guix is free software; you can redistribute it and/or modify it
+ GNU Guix is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.
- Guix is distributed in the hope that it will be useful, but
+ GNU Guix is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with Guix. If not, see <http://www.gnu.org/licenses/>. */
+ along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
#include <gcrypt-hash.hh>
diff --git a/nix/libutil/sha256.h b/nix/libutil/sha256.h
index a91f18f689..ca95d7fea8 100644
--- a/nix/libutil/sha256.h
+++ b/nix/libutil/sha256.h
@@ -1,20 +1,20 @@
-/* Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
+/* GNU Guix --- Functional package management for GNU
Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
- This file is part of Guix.
+ This file is part of GNU Guix.
- Guix is free software; you can redistribute it and/or modify it
+ GNU Guix is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.
- Guix is distributed in the hope that it will be useful, but
+ GNU Guix is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with Guix. If not, see <http://www.gnu.org/licenses/>. */
+ along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
#include <gcrypt-hash.hh>
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index 79c719399e..7e266111a0 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -1,20 +1,20 @@
-/* Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
+/* GNU Guix --- Functional package management for GNU
Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
- This file is part of Guix.
+ This file is part of GNU Guix.
- Guix is free software; you can redistribute it and/or modify it
+ GNU Guix is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.
- Guix is distributed in the hope that it will be useful, but
+ GNU Guix is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with Guix. If not, see <http://www.gnu.org/licenses/>. */
+ along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
@@ -23,8 +23,13 @@
#include <globals.hh>
#include <util.hh>
+#include <gcrypt.h>
+
#include <stdlib.h>
#include <argp.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <exception>
/* Variables used by `nix-daemon.cc'. */
volatile ::sig_atomic_t blockInt;
@@ -58,6 +63,7 @@ builds derivations on behalf of its clients.";
#define GUIX_OPT_DISABLE_STORE_OPTIMIZATION 7
#define GUIX_OPT_IMPERSONATE_LINUX_26 8
#define GUIX_OPT_DEBUG 9
+#define GUIX_OPT_CHROOT_DIR 10
static const struct argp_option options[] =
{
@@ -74,6 +80,13 @@ static const struct argp_option options[] =
"this option has no effect)"
#endif
},
+ { "chroot-directory", GUIX_OPT_CHROOT_DIR, "DIR", 0,
+ "Add DIR to the build chroot"
+#ifndef HAVE_CHROOT
+ " (chroots are not supported in this configuration, so "
+ "this option has no effect)"
+#endif
+ },
{ "build-users-group", GUIX_OPT_BUILD_USERS_GROUP, "GROUP", 0,
"Perform builds as a user of GROUP" },
{ "cache-failures", GUIX_OPT_CACHE_FAILURES, 0, 0,
@@ -104,6 +117,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
case GUIX_OPT_DISABLE_CHROOT:
settings.useChroot = false;
break;
+ case GUIX_OPT_CHROOT_DIR:
+ settings.dirsInChroot.insert (arg);
+ break;
case GUIX_OPT_DISABLE_LOG_COMPRESSION:
settings.compressLog = false;
break;
@@ -151,20 +167,53 @@ main (int argc, char *argv[])
{
Strings nothing;
+ /* Initialize libgcrypt. */
+ if (!gcry_check_version (GCRYPT_VERSION))
+ {
+ fprintf (stderr, "error: libgcrypt version mismatch\n");
+ exit (EXIT_FAILURE);
+ }
+
#ifdef HAVE_CHROOT
settings.useChroot = true;
#else
settings.useChroot = false;
#endif
- settings.processEnvironment ();
+ argvSaved = argv;
+
+ try
+ {
+ settings.processEnvironment ();
- /* FIXME: Disable substitutes until we have something that works. */
- settings.useSubstitutes = false;
- settings.substituters.clear ();
+ /* FIXME: Disable substitutes until we have something that works. */
+ settings.useSubstitutes = false;
+ settings.substituters.clear ();
- argp_parse (&argp, argc, argv, 0, 0, 0);
+ argp_parse (&argp, argc, argv, 0, 0, 0);
- argvSaved = argv;
- run (nothing);
+ if (geteuid () == 0 && settings.buildUsersGroup.empty ())
+ fprintf (stderr, "warning: running as root is highly recommended, "
+ "unless `--build-users-group' is used\n");
+
+#ifdef HAVE_CHROOT
+ if (settings.useChroot)
+ {
+ foreach (PathSet::iterator, i, settings.dirsInChroot)
+ {
+ printMsg (lvlDebug,
+ format ("directory `%1%' added to the chroot") % *i);
+ }
+ }
+#endif
+
+ run (nothing);
+ }
+ catch (std::exception &e)
+ {
+ fprintf (stderr, "error: %s\n", e.what ());
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS; /* never reached */
}
diff --git a/nix/nix-daemon/shared.hh b/nix/nix-daemon/shared.hh
index a03c09c036..b45e9f0cfd 100644
--- a/nix/nix-daemon/shared.hh
+++ b/nix/nix-daemon/shared.hh
@@ -1,20 +1,20 @@
-/* Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
+/* GNU Guix --- Functional package management for GNU
Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
- This file is part of Guix.
+ This file is part of GNU Guix.
- Guix is free software; you can redistribute it and/or modify it
+ GNU Guix is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.
- Guix is distributed in the hope that it will be useful, but
+ GNU Guix is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with Guix. If not, see <http://www.gnu.org/licenses/>. */
+ along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
/* Replacement for Nix's libmain/shared.hh. */
diff --git a/nix/scripts/list-runtime-roots.in b/nix/scripts/list-runtime-roots.in
index 5c21ae543d..45fa0733d5 100644
--- a/nix/scripts/list-runtime-roots.in
+++ b/nix/scripts/list-runtime-roots.in
@@ -1,22 +1,22 @@
#!@GUILE@ -ds
!#
-;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
-;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2012 Ludovic Courtès <ludo@gnu.org>
;;;
-;;; This file is part of Guix.
+;;; This file is part of GNU Guix.
;;;
-;;; Guix is free software; you can redistribute it and/or modify it
+;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
-;;; Guix is distributed in the hope that it will be useful, but
+;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
-;;; along with Guix. If not, see <http://www.gnu.org/licenses/>.
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
;;;
;;; List files being used at run time; these files are garbage collector