daemon: Add more options.

* nix/nix-daemon/guix-daemon.cc (GUIX_OPT_BUILD_USERS_GROUP,
  GUIX_OPT_CACHE_FAILURES, GUIX_OPT_LOSE_LOGS,
  GUIX_OPT_DISABLE_STORE_OPTIMIZATION, GUIX_OPT_IMPERSONATE_LINUX_26):
  New macros.
  (options)["build-users-group", "cache-failures", "lose-logs",
  "disable-store-optimization", "impersonate-linux-2.6"]: New options.
  (parse_opt): Handle them.
This commit is contained in:
Ludovic Courtès 2012-12-06 22:21:45 +01:00
parent 29833b26eb
commit 5c403e3518
1 changed files with 35 additions and 1 deletions

View File

@ -50,7 +50,12 @@ builds derivations on behalf of its clients.";
#define GUIX_OPT_SYSTEM 1 #define GUIX_OPT_SYSTEM 1
#define GUIX_OPT_DISABLE_CHROOT 2 #define GUIX_OPT_DISABLE_CHROOT 2
#define GUIX_OPT_DISABLE_LOG_COMPRESSION 3 #define GUIX_OPT_BUILD_USERS_GROUP 3
#define GUIX_OPT_CACHE_FAILURES 4
#define GUIX_OPT_LOSE_LOGS 5
#define GUIX_OPT_DISABLE_LOG_COMPRESSION 6
#define GUIX_OPT_DISABLE_STORE_OPTIMIZATION 7
#define GUIX_OPT_IMPERSONATE_LINUX_26 8
static const struct argp_option options[] = static const struct argp_option options[] =
{ {
@ -67,8 +72,22 @@ static const struct argp_option options[] =
"this option has no effect)" "this option has no effect)"
#endif #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,
"Cache build failures" },
{ "lose-logs", GUIX_OPT_LOSE_LOGS, 0, 0,
"Do not keep build logs" },
{ "disable-log-compression", GUIX_OPT_DISABLE_LOG_COMPRESSION, 0, 0, { "disable-log-compression", GUIX_OPT_DISABLE_LOG_COMPRESSION, 0, 0,
"Disable compression of the build logs" }, "Disable compression of the build logs" },
{ "disable-store-optimization", GUIX_OPT_DISABLE_STORE_OPTIMIZATION, 0, 0,
"Disable automatic file \"deduplication\" in the store" },
{ "impersonate-linux-2.6", GUIX_OPT_IMPERSONATE_LINUX_26, 0, 0,
"Impersonate Linux 2.6"
#ifndef HAVE_SYS_PERSONALITY_H
" (this option has no effect in this configuration)"
#endif
},
{ 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0 }
}; };
@ -84,6 +103,21 @@ parse_opt (int key, char *arg, struct argp_state *state)
case GUIX_OPT_DISABLE_LOG_COMPRESSION: case GUIX_OPT_DISABLE_LOG_COMPRESSION:
settings.compressLog = false; settings.compressLog = false;
break; break;
case GUIX_OPT_BUILD_USERS_GROUP:
settings.buildUsersGroup = arg;
break;
case GUIX_OPT_DISABLE_STORE_OPTIMIZATION:
settings.autoOptimiseStore = false;
break;
case GUIX_OPT_CACHE_FAILURES:
settings.cacheFailure = true;
break;
case GUIX_OPT_IMPERSONATE_LINUX_26:
settings.impersonateLinux26 = true;
break;
case GUIX_OPT_LOSE_LOGS:
settings.keepLog = false;
break;
case 'C': case 'C':
settings.buildCores = atoi (arg); settings.buildCores = atoi (arg);
break; break;