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

Removed collision-bug between repositorys, each group of repositorys and each individual repository has now a scannable unique hash

This commit is contained in:
Wouter den Breejen 2007-06-07 14:08:57 +00:00
parent 79d5604780
commit 01062b0563
7 changed files with 30 additions and 21 deletions

View file

@ -19,7 +19,6 @@ string nixSVNPath = "/UNINIT";
string nixConfDir = "/UNINIT";
string nixLibexecDir = "/UNINIT";
string nixBinDir = "/UNINIT";
string stateRootRepos = "root_repos/";
bool keepFailed = false;
bool keepGoing = false;

View file

@ -75,9 +75,6 @@ extern string thisSystem;
infinity. */
extern unsigned int maxSilentTime;
//TODO
extern string stateRootRepos;
Strings querySetting(const string & name, const Strings & def);
string querySetting(const string & name, const string & def);

View file

@ -31,14 +31,14 @@ bool isStorePath(const Path & path)
void assertStorePath(const Path & path)
{
if (!isStorePath(path))
throw Error(format("path `%1%' is not in the Nix store") % path); //TODO bug: this prints an empty path ...
throw Error(format("path `%1%' is not in the Nix store (1)") % path); //TODO bug: this prints an empty path ...
}
Path toStorePath(const Path & path)
{
if (!isInStore(path))
throw Error(format("path `%1%' is not in the Nix store") % path);
throw Error(format("path `%1%' is not in the Nix store (2)") % path);
Path::size_type slash = path.find('/', nixStore.size() + 1);
if (slash == Path::npos)
return path;
@ -102,10 +102,12 @@ Path makeStateReposPath(const string & type, const Path statePath, const string
//This is a little trick: we could use the same hash as the statepath, but we change it so the repository also gets a unique scannable hash
Hash hash = hashString(htSHA256, statePath);
//A little tick again, we dont want to add other repositorys in the root repository, so we rename it.
string subfolder_ = subfolder;
if(subfolder == "")
subfolder_ = stateRootRepos;
//We also hash repository subfolders the prevent collisions
if(subfolder.length() == 0)
throw Error(format("Cannot create a repository for a subfolder without a name"));
string hash_subfolder = type + ":sha256:" + printHash(hash) + ":" + subfolder;
string subfolder_ = printHash32(compressHash(hashString(htSHA256, hash_subfolder), 20)) + "-" + subfolder;
string suffix_stateIdentifier = stateIdentifier;
if(suffix_stateIdentifier != "")

View file

@ -22,6 +22,15 @@ void updatedStateDerivation(Path storePath)
//Create new repositorys, or use existing...
//createStateDirs already does that ...
printMsg(lvlError, format("Resetting state drv settings like repositorys"));
//Create a repository for this state location
//string repos = makeStateReposPath("stateOutput:staterepospath", stateDir, thisdir, drvName, stateIdentifier);
//executeAndPrintShellCommand("mkdir -p " + repos, "mkdir");
//executeAndPrintShellCommand(svnadminbin + " create " + repos, "svnadmin"); //TODO create as nixbld.nixbld chmod 700... can you still commit than ??
}