about summary refs log tree commit diff
path: root/src/libnix/normalise.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnix/normalise.cc')
-rw-r--r--src/libnix/normalise.cc94
1 files changed, 0 insertions, 94 deletions
diff --git a/src/libnix/normalise.cc b/src/libnix/normalise.cc
index be71081ffb25..196fcad2e92c 100644
--- a/src/libnix/normalise.cc
+++ b/src/libnix/normalise.cc
@@ -18,100 +18,6 @@ static Path useSuccessor(const Path & path)
 }
 
 
-#if 0
-/* Return a path whose contents have the given hash.  If target is
-   not empty, ensure that such a path is realised in target (if
-   necessary by copying from another location).  If prefix is not
-   empty, only return a path that is an descendent of prefix. */
-
-string expandId(const FSId & id, const string & target = "",
-    const string & prefix = "/", FSIdSet pending = FSIdSet(),
-    bool ignoreSubstitutes = false)
-{
-    xxx
-}
-
-
-string expandId(const FSId & id, const string & target,
-    const string & prefix, FSIdSet pending, bool ignoreSubstitutes)
-{
-    Nest nest(lvlDebug, format("expanding %1%") % (string) id);
-
-    Strings paths;
-
-    if (!target.empty() && !isInPrefix(target, prefix))
-        abort();
-
-    nixDB.queryStrings(noTxn, dbId2Paths, id, paths);
-
-    /* Pick one equal to `target'. */
-    if (!target.empty()) {
-
-        for (Strings::iterator i = paths.begin();
-             i != paths.end(); i++)
-        {
-            string path = *i;
-            if (path == target && pathExists(path))
-                return path;
-        }
-        
-    }
-
-    /* Arbitrarily pick the first one that exists and isn't stale. */
-    for (Strings::iterator it = paths.begin();
-         it != paths.end(); it++)
-    {
-        string path = *it;
-        if (isInPrefix(path, prefix) && pathExists(path)) {
-            if (target.empty())
-                return path;
-            else {
-                /* Acquire a lock on the target path. */
-                Strings lockPaths;
-                lockPaths.push_back(target);
-                PathLocks outputLock(lockPaths);
-
-                /* Copy. */
-                copyPath(path, target);
-
-                /* Register the target path. */
-                Transaction txn(nixDB);
-                registerPath(txn, target, id);
-                txn.commit();
-
-                return target;
-            }
-        }
-    }
-
-    if (!ignoreSubstitutes) {
-        
-        if (pending.find(id) != pending.end())
-            throw Error(format("id %1% already being expanded") % (string) id);
-        pending.insert(id);
-
-        /* Try to realise the substitutes, but only if this id is not
-           already being realised by a substitute. */
-        Strings subs;
-        nixDB.queryStrings(noTxn, dbSubstitutes, id, subs); /* non-existence = ok */
-
-        for (Strings::iterator it = subs.begin(); it != subs.end(); it++) {
-            FSId subId = parseHash(*it);
-
-            debug(format("trying substitute %1%") % (string) subId);
-
-            realiseClosure(normaliseNixExpr(subId, pending), pending);
-
-            return expandId(id, target, prefix, pending);
-        }
-
-    }
-    
-    throw Error(format("cannot expand id `%1%'") % (string) id);
-}
-#endif
-
-    
 Path normaliseNixExpr(const Path & _nePath, PathSet pending)
 {
     Nest nest(lvlTalkative,