Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fe38fce2d843
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8215b75d36a6
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Sep 1, 2017

  1. Copy the full SHA
    7a108d9 View commit details
  2. Abort curl downloads if there is no progress for 5 minutes

    Maybe this will fix the curl hangs on macOS. (We could also use
    CURLOPT_TIMEOUT but that seems more of a sledgehammer.)
    edolstra committed Sep 1, 2017
    Copy the full SHA
    8215b75 View commit details
Showing with 22 additions and 17 deletions.
  1. +12 −12 src/libmain/shared.cc
  2. +2 −2 src/libmain/shared.hh
  3. +6 −1 src/libstore/download.cc
  4. +1 −1 src/nix/build.cc
  5. +1 −1 src/nix/installables.cc
24 changes: 12 additions & 12 deletions src/libmain/shared.cc
Original file line number Diff line number Diff line change
@@ -34,40 +34,40 @@ void printGCWarning()
}


void printMissing(ref<Store> store, const PathSet & paths)
void printMissing(ref<Store> store, const PathSet & paths, Verbosity lvl)
{
unsigned long long downloadSize, narSize;
PathSet willBuild, willSubstitute, unknown;
store->queryMissing(paths, willBuild, willSubstitute, unknown, downloadSize, narSize);
printMissing(store, willBuild, willSubstitute, unknown, downloadSize, narSize);
printMissing(store, willBuild, willSubstitute, unknown, downloadSize, narSize, lvl);
}


void printMissing(ref<Store> store, const PathSet & willBuild,
const PathSet & willSubstitute, const PathSet & unknown,
unsigned long long downloadSize, unsigned long long narSize)
unsigned long long downloadSize, unsigned long long narSize, Verbosity lvl)
{
if (!willBuild.empty()) {
printInfo(format("these derivations will be built:"));
printMsg(lvl, "these derivations will be built:");
Paths sorted = store->topoSortPaths(willBuild);
reverse(sorted.begin(), sorted.end());
for (auto & i : sorted)
printInfo(format(" %1%") % i);
printMsg(lvl, fmt(" %s", i));
}

if (!willSubstitute.empty()) {
printInfo(format("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):")
% (downloadSize / (1024.0 * 1024.0))
% (narSize / (1024.0 * 1024.0)));
printMsg(lvl, fmt("these paths will be fetched (%.2f MiB download, %.2f MiB unpacked):",
downloadSize / (1024.0 * 1024.0),
narSize / (1024.0 * 1024.0)));
for (auto & i : willSubstitute)
printInfo(format(" %1%") % i);
printMsg(lvl, fmt(" %s", i));
}

if (!unknown.empty()) {
printInfo(format("don't know how to build these paths%1%:")
% (settings.readOnlyMode ? " (may be caused by read-only store access)" : ""));
printMsg(lvl, fmt("don't know how to build these paths%s:",
(settings.readOnlyMode ? " (may be caused by read-only store access)" : "")));
for (auto & i : unknown)
printInfo(format(" %1%") % i);
printMsg(lvl, fmt(" %s", i));
}
}

4 changes: 2 additions & 2 deletions src/libmain/shared.hh
Original file line number Diff line number Diff line change
@@ -35,11 +35,11 @@ void printGCWarning();

class Store;

void printMissing(ref<Store> store, const PathSet & paths);
void printMissing(ref<Store> store, const PathSet & paths, Verbosity lvl = lvlInfo);

void printMissing(ref<Store> store, const PathSet & willBuild,
const PathSet & willSubstitute, const PathSet & unknown,
unsigned long long downloadSize, unsigned long long narSize);
unsigned long long downloadSize, unsigned long long narSize, Verbosity lvl = lvlInfo);

string getArg(const string & opt,
Strings::iterator & i, const Strings::iterator & end);
7 changes: 6 additions & 1 deletion src/libstore/download.cc
Original file line number Diff line number Diff line change
@@ -183,6 +183,8 @@ struct CurlDownloader : public Downloader
return 0;
}

long lowSpeedTimeout = 300;

void init()
{
if (!req) req = curl_easy_init();
@@ -231,6 +233,9 @@ struct CurlDownloader : public Downloader

curl_easy_setopt(req, CURLOPT_CONNECTTIMEOUT, settings.connectTimeout.get());

curl_easy_setopt(req, CURLOPT_LOW_SPEED_LIMIT, 1L);
curl_easy_setopt(req, CURLOPT_LOW_SPEED_TIME, lowSpeedTimeout);

/* If no file exist in the specified path, curl continues to work
anyway as if netrc support was disabled. */
curl_easy_setopt(req, CURLOPT_NETRC_FILE, settings.netrcFile.get().c_str());
@@ -422,7 +427,7 @@ struct CurlDownloader : public Downloader
auto sleepTimeMs =
nextWakeup != std::chrono::steady_clock::time_point()
? std::max(0, (int) std::chrono::duration_cast<std::chrono::milliseconds>(nextWakeup - std::chrono::steady_clock::now()).count())
: 1000000000;
: 10000;
vomit("download thread waiting for %d ms", sleepTimeMs);
mc = curl_multi_wait(curlm, extraFDs, 1, sleepTimeMs, &numfds);
if (mc != CURLM_OK)
2 changes: 1 addition & 1 deletion src/nix/build.cc
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ struct CmdBuild : MixDryRun, InstallablesCommand
{
auto paths = toStorePaths(store, dryRun ? DryRun : Build);

printInfo("build result: %s", showPaths(paths));
printError("build result: %s", showPaths(paths));
}
};

2 changes: 1 addition & 1 deletion src/nix/installables.cc
Original file line number Diff line number Diff line change
@@ -228,7 +228,7 @@ PathSet InstallablesCommand::toStorePaths(ref<Store> store, ToStorePathsMode mod
}

if (mode == DryRun)
printMissing(store, buildables);
printMissing(store, buildables, lvlError);
else if (mode == Build)
store->buildPaths(buildables);