From 00602dd20cb38fd35bcc0c5a6b5da730ac4700ef Mon Sep 17 00:00:00 2001 From: Wouter den Breejen Date: Mon, 8 Oct 2007 10:41:41 +0000 Subject: [PATCH] Merged R9063 --- externals/Makefile.am | 6 +++--- src/libexpr/parser.y | 16 ++-------------- src/libstore/local-store.hh | 4 ++-- src/libstore/remote-store.cc | 21 +++++++++++---------- src/libstore/remote-store.hh | 4 ++-- src/libstore/store-api.hh | 8 ++++---- src/nix-env/nix-env.cc | 7 +++++-- src/nix-worker/nix-worker.cc | 2 +- 8 files changed, 30 insertions(+), 38 deletions(-) diff --git a/externals/Makefile.am b/externals/Makefile.am index 1857efb15..06e8eedee 100644 --- a/externals/Makefile.am +++ b/externals/Makefile.am @@ -67,12 +67,12 @@ endif # bzip2 -BZIP2 = bzip2-1.0.3 +BZIP2 = bzip2-1.0.4 $(BZIP2).tar.gz: @echo "Nix requires bzip2 to build." - @echo "Please download version 1.0.3 from" - @echo " http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz" + @echo "Please download version 1.0.4 from" + @echo " http://www.bzip.org/1.0.4/bzip2-1.0.4.tar.gz" @echo "and place it in the externals/ directory." false diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index 1c06240fd..82b24cd07 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -383,20 +383,8 @@ Expr parseExprFromFile(EvalState & state, Path path) if (S_ISDIR(st.st_mode)) path = canonPath(path + "/default.nix"); - /* Read the input file. We can't use SGparseFile() because it's - broken, so we read the input ourselves and call - SGparseString(). */ - AutoCloseFD fd = open(path.c_str(), O_RDONLY); - if (fd == -1) throw SysError(format("opening `%1%'") % path); - - if (fstat(fd, &st) == -1) - throw SysError(format("statting `%1%'") % path); - - char text[st.st_size + 1]; - readFull(fd, (unsigned char *) text, st.st_size); - text[st.st_size] = 0; - - return parse(state, text, path, dirOf(path)); + /* Read and parse the input file. */ + return parse(state, readFile(path).c_str(), path, dirOf(path)); } diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 65b6e1754..9fdf307fb 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -59,6 +59,8 @@ public: void queryStateReferrers(const Path & path, PathSet & stateReferrers, const unsigned int revision); + Path queryDeriver(const Path & path); + Path addToStore(const Path & srcPath, bool fixed = false, bool recursive = false, string hashAlgo = "", PathFilter & filter = defaultPathFilter); @@ -104,8 +106,6 @@ public: Snapshots commitStatePath(const Path & statePath); - Path queryDeriver(const Path & path); - PathSet queryDerivers(const Path & storePath, const string & identifier, const string & user); //should these be in here ???? void scanAndUpdateAllReferences(const Path & statePath, const bool recursive); diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index cfad41162..e31e94135 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -261,6 +261,14 @@ void RemoteStore::queryStateReferrers(const Path & path, stateReferrers.insert(stateReferrers2.begin(), stateReferrers2.end()); } +Path RemoteStore::queryDeriver(const Path & path) +{ + writeInt(wopQueryDeriver, to); + writeString(path, to); + processStderr(); + return readStorePath(from); +} + Path RemoteStore::addToStore(const Path & _srcPath, bool fixed, bool recursive, string hashAlgo, PathFilter & filter) @@ -274,8 +282,9 @@ Path RemoteStore::addToStore(const Path & _srcPath, bool fixed, writeString(hashAlgo, to); dumpPath(srcPath, to, filter); processStderr(); - Path path = readStorePath(from); - return path; + return readStorePath(from); + //Path path = readStorePath(from); //TODO REMOVE CODE + //return path; } @@ -392,14 +401,6 @@ void RemoteStore::collectGarbage(GCAction action, const PathSet & pathsToDelete, bytesFreed = (((unsigned long long) hi) << 32) | lo; } -Path RemoteStore::queryDeriver(const Path & path) -{ - writeInt(wopQueryDeriver, to); - writeString(path, to); - processStderr(); - return readStorePath(from); -} - PathSet RemoteStore::queryDerivers(const Path & storePath, const string & identifier, const string & user) { writeInt(wopQueryDerivers, to); diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index 3231e7545..abd171b26 100644 --- a/src/libstore/remote-store.hh +++ b/src/libstore/remote-store.hh @@ -47,6 +47,8 @@ public: void queryStateReferrers(const Path & path, PathSet & stateReferrers, const unsigned int revision); + Path queryDeriver(const Path & path); + Path addToStore(const Path & srcPath, bool fixed = false, bool recursive = false, string hashAlgo = "", PathFilter & filter = defaultPathFilter); @@ -90,8 +92,6 @@ public: Snapshots commitStatePath(const Path & statePath); - Path queryDeriver(const Path & path); - PathSet queryDerivers(const Path & storePath, const string & identifier, const string & user); void scanAndUpdateAllReferences(const Path & statePath, const bool recursive); diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 110e0738a..817dd8b22 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -96,6 +96,10 @@ public: The result is not cleared. */ virtual void queryStateReferrers(const Path & path, PathSet & stateReferrers, const unsigned int revision) = 0; + /* Query the deriver of a store path. Return the empty string if + no deriver has been set. */ + virtual Path queryDeriver(const Path & path) = 0; + /* Copy the contents of a path to the store and register the validity the resulting path. The resulting path is returned. If `fixed' is true, then the output of a fixed-output @@ -226,10 +230,6 @@ public: /* TODO */ virtual Snapshots commitStatePath(const Path & statePath) = 0; - - /* Query the deriver of a store path. Return the empty string if - no deriver has been set. */ - virtual Path queryDeriver(const Path & path) = 0; /* TODO */ virtual PathSet queryDerivers(const Path & storePath, const string & identifier, const string & user) = 0; diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 93741ca6b..4e9f26624 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -730,7 +730,10 @@ static void upgradeDerivations(Globals & globals, DrvName drvName(i->name); MetaInfo meta = i->queryMetaInfo(globals.state); - if (meta["keep"] == "true") continue; + if (meta["keep"] == "true") { + newElems.push_back(*i); + continue; + } /* Find the derivation in the input Nix expression with the same name that satisfies the version constraints specified @@ -1222,7 +1225,7 @@ static void opQuery(Globals & globals, cout.flush(); } catch (AssertionError & e) { - /* !!! hm, maybe we should give some sort of warning here? */ + printMsg(lvlTalkative, format("skipping derivation named `%1%' which gives an assertion failure") % i->name); } } diff --git a/src/nix-worker/nix-worker.cc b/src/nix-worker/nix-worker.cc index 097512b4d..6b6e601fe 100644 --- a/src/nix-worker/nix-worker.cc +++ b/src/nix-worker/nix-worker.cc @@ -332,7 +332,7 @@ static void performOp(Source & from, Sink & to, unsigned int op) writeString(deriver, to); break; } - + case wopAddToStore: { string baseName = readString(from); bool fixed = readInt(from) == 1;