diff --git a/src/laminar.cpp b/src/laminar.cpp index 4923c4c..8337978 100644 --- a/src/laminar.cpp +++ b/src/laminar.cpp @@ -104,15 +104,14 @@ bool Laminar::setParam(std::string job, int buildNum, std::string param, std::st void Laminar::populateArtifacts(Json &j, std::string job, int num) const { fs::path dir(fs::path(homeDir)/"archive"/job/std::to_string(num)); if(fs::is_directory(dir)) { - fs::recursive_directory_iterator rdt(dir); int prefixLen = (fs::path(homeDir)/"archive").string().length(); int scopeLen = dir.string().length(); - for(fs::directory_entry e : rdt) { - if(!fs::is_regular_file(e)) + for(fs::recursive_directory_iterator it(dir); it != fs::recursive_directory_iterator(); ++it) { + if(!fs::is_regular_file(*it)) continue; j.StartObject(); - j.set("url", archiveUrl + e.path().string().substr(prefixLen)); - j.set("filename", e.path().string().substr(scopeLen+1)); + j.set("url", archiveUrl + it->path().string().substr(prefixLen)); + j.set("filename", it->path().string().substr(scopeLen+1)); j.EndObject(); } } @@ -330,19 +329,18 @@ bool Laminar::loadConfiguration() { fs::path nodeCfg = fs::path(homeDir)/"cfg"/"nodes"; if(fs::is_directory(nodeCfg)) { - fs::directory_iterator dit(nodeCfg); - for(fs::directory_entry& it : dit) { - if(!fs::is_directory(it.status())) + for(fs::directory_iterator it(nodeCfg); it != fs::directory_iterator(); ++it) { + if(!fs::is_directory(it->status())) continue; - fs::directory_entry config(it.path()/"config"); + fs::directory_entry config(it->path()/"config"); if(!fs::is_regular_file(config.status())) continue; StringMap conf = parseConfFile(config.path().string().c_str()); Node node; - node.name = it.path().filename().string(); + node.name = it->path().filename().string(); node.numExecutors = conf.get("EXECUTORS", 6); std::string tags = conf.get("TAGS"); @@ -371,12 +369,11 @@ bool Laminar::loadConfiguration() { fs::path jobsDir = fs::path(homeDir)/"cfg"/"jobs"; if(fs::is_directory(jobsDir)) { - fs::directory_iterator dit(jobsDir); - for(fs::directory_entry& it : dit) { - if(!fs::is_directory(it.status())) + for(fs::directory_iterator it(jobsDir); it != fs::directory_iterator(); ++it) { + if(!fs::is_directory(it->status())) continue; - fs::directory_entry config(it.path()/"config"); + fs::directory_entry config(it->path()/"config"); if(!fs::is_regular_file(config.status())) continue; @@ -389,7 +386,7 @@ bool Laminar::loadConfiguration() { std::copy(std::istream_iterator(iss), std::istream_iterator(), std::inserter(tagList, tagList.begin())); - jobTags[it.path().filename().string()] = tagList; + jobTags[it->path().filename().string()] = tagList; } } diff --git a/src/laminar.h b/src/laminar.h index d4868f3..925ab94 100644 --- a/src/laminar.h +++ b/src/laminar.h @@ -67,7 +67,7 @@ private: void populateArtifacts(Json& out, std::string job, int num) const; Run* activeRun(std::string name, int num) { - auto it = activeJobs.get<1>().find(std::make_tuple(name, num)); + auto it = activeJobs.get<1>().find(boost::make_tuple(name, num)); return it == activeJobs.get<1>().end() ? nullptr : it->get(); } diff --git a/src/run.h b/src/run.h index 5d6d125..87b9c64 100644 --- a/src/run.h +++ b/src/run.h @@ -107,17 +107,15 @@ private: namespace bmi = boost::multi_index; -struct _same { +struct _run_same { typedef const Run* result_type; const Run* operator()(const std::shared_ptr& run) const { return run.get(); } }; -struct RunSet: public boost::multi_index_container< - std::shared_ptr, - // A single Run can be fetched by... - bmi::indexed_by< +// A single Run can be fetched by... +struct _run_index : bmi::indexed_by< // their current running pid bmi::hashed_unique>, bmi::hashed_unique >>, // or a pointer to a Run object. - bmi::hashed_unique<_same>, + bmi::hashed_unique<_run_same>, // A group of Runs can be fetched by the time they started bmi::ordered_non_unique>, // or by their job name bmi::ordered_non_unique> > +{}; + +struct RunSet: public boost::multi_index_container< + std::shared_ptr, + _run_index > { // TODO: getters for each index };