1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 04:00:59 +01:00

Merged R9063

This commit is contained in:
Wouter den Breejen 2007-10-08 10:41:41 +00:00
parent 546ca6e8bc
commit 00602dd20c
8 changed files with 30 additions and 38 deletions

View file

@ -67,12 +67,12 @@ endif
# bzip2 # bzip2
BZIP2 = bzip2-1.0.3 BZIP2 = bzip2-1.0.4
$(BZIP2).tar.gz: $(BZIP2).tar.gz:
@echo "Nix requires bzip2 to build." @echo "Nix requires bzip2 to build."
@echo "Please download version 1.0.3 from" @echo "Please download version 1.0.4 from"
@echo " http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz" @echo " http://www.bzip.org/1.0.4/bzip2-1.0.4.tar.gz"
@echo "and place it in the externals/ directory." @echo "and place it in the externals/ directory."
false false

View file

@ -383,20 +383,8 @@ Expr parseExprFromFile(EvalState & state, Path path)
if (S_ISDIR(st.st_mode)) if (S_ISDIR(st.st_mode))
path = canonPath(path + "/default.nix"); path = canonPath(path + "/default.nix");
/* Read the input file. We can't use SGparseFile() because it's /* Read and parse the input file. */
broken, so we read the input ourselves and call return parse(state, readFile(path).c_str(), path, dirOf(path));
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));
} }

View file

@ -59,6 +59,8 @@ public:
void queryStateReferrers(const Path & path, PathSet & stateReferrers, const unsigned int revision); void queryStateReferrers(const Path & path, PathSet & stateReferrers, const unsigned int revision);
Path queryDeriver(const Path & path);
Path addToStore(const Path & srcPath, bool fixed = false, Path addToStore(const Path & srcPath, bool fixed = false,
bool recursive = false, string hashAlgo = "", bool recursive = false, string hashAlgo = "",
PathFilter & filter = defaultPathFilter); PathFilter & filter = defaultPathFilter);
@ -104,8 +106,6 @@ public:
Snapshots commitStatePath(const Path & statePath); 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 ???? PathSet queryDerivers(const Path & storePath, const string & identifier, const string & user); //should these be in here ????
void scanAndUpdateAllReferences(const Path & statePath, const bool recursive); void scanAndUpdateAllReferences(const Path & statePath, const bool recursive);

View file

@ -261,6 +261,14 @@ void RemoteStore::queryStateReferrers(const Path & path,
stateReferrers.insert(stateReferrers2.begin(), stateReferrers2.end()); 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, Path RemoteStore::addToStore(const Path & _srcPath, bool fixed,
bool recursive, string hashAlgo, PathFilter & filter) bool recursive, string hashAlgo, PathFilter & filter)
@ -274,8 +282,9 @@ Path RemoteStore::addToStore(const Path & _srcPath, bool fixed,
writeString(hashAlgo, to); writeString(hashAlgo, to);
dumpPath(srcPath, to, filter); dumpPath(srcPath, to, filter);
processStderr(); processStderr();
Path path = readStorePath(from); return readStorePath(from);
return path; //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; 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) PathSet RemoteStore::queryDerivers(const Path & storePath, const string & identifier, const string & user)
{ {
writeInt(wopQueryDerivers, to); writeInt(wopQueryDerivers, to);

View file

@ -47,6 +47,8 @@ public:
void queryStateReferrers(const Path & path, PathSet & stateReferrers, const unsigned int revision); void queryStateReferrers(const Path & path, PathSet & stateReferrers, const unsigned int revision);
Path queryDeriver(const Path & path);
Path addToStore(const Path & srcPath, bool fixed = false, Path addToStore(const Path & srcPath, bool fixed = false,
bool recursive = false, string hashAlgo = "", bool recursive = false, string hashAlgo = "",
PathFilter & filter = defaultPathFilter); PathFilter & filter = defaultPathFilter);
@ -90,8 +92,6 @@ public:
Snapshots commitStatePath(const Path & statePath); Snapshots commitStatePath(const Path & statePath);
Path queryDeriver(const Path & path);
PathSet queryDerivers(const Path & storePath, const string & identifier, const string & user); PathSet queryDerivers(const Path & storePath, const string & identifier, const string & user);
void scanAndUpdateAllReferences(const Path & statePath, const bool recursive); void scanAndUpdateAllReferences(const Path & statePath, const bool recursive);

View file

@ -96,6 +96,10 @@ public:
The result is not cleared. */ The result is not cleared. */
virtual void queryStateReferrers(const Path & path, PathSet & stateReferrers, const unsigned int revision) = 0; 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 /* Copy the contents of a path to the store and register the
validity the resulting path. The resulting path is returned. validity the resulting path. The resulting path is returned.
If `fixed' is true, then the output of a fixed-output If `fixed' is true, then the output of a fixed-output
@ -227,10 +231,6 @@ public:
/* TODO */ /* TODO */
virtual Snapshots commitStatePath(const Path & statePath) = 0; 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 */ /* TODO */
virtual PathSet queryDerivers(const Path & storePath, const string & identifier, const string & user) = 0; virtual PathSet queryDerivers(const Path & storePath, const string & identifier, const string & user) = 0;

View file

@ -730,7 +730,10 @@ static void upgradeDerivations(Globals & globals,
DrvName drvName(i->name); DrvName drvName(i->name);
MetaInfo meta = i->queryMetaInfo(globals.state); 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 /* Find the derivation in the input Nix expression with the
same name that satisfies the version constraints specified same name that satisfies the version constraints specified
@ -1222,7 +1225,7 @@ static void opQuery(Globals & globals,
cout.flush(); cout.flush();
} catch (AssertionError & e) { } 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);
} }
} }