build error

This commit is contained in:
Wouter den Breejen 2007-05-20 12:29:55 +00:00
parent 8a7874d77d
commit 3fc0b0da58
18 changed files with 97 additions and 71 deletions

View File

@ -164,6 +164,16 @@ AC_ARG_WITH(store-dir, AC_HELP_STRING([--with-store-dir=PATH],
storedir=$withval, storedir='${prefix}/store')
AC_SUBST(storedir)
AC_ARG_WITH(store-state-dir, AC_HELP_STRING([--with-store-state-dir=PATH],
[path of the Nix state store]),
storestatedir=$withval, storestatedir='${prefix}/state')
AC_SUBST(storestatedir)
AC_ARG_WITH(store-state-repos-dir, AC_HELP_STRING([--with-store-state-repos-dir=PATH],
[path of the Nix state store repository]),
storestatereposdir=$withval, storestatereposdir='${prefix}/staterepos')
AC_SUBST(storestatereposdir)
AC_ARG_WITH(bdb, AC_HELP_STRING([--with-bdb=PATH],
[prefix of Berkeley DB]),
bdb=$withval, bdb=)
@ -178,6 +188,12 @@ fi
AC_SUBST(bdb_lib)
AC_SUBST(bdb_include)
NEED_PROG(svn, svn)
AC_ARG_WITH(svn-bin, AC_HELP_STRING([--with-svn-bin=PATH],
[path of svn, svnadmin]),
subversion=$withval, subversion=$(dirname $svn))
AC_SUBST(subversion)
AC_ARG_WITH(aterm, AC_HELP_STRING([--with-aterm=PATH],
[prefix of CWI ATerm library]),
aterm=$withval, aterm=)

View File

@ -1,6 +1,10 @@
#! /bin/sh -e
export nixstatepath=/nixstate/nix
export ACLOCAL_PATH=/root/.nix-profile/share/aclocal
if [ "$1" = "full" ]; then
nix-env-all-pkgs.sh -i gnum4
nix-env-all-pkgs.sh -i autoconf
nix-env-all-pkgs.sh -i automake
nix-env-all-pkgs.sh -i gnused
@ -16,10 +20,19 @@ if [ "$1" = "full" ]; then
nix-env-all-pkgs.sh -i gdb #optional for debugging
fi
export nixstatepath=/nixstate/nix
export ACLOCAL_PATH=/root/.nix-profile/share/aclocal
if [ "$1" = "full" ] || [ "$1" = "auto" ]; then
export AUTOCONF=autoconf
export AUTOHEADER=autoheader
export AUTOMAKE=automake
autoconf
autoreconf -f
aclocal
autoheader
automake
fi
./bootstrap.sh
./configure --with-aterm=$HOME/.nix-profile \
--with-bzip2=$HOME/.nix-profile \
--with-bdb=$HOME/.nix-profile \
@ -28,8 +41,12 @@ export ACLOCAL_PATH=/root/.nix-profile/share/aclocal
--with-docbook-xsl=/root/.nix-profile/xml/xsl/docbook \
--prefix=$nixstatepath \
--with-store-dir=/nix/store \
--with-store-state-dir=/nix/state \
--with-store-state-repos-dir=/nix/staterepos \
--localstatedir=/nix/var
#Options from the nix expr
#--disable-init-state
#--with-store-dir=/nix/store
@ -44,7 +61,7 @@ echo "New state nix version by wouter ..." > doc/manual/NEWS.txt
make
make install
for i in $nixstatepath/bin/*; do
echo "pathing $i"
patchelf --set-rpath ../lib/nix/:$(patchelf --print-rpath $i) $i
done
#for i in $nixstatepath/bin/*; do
# echo "pathing $i"
# patchelf --set-rpath ../lib/nix/:$(patchelf --print-rpath $i) $i
#done

View File

@ -24,6 +24,12 @@ $storeDir = "@storedir@" unless defined $storeDir;
my $storeStateDir = $ENV{"NIX_STORE_STATE_DIR"};
$storeStateDir = "@storestatedir@" unless defined $storeStateDir;
my $storeStateReposDir = $ENV{"NIX_STORE_STATE_REPOS_DIR"};
$storeStateReposDir = "@storestatereposdir@" unless defined $storeStateReposDir;
my $subversion = $ENV{"NIX_SVN_BIN_DIR"};
$subversion = "@subversion@" unless defined $subversion;
# Prevent access problems in shared-stored installations.
umask 0022;

View File

@ -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. */

View File

@ -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\" \

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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. */

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
#define __UTIL_H
#include "types.hh"
#include "../libstore/derivations.hh"
#include "derivations.hh"
#include <sys/types.h>
#include <dirent.h>

View File

@ -7,6 +7,7 @@ if ! NIX_STORE_DIR=$(readlink -f $TEST_ROOT/store); then
export NIX_IGNORE_SYMLINK_STORE=1
NIX_STORE_DIR=$TEST_ROOT/store
fi
export NIX_STORE_STATE_DIR=$TEST_ROOT/state
export NIX_DATA_DIR=$TEST_ROOT/data
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix

View File

@ -10,6 +10,7 @@ fi
mkdir "$TEST_ROOT"
mkdir "$NIX_STORE_DIR"
mkdir "$NIX_STORE_STATE_DIR"
mkdir "$NIX_DATA_DIR"
mkdir "$NIX_LOCALSTATE_DIR"
mkdir -p "$NIX_LOG_DIR"/drvs
@ -19,6 +20,7 @@ mkdir "$NIX_CONF_DIR"
mkdir $NIX_BIN_DIR
ln -s $nixstore $NIX_BIN_DIR/
ln -s $storestatedir $NIX_BIN_DIR/
ln -s $nixinstantiate $NIX_BIN_DIR/
ln -s $nixhash $NIX_BIN_DIR/
ln -s $nixenv $NIX_BIN_DIR/