mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 04:00:59 +01:00
created sub commit scripts
This commit is contained in:
parent
86b053dd80
commit
97eb8c32a0
7 changed files with 27 additions and 10 deletions
|
|
@ -440,8 +440,13 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
||||||
startNest(nest, lvlVomit, format("processing statedir attribute `%1%'") % statekey);
|
startNest(nest, lvlVomit, format("processing statedir attribute `%1%'") % statekey);
|
||||||
try {
|
try {
|
||||||
string s = coerceToString(state, statevalue, context, true);
|
string s = coerceToString(state, statevalue, context, true);
|
||||||
|
if (statekey == "dir") {
|
||||||
if (statekey == "dir") { dir.path = s; }
|
//Add a / to the end if it's not there
|
||||||
|
if(s[s.length() - 1] != '/')
|
||||||
|
dir.path = s + "/";
|
||||||
|
else
|
||||||
|
dir.path = s;
|
||||||
|
}
|
||||||
else if (statekey == "type") { dir.type = s; }
|
else if (statekey == "type") { dir.type = s; }
|
||||||
else if (statekey == "interval") { dir.interval = s; }
|
else if (statekey == "interval") { dir.interval = s; }
|
||||||
else throw EvalError(format("invalid subattirbute `%1%' for attribute dirs") % statekey);
|
else throw EvalError(format("invalid subattirbute `%1%' for attribute dirs") % statekey);
|
||||||
|
|
|
||||||
|
|
@ -1381,7 +1381,7 @@ void DerivationGoal::startBuilder()
|
||||||
//We only create state dirs when state is enabled and when the dirs need to be created before the installation
|
//We only create state dirs when state is enabled and when the dirs need to be created before the installation
|
||||||
if(drv.stateOutputs.size() != 0)
|
if(drv.stateOutputs.size() != 0)
|
||||||
if(drv.stateOutputs.find("state")->second.getCreateDirsBeforeInstall())
|
if(drv.stateOutputs.find("state")->second.getCreateDirsBeforeInstall())
|
||||||
createStateDirs(drv.stateOutputDirs, drv.stateOutputs);
|
createStateDirs(drv.stateOutputDirs, drv.stateOutputs, drv.env);
|
||||||
|
|
||||||
/* For convenience, set an environment pointing to the top build
|
/* For convenience, set an environment pointing to the top build
|
||||||
directory. */
|
directory. */
|
||||||
|
|
@ -1616,7 +1616,7 @@ void DerivationGoal::computeClosure()
|
||||||
//We create state dirs only when state is enabled and when the dirs need to be created after the installation
|
//We create state dirs only when state is enabled and when the dirs need to be created after the installation
|
||||||
if(drv.stateOutputs.size() != 0)
|
if(drv.stateOutputs.size() != 0)
|
||||||
if(!drv.stateOutputs.find("state")->second.getCreateDirsBeforeInstall())
|
if(!drv.stateOutputs.find("state")->second.getCreateDirsBeforeInstall())
|
||||||
createStateDirs(drv.stateOutputDirs, drv.stateOutputs);
|
createStateDirs(drv.stateOutputDirs, drv.stateOutputs, drv.env);
|
||||||
|
|
||||||
/* Check whether the output paths were created, and grep each
|
/* Check whether the output paths were created, and grep each
|
||||||
output path to determine what other paths it references. Also make all
|
output path to determine what other paths it references. Also make all
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,8 @@ struct DerivationStateOutput
|
||||||
string hashAlgo;
|
string hashAlgo;
|
||||||
string hash;
|
string hash;
|
||||||
string enabled;
|
string enabled;
|
||||||
string shared;
|
string shared; //none, full, group
|
||||||
string synchronization;
|
string synchronization; //none, ... ?
|
||||||
string createDirsBeforeInstall;
|
string createDirsBeforeInstall;
|
||||||
DerivationStateOutput()
|
DerivationStateOutput()
|
||||||
{
|
{
|
||||||
|
|
@ -69,8 +69,8 @@ struct DerivationStateOutput
|
||||||
struct DerivationStateOutputDir
|
struct DerivationStateOutputDir
|
||||||
{
|
{
|
||||||
string path;
|
string path;
|
||||||
string type;
|
string type; //none, manual, interval, full
|
||||||
string interval;
|
string interval; //type int
|
||||||
DerivationStateOutputDir()
|
DerivationStateOutputDir()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ bool readOnlyMode = false;
|
||||||
string thisSystem = "unset";
|
string thisSystem = "unset";
|
||||||
unsigned int maxSilentTime = 0;
|
unsigned int maxSilentTime = 0;
|
||||||
|
|
||||||
|
|
||||||
static bool settingsRead = false;
|
static bool settingsRead = false;
|
||||||
|
|
||||||
static std::map<string, Strings> settings;
|
static std::map<string, Strings> settings;
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,6 @@ extern string thisSystem;
|
||||||
infinity. */
|
infinity. */
|
||||||
extern unsigned int maxSilentTime;
|
extern unsigned int maxSilentTime;
|
||||||
|
|
||||||
|
|
||||||
Strings querySetting(const string & name, const Strings & def);
|
Strings querySetting(const string & name, const Strings & def);
|
||||||
|
|
||||||
string querySetting(const string & name, const string & def);
|
string querySetting(const string & name, const string & def);
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,18 @@ Path makeStatePath(const string & type, const Hash & hash, const string & suffix
|
||||||
+ "-" + suffix;
|
+ "-" + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Path makeStateReposPath(const string & type, const Hash & hash, const string & suffix)
|
||||||
|
{
|
||||||
|
/* e.g., "source:sha256:1abc...:/nix/store:foo.tar.gz" */
|
||||||
|
string s = type + ":sha256:" + printHash(hash) + ":"
|
||||||
|
+ nixStoreState + ":" + suffix;
|
||||||
|
|
||||||
|
checkStoreName(suffix); //should this be here?
|
||||||
|
|
||||||
|
return nixStoreStateRepos + "/"
|
||||||
|
+ printHash32(compressHash(hashString(htSHA256, s), 20))
|
||||||
|
+ "-" + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
Path makeFixedOutputPath(bool recursive,
|
Path makeFixedOutputPath(bool recursive,
|
||||||
string hashAlgo, Hash hash, string name)
|
string hashAlgo, Hash hash, string name)
|
||||||
|
|
|
||||||
|
|
@ -207,6 +207,9 @@ Path makeFixedOutputPath(bool recursive,
|
||||||
/* Constructs a unique store state path name. */
|
/* Constructs a unique store state path name. */
|
||||||
Path makeStatePath(const string & type, const Hash & hash, const string & suffix);
|
Path makeStatePath(const string & type, const Hash & hash, const string & suffix);
|
||||||
|
|
||||||
|
/* Constructs a unique store state repos path name. */
|
||||||
|
Path makeStateReposPath(const string & type, const Hash & hash, const string & suffix);
|
||||||
|
|
||||||
|
|
||||||
/* This is the preparatory part of addToStore() and addToStoreFixed();
|
/* This is the preparatory part of addToStore() and addToStoreFixed();
|
||||||
it computes the store path to which srcPath is to be copied.
|
it computes the store path to which srcPath is to be copied.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue