1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-26 12:10:59 +01:00

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') storedir=$withval, storedir='${prefix}/store')
AC_SUBST(storedir) 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], AC_ARG_WITH(bdb, AC_HELP_STRING([--with-bdb=PATH],
[prefix of Berkeley DB]), [prefix of Berkeley DB]),
bdb=$withval, bdb=) bdb=$withval, bdb=)
@ -178,6 +188,12 @@ fi
AC_SUBST(bdb_lib) AC_SUBST(bdb_lib)
AC_SUBST(bdb_include) 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], AC_ARG_WITH(aterm, AC_HELP_STRING([--with-aterm=PATH],
[prefix of CWI ATerm library]), [prefix of CWI ATerm library]),
aterm=$withval, aterm=) aterm=$withval, aterm=)

View file

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

View file

@ -24,6 +24,12 @@ $storeDir = "@storedir@" unless defined $storeDir;
my $storeStateDir = $ENV{"NIX_STORE_STATE_DIR"}; my $storeStateDir = $ENV{"NIX_STORE_STATE_DIR"};
$storeStateDir = "@storestatedir@" unless defined $storeStateDir; $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. # Prevent access problems in shared-stored installations.
umask 0022; umask 0022;

View file

@ -345,14 +345,6 @@ static Hash hashDerivationModulo(EvalState & state, Derivation drv)
return hashTerm(unparseDerivation(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 /* Construct (as a unobservable side effect) a Nix derivation
expression that performs the derivation described by the argument expression that performs the derivation described by the argument
set. Returns the original set extended with the following 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); drv.outputs["out"] = DerivationOutput(outPath, outputHashAlgo, outputHash);
/* Add the state path based on the outPath */ /* Add the state path based on the outPath */
string callingUser = "wouterdb"; //TODO: Change into variable string callingUser = "wouterdb"; //TODO: Change into variable
string statePrefix = "/nix/state/"; //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); drv.env["statepath"] = stateOutPath;
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;
string enableStateS = "false"; string enableStateS = "false";
if(enableState && disableState == false) if(enableState && disableState == false)
enableStateS = "true"; 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. */ /* Write the resulting term into the Nix store directory. */
Path drvPath = writeDerivation(drv, drvName); 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 /* 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 last slash. Return either a path or a string depending on the type
of the argument. */ of the argument. */

View file

@ -4,6 +4,9 @@ libmain_la_SOURCES = shared.cc shared.hh
AM_CXXFLAGS = \ AM_CXXFLAGS = \
-DNIX_STORE_DIR=\"$(storedir)\" \ -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_DATA_DIR=\"$(datadir)\" \
-DNIX_STATE_DIR=\"$(localstatedir)/nix\" \ -DNIX_STATE_DIR=\"$(localstatedir)/nix\" \
-DNIX_LOG_DIR=\"$(localstatedir)/log/nix\" \ -DNIX_LOG_DIR=\"$(localstatedir)/log/nix\" \

View file

@ -87,11 +87,13 @@ static void initAndRun(int argc, char * * argv)
{ {
/* Setup Nix paths. */ /* Setup Nix paths. */
nixStore = canonPath(getEnv("NIX_STORE_DIR", getEnv("NIX_STORE", NIX_STORE_DIR))); 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)); nixDataDir = canonPath(getEnv("NIX_DATA_DIR", NIX_DATA_DIR));
nixLogDir = canonPath(getEnv("NIX_LOG_DIR", NIX_LOG_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"); 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)); nixConfDir = canonPath(getEnv("NIX_CONF_DIR", NIX_CONF_DIR));
nixLibexecDir = canonPath(getEnv("NIX_LIBEXEC_DIR", NIX_LIBEXEC_DIR)); nixLibexecDir = canonPath(getEnv("NIX_LIBEXEC_DIR", NIX_LIBEXEC_DIR));
nixBinDir = canonPath(getEnv("NIX_BIN_DIR", NIX_BIN_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 \ globals.hh db.hh references.hh pathlocks.hh \
worker-protocol.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 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 ATermList | ATerm | DerivationInput |
| string string string string | ATerm | DerivationOutput | | string string string string | ATerm | DerivationOutput |
| string string string string string string string | ATerm | DerivationStateOutput | | 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 | Closure | ATermList ATermList | ATerm | OldClosure |
| string ATermList | ATerm | OldClosureElem | | string ATermList | ATerm | OldClosureElem |

View file

@ -102,8 +102,9 @@ Derivation parseDerivation(ATerm t)
//parse state dirs part //parse state dirs part
for (ATermIterator i(stateOutDirs); i; ++i) { for (ATermIterator i(stateOutDirs); i; ++i) {
ATerm id, path, type, interval; ATerm id, path, type, interval;
if (!matchDerivationStateOutputDir(*i, id, path, type, interval)) if (!matchDerivationStateOutputDir(*i, id, /*path,*/ type, interval))
throwBadDrv(t); throwBadDrv(t);
path = id;
DerivationStateOutputDir stateOutDirs; DerivationStateOutputDir stateOutDirs;
stateOutDirs.path = aterm2String(path); stateOutDirs.path = aterm2String(path);
stateOutDirs.type = aterm2String(type); stateOutDirs.type = aterm2String(type);
@ -175,7 +176,7 @@ ATerm unparseDerivation(const Derivation & drv)
stateOutputDirs = ATinsert(stateOutputDirs, stateOutputDirs = ATinsert(stateOutputDirs,
makeDerivationStateOutputDir( makeDerivationStateOutputDir(
toATerm(i->first), toATerm(i->first),
toATerm(i->second.path), //toATerm(i->second.path),
toATerm(i->second.type), toATerm(i->second.type),
toATerm(i->second.interval) toATerm(i->second.interval)
)); ));

View file

@ -10,10 +10,12 @@ namespace nix {
string nixStore = "/UNINIT"; string nixStore = "/UNINIT";
string nixStoreState = "/UNINIT"; string nixStoreState = "/UNINIT";
string nixStoreStateRepos = "/UNINIT";
string nixDataDir = "/UNINIT"; string nixDataDir = "/UNINIT";
string nixLogDir = "/UNINIT"; string nixLogDir = "/UNINIT";
string nixStateDir = "/UNINIT"; string nixStateDir = "/UNINIT";
string nixDBPath = "/UNINIT"; string nixDBPath = "/UNINIT";
string nixSVNPath = "/UNINIT";
string nixConfDir = "/UNINIT"; string nixConfDir = "/UNINIT";
string nixLibexecDir = "/UNINIT"; string nixLibexecDir = "/UNINIT";
string nixBinDir = "/UNINIT"; string nixBinDir = "/UNINIT";

View file

@ -18,12 +18,21 @@ extern string nixDataDir; /* !!! fix */
/* nixLogDir is the directory where we log various operations. */ /* nixLogDir is the directory where we log various operations. */
extern string nixLogDir; 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; 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. */ /* nixDBPath is the path name of our Berkeley DB environment. */
extern string nixDBPath; extern string nixDBPath;
/* nixSVNPath is the path name of our SVN environment. */
extern string nixSVNPath;
/* nixConfDir is the directory where configuration files are /* nixConfDir is the directory where configuration files are
stored. */ stored. */
extern string nixConfDir; extern string nixConfDir;
@ -35,7 +44,6 @@ extern string nixLibexecDir;
/* nixBinDir is the directory where the main programs are stored. */ /* nixBinDir is the directory where the main programs are stored. */
extern string nixBinDir; extern string nixBinDir;
/* Misc. global flags. */ /* Misc. global flags. */
/* Whether to keep temporary directories of failed builds. */ /* 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) + ":" string s = type + ":sha256:" + printHash(hash) + ":"
+ nixStoreState + ":" + suffix; + nixStoreState + ":" + suffix;
checkStoreName(suffix); checkStoreName(suffix); //should this be here?
return nixStoreState + "/" return nixStoreState + "/"
+ printHash32(compressHash(hashString(htSHA256, s), 20)) + printHash32(compressHash(hashString(htSHA256, s), 20))

View file

@ -204,6 +204,9 @@ Path makeStorePath(const string & type,
Path makeFixedOutputPath(bool recursive, Path makeFixedOutputPath(bool recursive,
string hashAlgo, Hash hash, string name); 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(); /* 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.

View file

@ -3,7 +3,7 @@ pkglib_LTLIBRARIES = libutil.la
libutil_la_SOURCES = util.cc hash.cc serialise.cc \ libutil_la_SOURCES = util.cc hash.cc serialise.cc \
archive.cc aterm.cc aterm-map.cc xml-writer.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 \ pkginclude_HEADERS = util.hh hash.hh serialise.hh \
archive.hh aterm.hh aterm-map.hh xml-writer.hh types.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 md5.c md5.h sha1.c sha1.h sha256.c sha256.h md32_common.h
endif 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 "config.h"
#include "util.hh"
#include "globals.hh"
#include "derivations.hh"
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#include <windows.h> #include <windows.h>
#endif #endif
@ -14,9 +18,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
#include "util.hh"
#include "../libstore/derivations.hh"
extern char * * environ; extern char * * environ;
@ -371,6 +372,10 @@ Path createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
} }
sort(stateDirsVector.begin(), stateDirsVector.end()); 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) for (vector<DerivationStateOutputDir>::iterator i = stateDirsVector.begin(); i != stateDirsVector.end(); ++i)
{ {
DerivationStateOutputDir d = *(i); DerivationStateOutputDir d = *(i);

View file

@ -2,7 +2,7 @@
#define __UTIL_H #define __UTIL_H
#include "types.hh" #include "types.hh"
#include "../libstore/derivations.hh" #include "derivations.hh"
#include <sys/types.h> #include <sys/types.h>
#include <dirent.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 export NIX_IGNORE_SYMLINK_STORE=1
NIX_STORE_DIR=$TEST_ROOT/store NIX_STORE_DIR=$TEST_ROOT/store
fi fi
export NIX_STORE_STATE_DIR=$TEST_ROOT/state
export NIX_DATA_DIR=$TEST_ROOT/data export NIX_DATA_DIR=$TEST_ROOT/data
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix export NIX_LOG_DIR=$TEST_ROOT/var/log/nix

View file

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