mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 04:00:59 +01:00
This commit is contained in:
parent
ec7b0afb08
commit
094c69ad19
9 changed files with 41 additions and 25 deletions
|
|
@ -21,6 +21,9 @@ if [ "$1" = "full" ]; then
|
||||||
nix-env-all-pkgs.sh -i gdb #optional for debugging
|
nix-env-all-pkgs.sh -i gdb #optional for debugging
|
||||||
nix-env-all-pkgs.sh -i gnupatch
|
nix-env-all-pkgs.sh -i gnupatch
|
||||||
nix-env-all-pkgs.sh -i gnumake
|
nix-env-all-pkgs.sh -i gnumake
|
||||||
|
nix-env-all-pkgs.sh -i ext3cow-tools
|
||||||
|
nix-env-all-pkgs.sh -i e3cfsprogs
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "full" ] || [ "$1" = "auto" ]; then
|
if [ "$1" = "full" ] || [ "$1" = "auto" ]; then
|
||||||
|
|
|
||||||
|
|
@ -1829,7 +1829,9 @@ void DerivationGoal::computeClosure()
|
||||||
}
|
}
|
||||||
//If not shared: create the dir and set the rights
|
//If not shared: create the dir and set the rights
|
||||||
else{
|
else{
|
||||||
setStatePathRights(statePath, queryCallingUsername(), "nixbld", "700");
|
ensureDirExists(statePath);
|
||||||
|
setChown(statePath, queryCallingUsername(), "nixbld");
|
||||||
|
setChmod(statePath, "700");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -527,6 +527,7 @@ void RemoteStore::revertToRevision(const Path & componentPath, const Path & deri
|
||||||
|
|
||||||
void RemoteStore::setSharedState(const Path & fromExisting, const Path & toNew)
|
void RemoteStore::setSharedState(const Path & fromExisting, const Path & toNew)
|
||||||
{
|
{
|
||||||
|
writeInt(wopSetSharedState, to);
|
||||||
writeString(fromExisting, to);
|
writeString(fromExisting, to);
|
||||||
writeString(toNew, to);
|
writeString(toNew, to);
|
||||||
processStderr();
|
processStderr();
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,9 @@ void checkStatePath(const Derivation & drv)
|
||||||
string componentHash = drv.stateOutputs.find("state")->second.componentHash;
|
string componentHash = drv.stateOutputs.find("state")->second.componentHash;
|
||||||
string suffix = drv.env.find("name")->second;
|
string suffix = drv.env.find("name")->second;
|
||||||
string stateIdentifier = drv.stateOutputs.find("state")->second.stateIdentifier;
|
string stateIdentifier = drv.stateOutputs.find("state")->second.stateIdentifier;
|
||||||
Path calculatedPath = makeStatePath(componentHash, suffix, stateIdentifier);
|
Path calculatedPath = makeStatePath(componentHash, suffix, stateIdentifier); //TODO INCLUDE USER !!!!!!!!!!!!
|
||||||
|
|
||||||
|
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! calculatedPath IS NOT CORRECT ANYMORE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
printMsg(lvlError, format("Checking statePath validity: %1% %2%") % drvPath % calculatedPath);
|
printMsg(lvlError, format("Checking statePath validity: %1% %2%") % drvPath % calculatedPath);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,20 +50,23 @@ void createSubStateDirsTxn(const Transaction & txn, const DerivationStateOutputD
|
||||||
DerivationStateOutputDir d = i->second;
|
DerivationStateOutputDir d = i->second;
|
||||||
|
|
||||||
string thisdir = d.path;
|
string thisdir = d.path;
|
||||||
|
|
||||||
//If it is a file: continue
|
|
||||||
if(thisdir.substr(thisdir.length() -1 , thisdir.length()) != "/")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Path fullstatedir = stateDir + "/" + thisdir;
|
Path fullstatedir = stateDir + "/" + thisdir;
|
||||||
|
|
||||||
setStatePathRights(fullstatedir, queryCallingUsername(), "nixbld");
|
//If it is a file: continue
|
||||||
|
if(thisdir.substr(thisdir.length() -1 , thisdir.length()) != "/"){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ensureDirExists(fullstatedir);
|
||||||
|
|
||||||
if(d.type == "interval"){
|
if(d.type == "interval"){
|
||||||
intervalPaths.insert(fullstatedir);
|
intervalPaths.insert(fullstatedir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setChown(statePath, queryCallingUsername(), "nixbld", true); //Set all dirs in the statePath recursively to their owners
|
||||||
|
printMsg(lvlTalkative, format("Set CHOWN '%1%'") % (statePath + "-" + queryCallingUsername()));
|
||||||
|
|
||||||
//Initialize the counters for the statePaths that have an interval to 0
|
//Initialize the counters for the statePaths that have an interval to 0
|
||||||
IntVector empty;
|
IntVector empty;
|
||||||
setStatePathsIntervalTxn(txn, intervalPaths, empty, true);
|
setStatePathsIntervalTxn(txn, intervalPaths, empty, true);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ typedef enum {
|
||||||
wopQueryStateReferrers,
|
wopQueryStateReferrers,
|
||||||
wopAddToStore,
|
wopAddToStore,
|
||||||
wopAddTextToStore,
|
wopAddTextToStore,
|
||||||
wopBuildDerivations, //TODO HANGS SOMETIMES !!!!!
|
wopBuildDerivations, //TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! HANGS SOMETIMES !!!!!
|
||||||
wopEnsurePath,
|
wopEnsurePath,
|
||||||
wopAddTempRoot,
|
wopAddTempRoot,
|
||||||
wopAddIndirectRoot,
|
wopAddIndirectRoot,
|
||||||
|
|
|
||||||
|
|
@ -1241,20 +1241,22 @@ void ensureDirExists(const Path & path)
|
||||||
runProgram_AndPrintOutput("mkdir", true, p_args, "mkdir"); //TODO ensurePath
|
runProgram_AndPrintOutput("mkdir", true, p_args, "mkdir"); //TODO ensurePath
|
||||||
}
|
}
|
||||||
|
|
||||||
void setStatePathRights(const Path & statePath, const string & user, const string & group, const string & chmod)
|
void setChown(const Path & pathOrFile, const string & user, const string & group, bool recursive)
|
||||||
{
|
{
|
||||||
ensureDirExists(statePath);
|
|
||||||
Strings p_args;
|
Strings p_args;
|
||||||
|
if(recursive)
|
||||||
|
p_args.push_back("-R");
|
||||||
p_args.push_back(user + "." + group);
|
p_args.push_back(user + "." + group);
|
||||||
p_args.push_back(statePath);
|
p_args.push_back(pathOrFile);
|
||||||
runProgram_AndPrintOutput("chown", true, p_args, "chown");
|
runProgram_AndPrintOutput("chown", true, p_args, "chown");
|
||||||
|
}
|
||||||
|
|
||||||
if(chmod != "") {
|
void setChmod(const Path & pathOrFile, const string & chmod)
|
||||||
p_args.clear();
|
{
|
||||||
|
Strings p_args;
|
||||||
p_args.push_back(chmod);
|
p_args.push_back(chmod);
|
||||||
p_args.push_back(statePath);
|
p_args.push_back(pathOrFile);
|
||||||
runProgram_AndPrintOutput("chmod", true, p_args, "chmod");
|
runProgram_AndPrintOutput("chmod", true, p_args, "chmod");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string padd(const string & s, char c , unsigned int size, bool front)
|
string padd(const string & s, char c , unsigned int size, bool front)
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,8 @@ void pathSets_difference(const PathSet & oldpaths, const PathSet & newpaths, Pat
|
||||||
void ensureDirExists(const Path & path);
|
void ensureDirExists(const Path & path);
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
void setStatePathRights(const Path & statePath, const string & user, const string & group, const string & chmod = "");
|
void setChown(const Path & pathOrFile, const string & user, const string & group, bool recursive = false);
|
||||||
|
void setChmod(const Path & pathOrFile, const string & chmod);
|
||||||
|
|
||||||
string padd(const string & s, char c , unsigned int size, bool front = false);
|
string padd(const string & s, char c , unsigned int size, bool front = false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -572,7 +572,7 @@ static void installDerivations(Globals & globals,
|
||||||
oldStatePath = oldDrv.stateOutputs.find("state")->second.statepath;
|
oldStatePath = oldDrv.stateOutputs.find("state")->second.statepath;
|
||||||
|
|
||||||
//SharePaths
|
//SharePaths
|
||||||
printMsg(lvlError, format("Sharing state from old to new component '%1%' --> '%2%'") % newStatePath % oldStatePath);
|
printMsg(lvlError, format("Sharing state from old <-- new component '%1%' <-- '%2%'") % oldStatePath % newStatePath);
|
||||||
toBeShared[oldStatePath] = newStatePath;
|
toBeShared[oldStatePath] = newStatePath;
|
||||||
}
|
}
|
||||||
else{ //If not equal, then we do not replace, so we push back (just like the else branch)
|
else{ //If not equal, then we do not replace, so we push back (just like the else branch)
|
||||||
|
|
@ -601,7 +601,9 @@ static void installDerivations(Globals & globals,
|
||||||
//After all components have been built succesfully, share their state paths with the old ones
|
//After all components have been built succesfully, share their state paths with the old ones
|
||||||
for (StringPairs::iterator i = toBeShared.begin(); i != toBeShared.end(); ++i){
|
for (StringPairs::iterator i = toBeShared.begin(); i != toBeShared.end(); ++i){
|
||||||
|
|
||||||
deletePathWrapped(i->second); //Remove contents of current new state path
|
printMsg(lvlError, format("Sharing state from old <-- new component '%1%' <-- '%2%'") % i->first % i->second);
|
||||||
|
|
||||||
|
deletePath(i->second); //Remove contents of current new state path
|
||||||
sharePath(i->first, i->second); //Share new statepath to the old statepath
|
sharePath(i->first, i->second); //Share new statepath to the old statepath
|
||||||
|
|
||||||
//Set in database
|
//Set in database
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue