summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-02-04 09:36:58 +0100
committerLudovic Courtès <ludo@gnu.org>2015-02-04 22:49:34 +0100
commit3b9855f496de70de0acc99f60a679caecea4bac7 (patch)
treeb4d94ec7c20f56feac19da49f2ffe31c4256608c
parent6a070700df00e8248cb397af44ee76e83a164df6 (diff)
downloadguix-3b9855f496de70de0acc99f60a679caecea4bac7.tar.gz
build: Make 'chroot' a hard requirement.
* config-daemon.ac: Error out when $ac_cv_func_chroot is not "yes".
* nix/nix-daemon/guix-daemon.cc (options): Remove #ifdef HAVE_CHROOT.
  (main): Likewise.
-rw-r--r--config-daemon.ac4
-rw-r--r--nix/nix-daemon/guix-daemon.cc27
2 files changed, 12 insertions, 19 deletions
diff --git a/config-daemon.ac b/config-daemon.ac
index 28cae23b9d..32520acbf2 100644
--- a/config-daemon.ac
+++ b/config-daemon.ac
@@ -75,6 +75,10 @@ if test "x$guix_build_daemon" = "xyes"; then
   AC_CHECK_FUNCS([chroot unshare])
   AC_CHECK_HEADERS([sched.h sys/param.h sys/mount.h tr1/unordered_set])
 
+  if test "x$ac_cv_func_chroot" != "xyes"; then
+    AC_MSG_ERROR(['chroot' function missing, bailing out])
+  fi
+
   dnl lutimes and lchown: used when canonicalizing store items.
   dnl posix_fallocate: used when extracting archives.
   dnl vfork: to speed up spawning of helper programs.
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index 3cca120755..ca39c2f497 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -1,5 +1,5 @@
 /* GNU Guix --- Functional package management for GNU
-   Copyright (C) 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+   Copyright (C) 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 
    This file is part of GNU Guix.
 
@@ -82,19 +82,9 @@ static const struct argp_option options[] =
     { "max-jobs", 'M', "N", 0,
       "Allow at most N build jobs" },
     { "disable-chroot", GUIX_OPT_DISABLE_CHROOT, 0, 0,
-      "Disable chroot builds"
-#ifndef HAVE_CHROOT
-      " (chroots are not supported in this configuration, so "
-      "this option has no effect)"
-#endif
-    },
+      "Disable chroot builds" },
     { "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
-    },
+      "Add DIR to the build chroot" },
     { "build-users-group", GUIX_OPT_BUILD_USERS_GROUP, "GROUP", 0,
       "Perform builds as a user of GROUP" },
     { "no-substitutes", GUIX_OPT_NO_SUBSTITUTES, 0, 0,
@@ -255,12 +245,13 @@ main (int argc, char *argv[])
      See <http://lists.gnu.org/archive/html/bug-guix/2013-07/msg00033.html>.  */
   umask (S_IWGRP | S_IWOTH);
 
-#ifdef HAVE_CHROOT
-  settings.useChroot = true;
-#else
-  settings.useChroot = false;
+#ifndef HAVE_CHROOT
+# error chroot is assumed to be available
 #endif
 
+  /* Always use chroots by default.  */
+  settings.useChroot = true;
+
   /* Turn automatic deduplication on by default.  */
   settings.autoOptimiseStore = true;
 
@@ -335,7 +326,6 @@ main (int argc, char *argv[])
 	fprintf (stderr, "warning: daemon is running as root, so "
 		 "using `--build-users-group' is highly recommended\n");
 
-#ifdef HAVE_CHROOT
       if (settings.useChroot)
 	{
 	  foreach (PathSet::iterator, i, settings.dirsInChroot)
@@ -344,7 +334,6 @@ main (int argc, char *argv[])
 			format ("directory `%1%' added to the chroot") % *i);
 	    }
 	}
-#endif
 
       printMsg (lvlDebug,
 		format ("automatic deduplication set to %1%")