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-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

View file

@ -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));
}

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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;