mirror of
https://github.com/NixOS/nix.git
synced 2025-11-27 04:30:59 +01:00
build error
This commit is contained in:
parent
8a7874d77d
commit
3fc0b0da58
18 changed files with 97 additions and 71 deletions
|
|
@ -345,14 +345,6 @@ static Hash hashDerivationModulo(EvalState & state, Derivation drv)
|
|||
return hashTerm(unparseDerivation(drv));
|
||||
}
|
||||
|
||||
|
||||
static Expr prim_mkStatePath2(EvalState & state, const ATermVector & args)
|
||||
{
|
||||
PathSet context;
|
||||
return makeStr("$statepath", context);
|
||||
}
|
||||
|
||||
|
||||
/* Construct (as a unobservable side effect) a Nix derivation
|
||||
expression that performs the derivation described by the argument
|
||||
set. Returns the original set extended with the following
|
||||
|
|
@ -561,19 +553,16 @@ static Expr prim_derivationStrict(EvalState & state, const ATermVector & args)
|
|||
drv.outputs["out"] = DerivationOutput(outPath, outputHashAlgo, outputHash);
|
||||
|
||||
/* Add the state path based on the outPath */
|
||||
string callingUser = "wouterdb"; //TODO: Change into variable
|
||||
string statePrefix = "/nix/state/"; //TODO: Change into variable
|
||||
string callingUser = "wouterdb"; //TODO: Change into variable
|
||||
string componentHash = printHash(hashDerivationModulo(state, drv)); //hash of the component path
|
||||
Hash statehash = hashString(htSHA256, stateIndentifier + callingUser + componentHash); //hash of the state path
|
||||
Path stateOutPath = makeStatePath("stateOutput:statepath", statehash, drvName); //
|
||||
|
||||
//Path outPath = makeStatePath("stateOutput:statepath", hashDerivationModulo(state, drv), drvName);
|
||||
|
||||
string componentHash = printHash(hashDerivationModulo(state, drv));
|
||||
Hash hash = hashString(htSHA256, stateIndentifier + callingUser + componentHash); //calculate state hash
|
||||
string statePath = statePrefix + printHash(hash) + "/"; //make the state path
|
||||
drv.env["statepath"] = statePath;
|
||||
drv.env["statepath"] = stateOutPath;
|
||||
string enableStateS = "false";
|
||||
if(enableState && disableState == false)
|
||||
enableStateS = "true";
|
||||
drv.stateOutputs["state"] = DerivationStateOutput(statePath, outputHashAlgo, outputHash, enableStateS, shareState, syncState);
|
||||
drv.stateOutputs["state"] = DerivationStateOutput(stateOutPath, outputHashAlgo, outputHash, enableStateS, shareState, syncState);
|
||||
|
||||
/* Write the resulting term into the Nix store directory. */
|
||||
Path drvPath = writeDerivation(drv, drvName);
|
||||
|
|
@ -649,39 +638,6 @@ static Expr prim_baseNameOf(EvalState & state, const ATermVector & args)
|
|||
|
||||
}
|
||||
|
||||
/* ..... */
|
||||
|
||||
static Expr prim_mkStatePath(EvalState & state, const ATermVector & args)
|
||||
{
|
||||
PathSet context;
|
||||
string indentifier = coerceToString(state, args[0], context);
|
||||
string subdir = coerceToString(state, args[1], context);
|
||||
string callingUser = "wouterdb"; //TODO: Change into variable
|
||||
string statePrefix = "/nix/state/"; //TODO: Change into variable
|
||||
|
||||
//calculate state hash
|
||||
Hash hash = hashString(htSHA256, indentifier + callingUser);
|
||||
|
||||
//make the path
|
||||
string path = statePrefix + printHash(hash) + "/";
|
||||
|
||||
if(subdir == "")
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
path = path + subdir;
|
||||
}
|
||||
|
||||
//PRE BUILD, After DRV Rewrite:
|
||||
//ensureDir
|
||||
//system("chown callingUser.root " + path);
|
||||
|
||||
//share state location if nessesary
|
||||
|
||||
return makeStr(path, context);
|
||||
}
|
||||
|
||||
/* Return the directory of the given path, i.e., everything before the
|
||||
last slash. Return either a path or a string depending on the type
|
||||
of the argument. */
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ libmain_la_SOURCES = shared.cc shared.hh
|
|||
|
||||
AM_CXXFLAGS = \
|
||||
-DNIX_STORE_DIR=\"$(storedir)\" \
|
||||
-DNIX_STORE_STATE_DIR=\"$(storestatedir)\" \
|
||||
-DNIX_STORE_STATE_REPOS_DIR=\"$(storestatereposdir)\" \
|
||||
-DNIX_SVN_BIN_DIR=\"$(subversion)\" \
|
||||
-DNIX_DATA_DIR=\"$(datadir)\" \
|
||||
-DNIX_STATE_DIR=\"$(localstatedir)/nix\" \
|
||||
-DNIX_LOG_DIR=\"$(localstatedir)/log/nix\" \
|
||||
|
|
|
|||
|
|
@ -87,11 +87,13 @@ static void initAndRun(int argc, char * * argv)
|
|||
{
|
||||
/* Setup Nix paths. */
|
||||
nixStore = canonPath(getEnv("NIX_STORE_DIR", getEnv("NIX_STORE", NIX_STORE_DIR)));
|
||||
nixStoreState = canonPath(getEnv("NIX_STORE_STATE_DIR", NIX_STORE_STATE_DIR)); //store state dir usually /nix/state
|
||||
nixStoreState = canonPath(getEnv("NIX_STORE_STATE_DIR", NIX_STORE_STATE_DIR)); //store state dir usually /nix/state
|
||||
nixStoreStateRepos = canonPath(getEnv("NIX_STORE_STATE_REPOS_DIR", NIX_STORE_STATE_REPOS_DIR)); //store state dir usually /nix/state
|
||||
nixDataDir = canonPath(getEnv("NIX_DATA_DIR", NIX_DATA_DIR));
|
||||
nixLogDir = canonPath(getEnv("NIX_LOG_DIR", NIX_LOG_DIR));
|
||||
nixStateDir = canonPath(getEnv("NIX_STATE_DIR", NIX_STATE_DIR)); //nix global state dir
|
||||
nixStateDir = canonPath(getEnv("NIX_STATE_DIR", NIX_STATE_DIR)); //nix global state dir
|
||||
nixDBPath = getEnv("NIX_DB_DIR", nixStateDir + "/db");
|
||||
nixSVNPath = getEnv("NIX_SVN_BIN_DIR", NIX_SVN_BIN_DIR);
|
||||
nixConfDir = canonPath(getEnv("NIX_CONF_DIR", NIX_CONF_DIR));
|
||||
nixLibexecDir = canonPath(getEnv("NIX_LIBEXEC_DIR", NIX_LIBEXEC_DIR));
|
||||
nixBinDir = canonPath(getEnv("NIX_BIN_DIR", NIX_BIN_DIR));
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ pkginclude_HEADERS = \
|
|||
globals.hh db.hh references.hh pathlocks.hh \
|
||||
worker-protocol.hh
|
||||
|
||||
libstore_la_LIBADD = ../libutil/libutil.la ../boost/format/libformat.la
|
||||
libstore_la_LIBADD = ../libutil/libutil.la \
|
||||
../boost/format/libformat.la
|
||||
|
||||
BUILT_SOURCES = derivations-ast.cc derivations-ast.hh
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Derive | ATermList ATermList ATermList ATermList ATermList string string ATermLi
|
|||
| string ATermList | ATerm | DerivationInput |
|
||||
| string string string string | ATerm | DerivationOutput |
|
||||
| string string string string string string string | ATerm | DerivationStateOutput |
|
||||
| string string string string | ATerm | DerivationStateOutputDir |
|
||||
| string string string | ATerm | DerivationStateOutputDir |
|
||||
|
||||
Closure | ATermList ATermList | ATerm | OldClosure |
|
||||
| string ATermList | ATerm | OldClosureElem |
|
||||
|
|
|
|||
|
|
@ -102,8 +102,9 @@ Derivation parseDerivation(ATerm t)
|
|||
//parse state dirs part
|
||||
for (ATermIterator i(stateOutDirs); i; ++i) {
|
||||
ATerm id, path, type, interval;
|
||||
if (!matchDerivationStateOutputDir(*i, id, path, type, interval))
|
||||
if (!matchDerivationStateOutputDir(*i, id, /*path,*/ type, interval))
|
||||
throwBadDrv(t);
|
||||
path = id;
|
||||
DerivationStateOutputDir stateOutDirs;
|
||||
stateOutDirs.path = aterm2String(path);
|
||||
stateOutDirs.type = aterm2String(type);
|
||||
|
|
@ -175,7 +176,7 @@ ATerm unparseDerivation(const Derivation & drv)
|
|||
stateOutputDirs = ATinsert(stateOutputDirs,
|
||||
makeDerivationStateOutputDir(
|
||||
toATerm(i->first),
|
||||
toATerm(i->second.path),
|
||||
//toATerm(i->second.path),
|
||||
toATerm(i->second.type),
|
||||
toATerm(i->second.interval)
|
||||
));
|
||||
|
|
|
|||
|
|
@ -10,10 +10,12 @@ namespace nix {
|
|||
|
||||
string nixStore = "/UNINIT";
|
||||
string nixStoreState = "/UNINIT";
|
||||
string nixStoreStateRepos = "/UNINIT";
|
||||
string nixDataDir = "/UNINIT";
|
||||
string nixLogDir = "/UNINIT";
|
||||
string nixStateDir = "/UNINIT";
|
||||
string nixDBPath = "/UNINIT";
|
||||
string nixSVNPath = "/UNINIT";
|
||||
string nixConfDir = "/UNINIT";
|
||||
string nixLibexecDir = "/UNINIT";
|
||||
string nixBinDir = "/UNINIT";
|
||||
|
|
|
|||
|
|
@ -18,12 +18,21 @@ extern string nixDataDir; /* !!! fix */
|
|||
/* nixLogDir is the directory where we log various operations. */
|
||||
extern string nixLogDir;
|
||||
|
||||
/* nixStateDir is the directory where the state dirs of the components are stored. */
|
||||
/* nixStoreState is the directory where the state dirs of the components are stored. */
|
||||
extern string nixStoreState;
|
||||
|
||||
/* nixStoreState is the directory where the repositorys of the state dirs of the components are stored. */
|
||||
extern string nixStoreStateRepos;
|
||||
|
||||
/* nixStateDir is the directory where state is stored. */
|
||||
extern string nixStateDir;
|
||||
|
||||
/* nixDBPath is the path name of our Berkeley DB environment. */
|
||||
extern string nixDBPath;
|
||||
|
||||
/* nixSVNPath is the path name of our SVN environment. */
|
||||
extern string nixSVNPath;
|
||||
|
||||
/* nixConfDir is the directory where configuration files are
|
||||
stored. */
|
||||
extern string nixConfDir;
|
||||
|
|
@ -35,7 +44,6 @@ extern string nixLibexecDir;
|
|||
/* nixBinDir is the directory where the main programs are stored. */
|
||||
extern string nixBinDir;
|
||||
|
||||
|
||||
/* Misc. global flags. */
|
||||
|
||||
/* Whether to keep temporary directories of failed builds. */
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ Path makeStatePath(const string & type, const Hash & hash, const string & suffix
|
|||
string s = type + ":sha256:" + printHash(hash) + ":"
|
||||
+ nixStoreState + ":" + suffix;
|
||||
|
||||
checkStoreName(suffix);
|
||||
checkStoreName(suffix); //should this be here?
|
||||
|
||||
return nixStoreState + "/"
|
||||
+ printHash32(compressHash(hashString(htSHA256, s), 20))
|
||||
|
|
|
|||
|
|
@ -204,6 +204,9 @@ Path makeStorePath(const string & type,
|
|||
Path makeFixedOutputPath(bool recursive,
|
||||
string hashAlgo, Hash hash, string name);
|
||||
|
||||
/* Constructs a unique store state path name. */
|
||||
Path makeStatePath(const string & type, const Hash & hash, const string & suffix);
|
||||
|
||||
|
||||
/* This is the preparatory part of addToStore() and addToStoreFixed();
|
||||
it computes the store path to which srcPath is to be copied.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ pkglib_LTLIBRARIES = libutil.la
|
|||
libutil_la_SOURCES = util.cc hash.cc serialise.cc \
|
||||
archive.cc aterm.cc aterm-map.cc xml-writer.cc
|
||||
|
||||
libutil_la_LIBADD = ../boost/format/libformat.la
|
||||
libutil_la_LIBADD = ../libstore/libstore.la ../boost/format/libformat.la
|
||||
|
||||
pkginclude_HEADERS = util.hh hash.hh serialise.hh \
|
||||
archive.hh aterm.hh aterm-map.hh xml-writer.hh types.hh
|
||||
|
|
@ -13,4 +13,7 @@ libutil_la_SOURCES += \
|
|||
md5.c md5.h sha1.c sha1.h sha256.c sha256.h md32_common.h
|
||||
endif
|
||||
|
||||
AM_CXXFLAGS = -Wall -I$(srcdir)/.. ${aterm_include}
|
||||
AM_CXXFLAGS = -Wall \
|
||||
-I$(srcdir)/.. ${aterm_include} -I$(srcdir)/../libstore
|
||||
|
||||
|
||||
|
|
@ -1,5 +1,9 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "util.hh"
|
||||
#include "globals.hh"
|
||||
#include "derivations.hh"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
|
@ -14,9 +18,6 @@
|
|||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "util.hh"
|
||||
#include "../libstore/derivations.hh"
|
||||
|
||||
extern char * * environ;
|
||||
|
||||
|
||||
|
|
@ -371,6 +372,10 @@ Path createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
|
|||
}
|
||||
sort(stateDirsVector.begin(), stateDirsVector.end());
|
||||
|
||||
printMsg(lvlError, format("nixStoreState: `%1%'") % nixStoreState);
|
||||
printMsg(lvlError, format("nixStoreStateRepos: `%1%'") % nixStoreStateRepos);
|
||||
printMsg(lvlError, format("nixSVNPath `%1%'") % nixSVNPath);
|
||||
|
||||
for (vector<DerivationStateOutputDir>::iterator i = stateDirsVector.begin(); i != stateDirsVector.end(); ++i)
|
||||
{
|
||||
DerivationStateOutputDir d = *(i);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#define __UTIL_H
|
||||
|
||||
#include "types.hh"
|
||||
#include "../libstore/derivations.hh"
|
||||
#include "derivations.hh"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue