diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2018-10-02 22:53:47 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2018-10-02 23:08:30 +0200 |
| commit | 7eca7892014d173ff523417138b90aeff5b7dec1 (patch) | |
| tree | 8f0883077c4f8f7d084f0be92d3bd6a83d56a22b /nix/libutil | |
| parent | 2bc8b2af8947502d147fb3b67a0a40a5565c3707 (diff) | |
daemon: Remove "case hack" for nars.
This code has never been of any use in Guix.
* nix/libutil/archive.cc (useCaseHack): Remove.
(parse): Keep only the alternate branch in "if (useCaseHack)".
Diffstat (limited to 'nix/libutil')
| -rw-r--r-- | nix/libutil/archive.cc | 31 | ||||
| -rw-r--r-- | nix/libutil/archive.hh | 5 |
2 files changed, 1 insertions, 35 deletions
diff --git a/nix/libutil/archive.cc b/nix/libutil/archive.cc index 4e3d99356ab..25990304545 100644 --- a/nix/libutil/archive.cc +++ b/nix/libutil/archive.cc | |||
| @@ -21,14 +21,6 @@ | |||
| 21 | 21 | ||
| 22 | namespace nix { | 22 | namespace nix { |
| 23 | 23 | ||
| 24 | |||
| 25 | bool useCaseHack = | ||
| 26 | #if __APPLE__ | ||
| 27 | true; | ||
| 28 | #else | ||
| 29 | false; | ||
| 30 | #endif | ||
| 31 | |||
| 32 | static string archiveVersion1 = "nix-archive-1"; | 24 | static string archiveVersion1 = "nix-archive-1"; |
| 33 | 25 | ||
| 34 | static string caseHackSuffix = "~nix~case~hack~"; | 26 | static string caseHackSuffix = "~nix~case~hack~"; |
| @@ -85,19 +77,7 @@ static void dump(const Path & path, Sink & sink, PathFilter & filter) | |||
| 85 | the case hack applied by restorePath(). */ | 77 | the case hack applied by restorePath(). */ |
| 86 | std::map<string, string> unhacked; | 78 | std::map<string, string> unhacked; |
| 87 | for (auto & i : readDirectory(path)) | 79 | for (auto & i : readDirectory(path)) |
| 88 | if (useCaseHack) { | 80 | unhacked[i.name] = i.name; |
| 89 | string name(i.name); | ||
| 90 | size_t pos = i.name.find(caseHackSuffix); | ||
| 91 | if (pos != string::npos) { | ||
| 92 | printMsg(lvlDebug, format("removing case hack suffix from `%1%'") % (path + "/" + i.name)); | ||
| 93 | name.erase(pos); | ||
| 94 | } | ||
| 95 | if (unhacked.find(name) != unhacked.end()) | ||
| 96 | throw Error(format("file name collision in between `%1%' and `%2%'") | ||
| 97 | % (path + "/" + unhacked[name]) % (path + "/" + i.name)); | ||
| 98 | unhacked[name] = i.name; | ||
| 99 | } else | ||
| 100 | unhacked[i.name] = i.name; | ||
| 101 | 81 | ||
| 102 | for (auto & i : unhacked) | 82 | for (auto & i : unhacked) |
| 103 | if (filter(path + "/" + i.first)) { | 83 | if (filter(path + "/" + i.first)) { |
| @@ -251,15 +231,6 @@ static void parse(ParseSink & sink, Source & source, const Path & path) | |||
| 251 | if (name <= prevName) | 231 | if (name <= prevName) |
| 252 | throw Error("NAR directory is not sorted"); | 232 | throw Error("NAR directory is not sorted"); |
| 253 | prevName = name; | 233 | prevName = name; |
| 254 | if (useCaseHack) { | ||
| 255 | auto i = names.find(name); | ||
| 256 | if (i != names.end()) { | ||
| 257 | printMsg(lvlDebug, format("case collision between `%1%' and `%2%'") % i->first % name); | ||
| 258 | name += caseHackSuffix; | ||
| 259 | name += std::to_string(++i->second); | ||
| 260 | } else | ||
| 261 | names[name] = 0; | ||
| 262 | } | ||
| 263 | } else if (s == "node") { | 234 | } else if (s == "node") { |
| 264 | if (s.empty()) throw badArchive("entry name missing"); | 235 | if (s.empty()) throw badArchive("entry name missing"); |
| 265 | parse(sink, source, path + "/" + name); | 236 | parse(sink, source, path + "/" + name); |
diff --git a/nix/libutil/archive.hh b/nix/libutil/archive.hh index c216e9768fd..9b83a5f288f 100644 --- a/nix/libutil/archive.hh +++ b/nix/libutil/archive.hh | |||
| @@ -71,9 +71,4 @@ void parseDump(ParseSink & sink, Source & source); | |||
| 71 | 71 | ||
| 72 | void restorePath(const Path & path, Source & source); | 72 | void restorePath(const Path & path, Source & source); |
| 73 | 73 | ||
| 74 | |||
| 75 | // FIXME: global variables are bad m'kay. | ||
| 76 | extern bool useCaseHack; | ||
| 77 | |||
| 78 | |||
| 79 | } | 74 | } |
