summaryrefslogtreecommitdiff
path: root/nix/libutil
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-10-02 22:53:47 +0200
committerLudovic Courtès <ludo@gnu.org>2018-10-02 23:08:30 +0200
commit7eca7892014d173ff523417138b90aeff5b7dec1 (patch)
tree8f0883077c4f8f7d084f0be92d3bd6a83d56a22b /nix/libutil
parent2bc8b2af8947502d147fb3b67a0a40a5565c3707 (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.cc31
-rw-r--r--nix/libutil/archive.hh5
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
22namespace nix { 22namespace nix {
23 23
24
25bool useCaseHack =
26#if __APPLE__
27 true;
28#else
29 false;
30#endif
31
32static string archiveVersion1 = "nix-archive-1"; 24static string archiveVersion1 = "nix-archive-1";
33 25
34static string caseHackSuffix = "~nix~case~hack~"; 26static 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
72void restorePath(const Path & path, Source & source); 72void restorePath(const Path & path, Source & source);
73 73
74
75// FIXME: global variables are bad m'kay.
76extern bool useCaseHack;
77
78
79} 74}