mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 04:00:59 +01:00
Fixed ugly '--hello' exception in builder.pl
This commit is contained in:
parent
5a9cfdeb6e
commit
53c907ca09
3 changed files with 11 additions and 27 deletions
|
|
@ -116,22 +116,9 @@ sub createLinks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# if only my GF were this dirty ...
|
|
||||||
# TODO ...
|
|
||||||
sysopen (DSTFILEHANDLE, $new_dstFile, O_RDWR|O_EXCL|O_CREAT, 0755);
|
sysopen (DSTFILEHANDLE, $new_dstFile, O_RDWR|O_EXCL|O_CREAT, 0755);
|
||||||
printf DSTFILEHANDLE "#! @shell@ \n";
|
printf DSTFILEHANDLE "#! @shell@ \n";
|
||||||
printf DSTFILEHANDLE "args2=( ) \n";
|
printf DSTFILEHANDLE "/nixstate/nix/bin/nix-state --run --identifier=$new_stateIdentifier $srcFile \"\$@\" \n"; #TODO !!!!!!!!!! fix hard link
|
||||||
printf DSTFILEHANDLE "for arg in \"\$@\" \n";
|
|
||||||
printf DSTFILEHANDLE "do \n";
|
|
||||||
printf DSTFILEHANDLE " if [ \"\$arg\" = \"--help\" ]; then \n";
|
|
||||||
printf DSTFILEHANDLE " args2=( \"\${args2[@]}\" \"\\--help\" ) \n";
|
|
||||||
printf DSTFILEHANDLE " elif [ \"\$arg\" = \"--version\" ]; then \n";
|
|
||||||
printf DSTFILEHANDLE " args2=( \"\${args2[@]}\" \"\\--version\" ) \n";
|
|
||||||
printf DSTFILEHANDLE " else \n";
|
|
||||||
printf DSTFILEHANDLE " args2=( \"\${args2[@]}\" \"\$arg\" ) \n";
|
|
||||||
printf DSTFILEHANDLE " fi \n";
|
|
||||||
printf DSTFILEHANDLE "done \n";
|
|
||||||
printf DSTFILEHANDLE "/nixstate/nix/bin/nix-state --run --identifier=$new_stateIdentifier $srcFile \"\${args2[@]}\" \n"; #TODO !!!!!!!!!! fix hard link
|
|
||||||
close (DSTFILEHANDLE);
|
close (DSTFILEHANDLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,13 +170,15 @@ static void initAndRun(int argc, char * * argv)
|
||||||
; /* !!! obsolete - remove eventually */
|
; /* !!! obsolete - remove eventually */
|
||||||
else if (arg == "--no-build-output" || arg == "-Q")
|
else if (arg == "--no-build-output" || arg == "-Q")
|
||||||
buildVerbosity = lvlVomit;
|
buildVerbosity = lvlVomit;
|
||||||
|
|
||||||
|
//we need to push back since arguments need to be passed on in the state wrapper script
|
||||||
else if (arg == "--help") {
|
else if (arg == "--help") {
|
||||||
printHelp();
|
printHelp();
|
||||||
return;
|
remaining.push_back(arg);
|
||||||
}
|
}
|
||||||
else if (arg == "--version") {
|
else if (arg == "--version") {
|
||||||
std::cout << format("%1% (Nix) %2%") % programId % NIX_VERSION << std::endl;
|
std::cout << format("%1% (Nix) %2%") % programId % NIX_VERSION << std::endl;
|
||||||
return;
|
remaining.push_back(arg);
|
||||||
}
|
}
|
||||||
else if (arg == "--keep-failed" || arg == "-K")
|
else if (arg == "--keep-failed" || arg == "-K")
|
||||||
keepFailed = true;
|
keepFailed = true;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,8 @@ bool revert_recursively = false;
|
||||||
|
|
||||||
void printHelp()
|
void printHelp()
|
||||||
{
|
{
|
||||||
cout << string((char *) helpText, sizeof helpText);
|
printMsg(lvlInfo, format("%1%") % helpText);
|
||||||
|
//cout << string((char *) helpText, sizeof helpText);
|
||||||
}
|
}
|
||||||
|
|
||||||
Derivation getDerivation(const string & fullPath, const Strings & program_args, string state_identifier, Path & componentPath, Path & statePath,
|
Derivation getDerivation(const string & fullPath, const Strings & program_args, string state_identifier, Path & componentPath, Path & statePath,
|
||||||
|
|
@ -108,9 +109,6 @@ Derivation getDerivation_andCheckArgs_(Strings opFlags, Strings opArgs, Path & c
|
||||||
opArgs.pop_front();
|
opArgs.pop_front();
|
||||||
for (Strings::iterator i = opArgs.begin(); i != opArgs.end(); ++i){
|
for (Strings::iterator i = opArgs.begin(); i != opArgs.end(); ++i){
|
||||||
string arg = *i;
|
string arg = *i;
|
||||||
if(arg == "\\--help" || arg == "\\--version")
|
|
||||||
arg = arg.substr(1, arg.length());
|
|
||||||
|
|
||||||
//printMsg(lvlError, format("Args: %1%") % arg);
|
//printMsg(lvlError, format("Args: %1%") % arg);
|
||||||
program_args.push_back(arg);
|
program_args.push_back(arg);
|
||||||
}
|
}
|
||||||
|
|
@ -499,16 +497,13 @@ static void opRunComponent(Strings opFlags, Strings opArgs)
|
||||||
|
|
||||||
string root_args = "";
|
string root_args = "";
|
||||||
for (Strings::iterator i = root_program_args.begin(); i != root_program_args.end(); ++i){
|
for (Strings::iterator i = root_program_args.begin(); i != root_program_args.end(); ++i){
|
||||||
|
if(*i == "--help" || *i == "--version")
|
||||||
if(*i == "--help")
|
printMsg(lvlError, format("%1%") % padd("", '-', 100));
|
||||||
printMsg(lvlInfo, format("%1%\n------------------------------------------------------------") % helpText);
|
//printMsg(lvlError, format("ARG %1%") % *i);
|
||||||
if(*i == "--version")
|
|
||||||
printMsg(lvlInfo, format("%1% (Nix) %2%\n------------------------------------------------------------") % programId % NIX_VERSION );
|
|
||||||
|
|
||||||
root_args += " \"" + *i + "\"";
|
root_args += " \"" + *i + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
//printMsg(lvlError, format("Command: '%1%'") % (root_componentPath + root_binary + root_args));
|
printMsg(lvlError, format("Command: '%1%'") % (root_componentPath + root_binary + root_args));
|
||||||
executeShellCommand(root_componentPath + root_binary + root_args);
|
executeShellCommand(root_componentPath + root_binary + root_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue