* Remove "auto" and "guess" as synonyms for 0 in the handling of

build-cores and --cores.  They're superfluous and just complicate
  the parsing.
This commit is contained in:
Eelco Dolstra 2010-08-04 12:23:59 +00:00
parent 315d8fbd75
commit 750be19ae8
2 changed files with 8 additions and 20 deletions

View file

@ -62,12 +62,11 @@
### Option `build-cores' ### Option `build-cores'
# #
# This option defines the number of CPU cores to utilize in parallel # This option defines the number of CPU cores to utilize in parallel
# within a build job, i.e. by passing an appropriate `-jN' flag to # within a build job, i.e. by passing an appropriate `-jN' flag to GNU
# GNU make. The default is 1, meaning that parallel building within # make. The default is 1, meaning that parallel building within jobs
# jobs is disabled. Passing the special values `0', `auto', or # is disabled. Passing the special value `0' causes Nix to try and
# `guess' causes Nix to try and auto-detect the number of available # auto-detect the number of available cores on the local host. This
# cores on the local host. This setting can be overridden using the # setting can be overridden using the `--cores' command line switch.
# `--cores' command line switch.
#build-cores = 1 #build-cores = 1

View file

@ -135,11 +135,6 @@ static void initAndRun(int argc, char * * argv)
/* Get some settings from the configuration file. */ /* Get some settings from the configuration file. */
thisSystem = querySetting("system", SYSTEM); thisSystem = querySetting("system", SYSTEM);
maxBuildJobs = queryIntSetting("build-max-jobs", 1); maxBuildJobs = queryIntSetting("build-max-jobs", 1);
string tmp = querySetting("build-cores", "/UNDEFINED");
std::transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
if (tmp == "auto" || tmp == "guess")
buildCores = 0;
else
buildCores = queryIntSetting("build-cores", 1); buildCores = queryIntSetting("build-cores", 1);
maxSilentTime = queryIntSetting("build-max-silent-time", 0); maxSilentTime = queryIntSetting("build-max-silent-time", 0);
@ -232,14 +227,8 @@ static void initAndRun(int argc, char * * argv)
tryFallback = true; tryFallback = true;
else if (arg == "--max-jobs" || arg == "-j") else if (arg == "--max-jobs" || arg == "-j")
maxBuildJobs = getIntArg<unsigned int>(arg, i, args.end()); maxBuildJobs = getIntArg<unsigned int>(arg, i, args.end());
else if (arg == "--cores") { else if (arg == "--cores")
string tmp = *(++i); buildCores = getIntArg<unsigned int>(arg, i, args.end());
std::transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
if (tmp == "auto" || tmp == "guess")
buildCores = 0u;
else
buildCores = getIntArg<unsigned int>(arg, --i, args.end());
}
else if (arg == "--readonly-mode") else if (arg == "--readonly-mode")
readOnlyMode = true; readOnlyMode = true;
else if (arg == "--max-silent-time") else if (arg == "--max-silent-time")