mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 04:00:59 +01:00
Before giving all store-state-runtime-paths a unique hash storepath
This commit is contained in:
parent
df43c1e5b9
commit
5e59387d40
3 changed files with 40 additions and 12 deletions
|
|
@ -1252,19 +1252,16 @@ PathSet getStateReferencesClosure(const Path & drvpath)
|
||||||
|
|
||||||
//get all ...
|
//get all ...
|
||||||
|
|
||||||
return getStateReferencesClosure_(drvpath, empty);
|
return empty; // getStateReferencesClosure_(drvpath, empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
PathSet getStateReferencesClosure_(const Path & drvpath, PathSet & paths)
|
PathSet getStateReferencesClosure_(const Path & drvpath, PathSet & paths)
|
||||||
{
|
{
|
||||||
Transaction txn(nixDB); //TODO should u do a transaction here? ... this might delay the process ...
|
Transaction txn(nixDB); //TODO should u do a transaction here? ... this might delay the process ...
|
||||||
|
|
||||||
Derivation drv = derivationFromPath(derivationPath);
|
//Derivation drv = derivationFromPath(derivationPath);
|
||||||
|
|
||||||
for (DerivationOutputs::iterator i = drv.outputs.begin(); i != drv.outputs.end(); ++i)
|
//for (DerivationOutputs::iterator i = drv.outputs.begin(); i != drv.outputs.end(); ++i)
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for (Strings::iterator i = data.begin(); i != data.end(); ++i)
|
for (Strings::iterator i = data.begin(); i != data.end(); ++i)
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ void addStateDeriver(const Transaction & txn, const Path & storePath, const Path
|
||||||
PathSet mergeNewDerivationIntoList(const Path & storepath, const Path & newdrv, const PathSet drvs, bool deleteDrvs = false);
|
PathSet mergeNewDerivationIntoList(const Path & storepath, const Path & newdrv, const PathSet drvs, bool deleteDrvs = false);
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
PathSet getStateReferencesClosure_(const Path & drvpath, PathSet & paths);
|
//PathSet getStateReferencesClosure_(const Path & drvpath, PathSet & paths);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ static void opShowStatePath(Strings opFlags, Strings opArgs)
|
||||||
Path statePath;
|
Path statePath;
|
||||||
string stateIdentifier;
|
string stateIdentifier;
|
||||||
string binary;
|
string binary;
|
||||||
string derivationPath
|
string derivationPath;
|
||||||
Derivation drv = getDerivation_andCheckArgs(opFlags, opArgs, componentPath, statePath, stateIdentifier, binary, derivationPath);
|
Derivation drv = getDerivation_andCheckArgs(opFlags, opArgs, componentPath, statePath, stateIdentifier, binary, derivationPath);
|
||||||
printMsg(lvlError, format("%1%") % statePath);
|
printMsg(lvlError, format("%1%") % statePath);
|
||||||
}
|
}
|
||||||
|
|
@ -153,7 +153,7 @@ static void opRunComponent(Strings opFlags, Strings opArgs)
|
||||||
Path statePath;
|
Path statePath;
|
||||||
string stateIdentifier;
|
string stateIdentifier;
|
||||||
string binary;
|
string binary;
|
||||||
string derivationPath
|
string derivationPath;
|
||||||
Derivation drv = getDerivation_andCheckArgs(opFlags, opArgs, componentPath, statePath, stateIdentifier, binary, derivationPath);
|
Derivation drv = getDerivation_andCheckArgs(opFlags, opArgs, componentPath, statePath, stateIdentifier, binary, derivationPath);
|
||||||
DerivationStateOutputDirs stateOutputDirs = drv.stateOutputDirs;
|
DerivationStateOutputDirs stateOutputDirs = drv.stateOutputDirs;
|
||||||
DerivationStateOutputs stateOutputs = drv.stateOutputs;
|
DerivationStateOutputs stateOutputs = drv.stateOutputs;
|
||||||
|
|
@ -291,6 +291,39 @@ static void opRunComponent(Strings opFlags, Strings opArgs)
|
||||||
"commit-script");
|
"commit-script");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PathSet getStateReferencesClosure_(const Path & drvpath, PathSet & drvPaths, const PathSet & paths)
|
||||||
|
{
|
||||||
|
Derivation drv = derivationFromPath(drvpath);
|
||||||
|
Path outPath = drv.outputs["out"].path;
|
||||||
|
|
||||||
|
for (DerivationInputs::iterator i = drv.inputDrvs.begin(); i != drv.inputDrvs.end(); ++i){
|
||||||
|
|
||||||
|
Path checkDrvPath = i->first;
|
||||||
|
printMsg(lvlError, format("DRVPS: `%1%'") % checkDrvPath);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PathSet getStateReferencesClosure(const Path & drvpath)
|
||||||
|
{
|
||||||
|
PathSet empty;
|
||||||
|
PathSet paths;
|
||||||
|
Derivation drv = derivationFromPath(drvpath);
|
||||||
|
Path outPath = drv.outputs["out"].path;
|
||||||
|
computeFSClosure(outPath, paths);
|
||||||
|
PathSet drvRefs = getStateReferencesClosure_(drvpath, empty, paths);
|
||||||
|
|
||||||
|
for (PathSet::iterator i = paths.begin(); i != paths.end(); ++i)
|
||||||
|
{
|
||||||
|
printMsg(lvlError, format("Referen2ces: `%1%'") % *i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return drvRefs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void run(Strings args)
|
void run(Strings args)
|
||||||
{
|
{
|
||||||
|
|
@ -318,10 +351,8 @@ void run(Strings args)
|
||||||
//store->updateAllStateDerivations();
|
//store->updateAllStateDerivations();
|
||||||
//return;
|
//return;
|
||||||
|
|
||||||
PathSet paths
|
|
||||||
storePathRequisites("", false, paths);
|
|
||||||
|
|
||||||
//PathSet paths = store->getStateReferencesClosure("/nix/store/928dd2wl5cgqg10hzc3aj4rqaips6bdk-hellohardcodedstateworld-dep1-1.0.drv");
|
PathSet paths = getStateReferencesClosure("/nix/store/928dd2wl5cgqg10hzc3aj4rqaips6bdk-hellohardcodedstateworld-dep1-1.0.drv");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* test */
|
/* test */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue