mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 12:10:59 +01:00
Repositorys are created, state dirs are checked out automatically
This commit is contained in:
parent
3fc0b0da58
commit
5cac336820
6 changed files with 11 additions and 76 deletions
|
|
@ -2,12 +2,12 @@ pkglib_LTLIBRARIES = libstore.la
|
|||
|
||||
libstore_la_SOURCES = \
|
||||
store-api.cc local-store.cc remote-store.cc derivations.cc build.cc misc.cc \
|
||||
globals.cc db.cc references.cc pathlocks.cc gc.cc
|
||||
globals.cc db.cc references.cc pathlocks.cc gc.cc store-state.cc
|
||||
|
||||
pkginclude_HEADERS = \
|
||||
store-api.hh local-store.hh remote-store.hh derivations.hh misc.hh \
|
||||
globals.hh db.hh references.hh pathlocks.hh \
|
||||
worker-protocol.hh
|
||||
worker-protocol.hh store-state.hh
|
||||
|
||||
libstore_la_LIBADD = ../libutil/libutil.la \
|
||||
../boost/format/libformat.la
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include "local-store.hh"
|
||||
#include "db.hh"
|
||||
#include "util.hh"
|
||||
#include "store-state.hh"
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
|
|
@ -1375,6 +1377,7 @@ void DerivationGoal::startBuilder()
|
|||
tmpDir = createTempDir();
|
||||
|
||||
/* Create the state directory where the component can store it's state files place */
|
||||
//TODO
|
||||
stateDir = createStateDirs(drv.stateOutputDirs, drv.stateOutputs);
|
||||
|
||||
//TODO create the startupscript
|
||||
|
|
|
|||
|
|
@ -41,10 +41,11 @@ struct DerivationStateOutput
|
|||
string enabled;
|
||||
string shared;
|
||||
string synchronization;
|
||||
string createStateDirsBeforeInstall;
|
||||
DerivationStateOutput()
|
||||
{
|
||||
}
|
||||
DerivationStateOutput(Path statepath, string hashAlgo, string hash, string enabled, string shared, string synchronization)
|
||||
DerivationStateOutput(Path statepath, string hashAlgo, string hash, string enabled, string shared, string synchronization, string createStateDirsBeforeInstall)
|
||||
{
|
||||
this->statepath = statepath;
|
||||
this->hashAlgo = hashAlgo;
|
||||
|
|
@ -52,6 +53,7 @@ struct DerivationStateOutput
|
|||
this->enabled = enabled;
|
||||
this->shared = shared;
|
||||
this->synchronization = synchronization;
|
||||
this->createStateDirsBeforeInstall = createStateDirsBeforeInstall;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -71,9 +73,6 @@ struct DerivationStateOutputDir
|
|||
}
|
||||
|
||||
//sort function
|
||||
/*bool operator<(const DerivationStateOutputDir& a, const DerivationStateOutputDir& b) {
|
||||
return a.path < b.path;
|
||||
} */
|
||||
bool operator<(const DerivationStateOutputDir& a) const { return path < a.path; }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,17 +3,16 @@ 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 = ../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
|
||||
|
||||
libutil_la_LIBADD = ../boost/format/libformat.la
|
||||
|
||||
if !HAVE_OPENSSL
|
||||
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} -I$(srcdir)/../libstore
|
||||
|
||||
-I$(srcdir)/.. ${aterm_include}
|
||||
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "util.hh"
|
||||
#include "globals.hh"
|
||||
#include "derivations.hh"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#include <windows.h>
|
||||
|
|
@ -349,66 +347,6 @@ Path createTempDir(const Path & tmpRoot)
|
|||
}
|
||||
}
|
||||
|
||||
//TODO include rights, variable svn ... ?
|
||||
Path createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const DerivationStateOutputs & stateOutputs)
|
||||
{
|
||||
/*while (1) {
|
||||
checkInterrupt();
|
||||
if (mkdir(statePath.c_str(), 0777) == 0) {
|
||||
if (chown(statePath.c_str(), (uid_t) -1, getegid()) != 0)
|
||||
throw SysError(format("setting group of state directory `%1%'") % statePath);
|
||||
return tmpDir;
|
||||
}
|
||||
if (errno != EEXIST)
|
||||
throw SysError(format("creating state directory `%1%'") % statePath);
|
||||
}*/
|
||||
|
||||
string stateDir = stateOutputs.find("state")->second.statepath;
|
||||
|
||||
//Convert the map into a sortable vector
|
||||
vector<DerivationStateOutputDir> stateDirsVector;
|
||||
for (DerivationStateOutputDirs::const_reverse_iterator i = stateOutputDirs.rbegin(); i != stateOutputDirs.rend(); ++i){
|
||||
stateDirsVector.push_back(i->second);
|
||||
}
|
||||
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);
|
||||
printMsg(lvlError, format("test `%1%'") % d.path);
|
||||
|
||||
//calc create repos for this state location
|
||||
Hash hash = hashString(htSHA256, stateDir + d.path);
|
||||
|
||||
/*
|
||||
cd ...
|
||||
svnadmin create hashcode
|
||||
|
||||
//create dirs
|
||||
svn checkout file:///nix/state/XXXX/PATH_TO_REPOS dir
|
||||
chmod ....
|
||||
chmod ....
|
||||
|
||||
//create commit script
|
||||
svn add *
|
||||
svn revert file-that-I-do-not-want-added another-file-not-to-add
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
//create super commit script
|
||||
|
||||
|
||||
//return root path
|
||||
Path tmpDir;
|
||||
return tmpDir;
|
||||
}
|
||||
|
||||
|
||||
void createDirs(const Path & path)
|
||||
{
|
||||
if (path == "/") return;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#define __UTIL_H
|
||||
|
||||
#include "types.hh"
|
||||
#include "derivations.hh"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
|
@ -73,9 +72,6 @@ void makePathReadOnly(const Path & path);
|
|||
/* Create a temporary directory. */
|
||||
Path createTempDir(const Path & tmpRoot = "");
|
||||
|
||||
/* Create a state directory. */
|
||||
Path createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const DerivationStateOutputs & stateOutputs);
|
||||
|
||||
/* Create a directory and all its parents, if necessary. */
|
||||
void createDirs(const Path & path);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue