1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2024-10-27 20:34:20 +00:00

use shorter build vars in traditional style

This commit is contained in:
Oliver Giles 2017-08-16 08:24:06 +03:00
parent 2dac3e324b
commit 636dfb8651
2 changed files with 12 additions and 12 deletions

View File

@ -38,8 +38,8 @@ static int setParams(int argc, char** argv, T& request) {
int argsConsumed = n; int argsConsumed = n;
char* job = getenv("lJobName"); char* job = getenv("JOB");
char* num = getenv("lBuildNum"); char* num = getenv("RUN");
char* reason = getenv("LAMINAR_REASON"); char* reason = getenv("LAMINAR_REASON");
if(job && num) n+=2; if(job && num) n+=2;
@ -134,8 +134,8 @@ int main(int argc, char** argv) {
} }
auto req = laminar.setRequest(); auto req = laminar.setRequest();
char* eq = strchr(argv[2], '='); char* eq = strchr(argv[2], '=');
char* job = getenv("lJobName"); char* job = getenv("JOB");
char* num = getenv("lBuildNum"); char* num = getenv("RUN");
if(job && num && eq) { if(job && num && eq) {
char* name = argv[2]; char* name = argv[2];
*eq++ = '\0'; *eq++ = '\0';
@ -146,7 +146,7 @@ int main(int argc, char** argv) {
req.getParam().setValue(val); req.getParam().setValue(val);
req.send().wait(waitScope); req.send().wait(waitScope);
} else { } else {
fprintf(stderr, "Missing lJobName and lBuildNum or param is not in the format key=value\n"); fprintf(stderr, "Missing $JOB or $RUN or param is not in the format key=value\n");
return EINVAL; return EINVAL;
} }
} else if(strcmp(argv[1], "lock") == 0) { } else if(strcmp(argv[1], "lock") == 0) {

View File

@ -97,14 +97,14 @@ bool Run::step() {
} }
setenv("PATH", PATH.c_str(), true); setenv("PATH", PATH.c_str(), true);
setenv("lBuildNum", buildNum.c_str(), true); setenv("RUN", buildNum.c_str(), true);
setenv("lJobName", name.c_str(), true); setenv("JOB", name.c_str(), true);
if(!node->name.empty()) if(!node->name.empty())
setenv("lNode", node->name.c_str(), true); setenv("NODE", node->name.c_str(), true);
setenv("lResult", to_string(result).c_str(), true); setenv("RESULT", to_string(result).c_str(), true);
setenv("lLastResult", to_string(lastResult).c_str(), true); setenv("LAST_RESULT", to_string(lastResult).c_str(), true);
setenv("lWorkspace", (fs::path(laminarHome)/"run"/name/"workspace").string().c_str(), true); setenv("WORKSPACE", (fs::path(laminarHome)/"run"/name/"workspace").string().c_str(), true);
setenv("lArchive", (fs::path(laminarHome)/"archive"/name/buildNum.c_str()).string().c_str(), true); setenv("ARCHIVE", (fs::path(laminarHome)/"archive"/name/buildNum.c_str()).string().c_str(), true);
for(auto& pair : params) { for(auto& pair : params) {
setenv(pair.first.c_str(), pair.second.c_str(), false); setenv(pair.first.c_str(), pair.second.c_str(), false);
} }