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

Fixed a bug in the auto-deleted-checkout part of the commit bash script, Had to use a hack to get bash to support 2D arrays....

This commit is contained in:
Wouter den Breejen 2007-06-07 18:39:22 +00:00
parent 01062b0563
commit 255bf5f04b
3 changed files with 36 additions and 12 deletions

View file

@ -95,8 +95,8 @@ function subversionSingleStateDir {
for item in ${subitems[@]} for item in ${subitems[@]}
do do
if test -d $item; then #add or go recursive subitems if test -d $item; then #add or go recursive subitems
$debug svn -N add $item #NON recursively add the dir $debug svn -N add $item #NON recursively add the dir
subversionSingleStateDir $item subversionSingleStateDir $item
else else
$debug svn add $item $debug svn add $item
@ -116,9 +116,20 @@ do
if test -d $path; then #if the dir doesnt exist, than we dont hav to do anything if test -d $path; then #if the dir doesnt exist, than we dont hav to do anything
cd $path; cd $path;
output=$($svnbin stat 2>&1 | grep "is not a working copy"); #HACK: I cant seem to find a way for bash to parse a 2 dimensional string array as argument, so we use a 1-d array with '|' as seperator
if [ "$output" != "" ] ; then #if the dir exists but is not yet an svn dir: checkout repos, if it doenst exits (is removed or something) than we dont do anything if ! test -d $path/.svn/; then #if the dir exists but is not yet an svn dir: checkout repos, if it doenst exits (is removed or something) than we dont do anything
$debug ${checkouts[$i]}; checkoutcommand="";
while true; do
if [ "${checkouts[$i]}" = "|" ]; then
break
let "i+=1"
fi
checkoutcommand="${checkoutcommand} ${checkouts[$i]}";
let "i+=1"
done
#echo $checkoutcommand;
$debug $checkoutcommand;
fi fi
if [ "${subversionedpathsCommitBools[$i]}" = "true" ]; then #Check if we need to commit this folder if [ "${subversionedpathsCommitBools[$i]}" = "true" ]; then #Check if we need to commit this folder
@ -133,7 +144,6 @@ do
cd - &> /dev/null; cd - &> /dev/null;
fi fi
let "i+=1"
done done

View file

@ -22,19 +22,19 @@ void updatedStateDerivation(Path storePath)
//Create new repositorys, or use existing... //Create new repositorys, or use existing...
//createStateDirs already does that ... //createStateDirs already does that ...
printMsg(lvlError, format("Resetting state drv settings like repositorys")); printMsg(lvlError, format("Resetting state drv settings like repositorys"));
//Create a repository for this state location //Create a repository for this state location
//string repos = makeStateReposPath("stateOutput:staterepospath", stateDir, thisdir, drvName, stateIdentifier); //string repos = makeStateReposPath("stateOutput:staterepospath", stateDir, thisdir, drvName, stateIdentifier);
//executeAndPrintShellCommand("mkdir -p " + repos, "mkdir"); //executeAndPrintShellCommand("mkdir -p " + repos, "mkdir");
//executeAndPrintShellCommand(svnadminbin + " create " + repos, "svnadmin"); //TODO create as nixbld.nixbld chmod 700... can you still commit than ?? //executeAndPrintShellCommand(svnadminbin + " create " + repos, "svnadmin"); //TODO create as nixbld.nixbld chmod 700... can you still commit than ??
//createStateDirs
} }
void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const DerivationStateOutputs & stateOutputs, const StringPairs & env) void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const DerivationStateOutputs & stateOutputs, const StringPairs & env)
{ {
Path statePath = stateOutputs.find("state")->second.statepath; Path statePath = stateOutputs.find("state")->second.statepath;
@ -69,6 +69,7 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
string repos = makeStateReposPath("stateOutput:staterepospath", stateDir, thisdir, drvName, stateIdentifier); string repos = makeStateReposPath("stateOutput:staterepospath", stateDir, thisdir, drvName, stateIdentifier);
executeAndPrintShellCommand("mkdir -p " + repos, "mkdir"); executeAndPrintShellCommand("mkdir -p " + repos, "mkdir");
executeAndPrintShellCommand(svnadminbin + " create " + repos, "svnadmin"); //TODO create as nixbld.nixbld chmod 700... can you still commit than ?? executeAndPrintShellCommand(svnadminbin + " create " + repos, "svnadmin"); //TODO create as nixbld.nixbld chmod 700... can you still commit than ??
// //TODO Check if repos already exitst?
if(d.type == "interval"){ if(d.type == "interval"){
intervalPaths.insert(statePath); intervalPaths.insert(statePath);
@ -88,4 +89,5 @@ void createStateDirs(const DerivationStateOutputDirs & stateOutputDirs, const De
} }
} }

View file

@ -19,6 +19,15 @@ using std::cout;
typedef void (* Operation) (Strings opFlags, Strings opArgs); typedef void (* Operation) (Strings opFlags, Strings opArgs);
/************************* Build time Functions ******************************/
/************************* Build time Functions ******************************/
void printHelp() void printHelp()
{ {
cout << string((char *) helpText, sizeof helpText); cout << string((char *) helpText, sizeof helpText);
@ -167,7 +176,9 @@ static void opRunComponent(Strings opFlags, Strings opArgs)
string fullstatedir = statePath + "/" + thisdir; string fullstatedir = statePath + "/" + thisdir;
if(thisdir == "/") //exception for the root dir if(thisdir == "/") //exception for the root dir
fullstatedir = statePath + "/"; fullstatedir = statePath + "/";
Path statePath = fullstatedir; //TODO call coerce function
//Path fullStatePath = fullstatedir; //TODO call coerce function //TODO REMOVE?
if(d.type == "none"){ if(d.type == "none"){
nonversionedpaths.push_back(fullstatedir); nonversionedpaths.push_back(fullstatedir);
@ -221,7 +232,8 @@ static void opRunComponent(Strings opFlags, Strings opArgs)
string commandsarray; string commandsarray;
for (vector<string>::iterator i = checkoutcommands.begin(); i != checkoutcommands.end(); ++i) for (vector<string>::iterator i = checkoutcommands.begin(); i != checkoutcommands.end(); ++i)
{ {
commandsarray += "\\\"" + *(i) + "\\\" "; //#HACK: I cant seem to find a way for bash to parse a 2 dimensional string array as argument, so we use a 1-d array with '|' as seperator
commandsarray += "" + *(i) + " | ";
} }
//make the call //make the call