mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 04:00:59 +01:00
Before trying to install STLdb4 ....
This commit is contained in:
parent
ad2b815b5e
commit
c65c296ce0
5 changed files with 100 additions and 15 deletions
|
|
@ -1642,10 +1642,12 @@ void DerivationGoal::computeClosure()
|
||||||
if(!drv.stateOutputs.find("state")->second.getCreateDirsBeforeInstall())
|
if(!drv.stateOutputs.find("state")->second.getCreateDirsBeforeInstall())
|
||||||
createStateDirs(drv.stateOutputDirs, drv.stateOutputs, drv.env);
|
createStateDirs(drv.stateOutputDirs, drv.stateOutputs, drv.env);
|
||||||
|
|
||||||
|
/*
|
||||||
for (PathSet::iterator i = allPaths.begin(); i != allPaths.end(); ++i)
|
for (PathSet::iterator i = allPaths.begin(); i != allPaths.end(); ++i)
|
||||||
printMsg(lvlError, format("allPaths: %1%") % *i);
|
printMsg(lvlError, format("scanning for allPaths: %1%") % *i);
|
||||||
for (PathSet::iterator i = allStatePaths.begin(); i != allStatePaths.end(); ++i)
|
for (PathSet::iterator i = allStatePaths.begin(); i != allStatePaths.end(); ++i)
|
||||||
printMsg(lvlError, format("allStatePaths: %1%") % *i);
|
printMsg(lvlError, format("scanning for allStatePaths: %1%") % *i);
|
||||||
|
*/
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
|
||||||
|
|
@ -444,5 +444,53 @@ void Database::enumTable(const Transaction & txn, TableId table,
|
||||||
} catch (DbException e) { rethrow(e); }
|
} catch (DbException e) { rethrow(e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Database::setStateReferences(const Transaction & txn, TableId table,
|
||||||
|
const Path & statePath, const int revision, const Strings & references)
|
||||||
|
{
|
||||||
|
//get all previous StateReferences
|
||||||
|
StateReferences newReferences;
|
||||||
|
|
||||||
|
//Merge
|
||||||
|
newReferences[revision] = references;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Insert
|
||||||
|
string data = "";
|
||||||
|
checkInterrupt();
|
||||||
|
try {
|
||||||
|
Db * db = getDb(table);
|
||||||
|
Dbt kt((void *) statePath.c_str(), statePath.length());
|
||||||
|
Dbt dt((void *) data.c_str(), data.length());
|
||||||
|
db->put(txn.txn, &kt, &dt, 0);
|
||||||
|
} catch (DbException e) { rethrow(e); }
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Database::queryStateReferences(const Transaction & txn, TableId table,
|
||||||
|
const Path & statePath, Strings & references, int revision)
|
||||||
|
{
|
||||||
|
//TODO !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Database::setStateRevisions(const Transaction & txn, TableId table,
|
||||||
|
const Path & statePath, const int revision, const RevisionNumbers & revisions)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
bool Database::queryStateRevisions(const Transaction & txn, TableId table,
|
||||||
|
const Path & statePath, RevisionNumbers & revisions, int revision = -1)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return false;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
bool Database::queryAllStateRevisions(const Transaction & txn, TableId table,
|
||||||
|
const Path & statePath, RevisionNumbers & revisions)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,26 @@ public:
|
||||||
|
|
||||||
void enumTable(const Transaction & txn, TableId table,
|
void enumTable(const Transaction & txn, TableId table,
|
||||||
Strings & keys, const string & keyPrefix = "");
|
Strings & keys, const string & keyPrefix = "");
|
||||||
|
|
||||||
|
/* Set the stateReferences for a specific revision (and older until the next higher revision number in the table) */
|
||||||
|
void setStateReferences(const Transaction & txn, TableId table,
|
||||||
|
const Path & statePath, const int revision, const Strings & references);
|
||||||
|
|
||||||
|
/* Returns the references for a specific revision (and older until the next higher revision number in the table) */
|
||||||
|
bool queryStateReferences(const Transaction & txn, TableId table,
|
||||||
|
const Path & statePath, Strings & references, int revision = -1);
|
||||||
|
|
||||||
|
/* Set the revision number of the statePath and the revision numbers of all state paths in the references closure */
|
||||||
|
void setStateRevisions(const Transaction & txn, TableId table,
|
||||||
|
const Path & statePath, const int revision, const RevisionNumbers & revisions);
|
||||||
|
|
||||||
|
/* Returns all the revision numbers of the state references closure of the given state path */
|
||||||
|
//bool queryStateRevisions(const Transaction & txn, TableId table,
|
||||||
|
// const Path & statePath, RevisionNumbers & revisions, int revision = -1);
|
||||||
|
|
||||||
|
/* Returns all available revision numbers of the given state path */
|
||||||
|
bool queryAllStateRevisions(const Transaction & txn, TableId table,
|
||||||
|
const Path & statePath, RevisionNumbers & revisions);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -398,7 +398,12 @@ void setReferences(const Transaction & txn, const Path & store_or_statePath,
|
||||||
if (references.size() > 0 && !isRealisableComponentOrStatePath(txn, store_or_statePath))
|
if (references.size() > 0 && !isRealisableComponentOrStatePath(txn, store_or_statePath))
|
||||||
throw Error(format("cannot set references for path `%1%' which is invalid and has no substitutes") % store_or_statePath);
|
throw Error(format("cannot set references for path `%1%' which is invalid and has no substitutes") % store_or_statePath);
|
||||||
|
|
||||||
//printMsg(lvlError, format("REGISTER: %1%") % store_or_statePath);
|
/*
|
||||||
|
for (PathSet::iterator i = references.begin(); i != references.end(); ++i)
|
||||||
|
printMsg(lvlError, format("'%2%' has references: %1%") % *i % store_or_statePath);
|
||||||
|
for (PathSet::iterator i = stateReferences.begin(); i != stateReferences.end(); ++i)
|
||||||
|
printMsg(lvlError, format("'%2%' has stateReferences: %1%") % *i % store_or_statePath);
|
||||||
|
*/
|
||||||
|
|
||||||
Paths oldReferences;
|
Paths oldReferences;
|
||||||
nixDB.queryStrings(txn, dbReferences, store_or_statePath, oldReferences);
|
nixDB.queryStrings(txn, dbReferences, store_or_statePath, oldReferences);
|
||||||
|
|
@ -446,7 +451,7 @@ void queryReferences(const Transaction & txn,
|
||||||
Paths references2;
|
Paths references2;
|
||||||
|
|
||||||
if (!isRealisableComponentOrStatePath(txn, storePath))
|
if (!isRealisableComponentOrStatePath(txn, storePath))
|
||||||
throw Error(format("path `%1%' is not valid 1") % storePath);
|
throw Error(format("path `%1%' is not valid") % storePath);
|
||||||
nixDB.queryStrings(txn, dbReferences, storePath, references2);
|
nixDB.queryStrings(txn, dbReferences, storePath, references2);
|
||||||
references.insert(references2.begin(), references2.end());
|
references.insert(references2.begin(), references2.end());
|
||||||
}
|
}
|
||||||
|
|
@ -459,19 +464,19 @@ void LocalStore::queryReferences(const Path & storePath,
|
||||||
}
|
}
|
||||||
|
|
||||||
void queryStateReferences(const Transaction & txn,
|
void queryStateReferences(const Transaction & txn,
|
||||||
const Path & storePath, PathSet & stateReferences)
|
const Path & componentOrstatePath, PathSet & stateReferences)
|
||||||
{
|
{
|
||||||
Paths stateReferences2;
|
Paths stateReferences2;
|
||||||
|
|
||||||
if (!isRealisableComponentOrStatePath(txn, storePath))
|
if (!isRealisableComponentOrStatePath(txn, componentOrstatePath))
|
||||||
throw Error(format("path `%1%' is not valid 2") % storePath);
|
throw Error(format("path `%1%' is not valid") % componentOrstatePath);
|
||||||
nixDB.queryStrings(txn, dbStateReferences, storePath, stateReferences2);
|
nixDB.queryStrings(txn, dbStateReferences, componentOrstatePath, stateReferences2);
|
||||||
stateReferences.insert(stateReferences2.begin(), stateReferences2.end());
|
stateReferences.insert(stateReferences2.begin(), stateReferences2.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalStore::queryStateReferences(const Path & storePath, PathSet & stateReferences)
|
void LocalStore::queryStateReferences(const Path & componentOrstatePath, PathSet & stateReferences)
|
||||||
{
|
{
|
||||||
nix::queryStateReferences(noTxn, storePath, stateReferences);
|
nix::queryStateReferences(noTxn, componentOrstatePath, stateReferences);
|
||||||
}
|
}
|
||||||
|
|
||||||
void queryReferrers(const Transaction & txn,
|
void queryReferrers(const Transaction & txn,
|
||||||
|
|
@ -1644,11 +1649,10 @@ void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePa
|
||||||
(remember we need to keep the old as the basis, and things can change, the db is not consistent anymore then ....)
|
(remember we need to keep the old as the basis, and things can change, the db is not consistent anymore then ....)
|
||||||
But we also dont want useless refereces ......
|
But we also dont want useless refereces ......
|
||||||
|
|
||||||
TODO: solution,
|
Update the 2 references tables: all state paths get: Path statepath --> List(int revnumber, List(References))
|
||||||
ALSO:
|
TODO EDIT TABLES references,references_state,referrers,referrers_state
|
||||||
|
|
||||||
Update the 2 references tables:
|
New table stateRevisionClosure: Path StatePath + int revision --> List(int revnumbers)
|
||||||
all state paths get: run number + state references + revision numbers) THIS ONE !!!!!!
|
|
||||||
|
|
||||||
A1(STATEPATH) --> UPDATE ALL STATE REFERENCES IN DB (TRANSACTION)
|
A1(STATEPATH) --> UPDATE ALL STATE REFERENCES IN DB (TRANSACTION)
|
||||||
A2(STATEPATH [+ REV]) --> GIVE ALL STATE REFERENCES IN DB
|
A2(STATEPATH [+ REV]) --> GIVE ALL STATE REFERENCES IN DB
|
||||||
|
|
@ -1658,6 +1662,7 @@ void scanAndUpdateAllReferencesTxn(const Transaction & txn, const Path & statePa
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//update all revision numbers (transaction) NEW FUN THAT UPDATES THE REVISIONS
|
//update all revision numbers (transaction) NEW FUN THAT UPDATES THE REVISIONS
|
||||||
//update all revision numbers + references (transaction)
|
//update all revision numbers + references (transaction)
|
||||||
//update all references
|
//update all references
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
|
@ -15,6 +16,7 @@ namespace nix {
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::list;
|
using std::list;
|
||||||
using std::set;
|
using std::set;
|
||||||
|
using std::map;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using boost::format;
|
using boost::format;
|
||||||
|
|
||||||
|
|
@ -50,12 +52,20 @@ typedef list<string> Strings;
|
||||||
typedef set<string> StringSet;
|
typedef set<string> StringSet;
|
||||||
typedef set<StringSet> SetStringSet;
|
typedef set<StringSet> SetStringSet;
|
||||||
|
|
||||||
|
|
||||||
/* Paths are just strings. */
|
/* Paths are just strings. */
|
||||||
typedef string Path;
|
typedef string Path;
|
||||||
typedef list<Path> Paths;
|
typedef list<Path> Paths;
|
||||||
typedef set<Path> PathSet;
|
typedef set<Path> PathSet;
|
||||||
|
|
||||||
|
//state types
|
||||||
|
struct RevisionNumbersKey { Path statePath; int revision; } ;
|
||||||
|
typedef list<int> RevisionNumbers; //the Strings (list) of StateReferences and this list are connected by position
|
||||||
|
typedef map<int, Strings> StateReferences;
|
||||||
|
|
||||||
|
//typedef std::map<int, Strings> StateReferencesKey;
|
||||||
|
//typedef std::map<int, Strings> StateReferencesKey2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
lvlError,
|
lvlError,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue