293{
294
295
296 typedef boost::tokenizer<boost::char_separator<char> > Tokenizer_t;
297 typedef std::vector<fs::path> Paths_t;
298
299 std::set<std::string> dsofiles;
300
301 std::string dsopath = System::getEnv("LD_LIBRARY_PATH");
302 std::string rootsys = System::getEnv("ROOTSYS");
303
304 Tokenizer_t tok(dsopath, boost::char_separator<char>(":"));
305
306 for (Tokenizer_t::iterator itr = tok.begin(), iend = tok.end();
307 itr != iend;
308 ++itr) {
309
310 if (itr->starts_with(rootsys)) {
311 continue;
312 }
314 if (!std::filesystem::exists(*itr)) {
315 continue;
316 }
317 Paths_t dir_content {fs::directory_iterator(p),
318 fs::directory_iterator()};
320 dir_content.end());
321 for (Paths_t::iterator ipath = dir_content.begin(),
322 ipath_end = dir_content.end();
323 ipath != ipath_end;
324 ++ipath) {
325 const fs::path& dsomap = *ipath;
326
327 bool is_components = false;
328 if (dsomap.extension() == Components)
329 is_components = true;
330 else if (dsomap.extension() != RootMap)
331 continue;
332
333 if (!fs::exists(dsomap)) continue;
334
335
336 dsofiles.insert(dsomap.c_str());
337 std::ifstream
f(dsomap.c_str());
338 int line_nbr = -1;
339 std::string lastlib;
340 while (f) {
341 line_nbr += 1;
343 std::getline(f, line);
344 boost::algorithm::trim(line);
345
346 std::string libname;
347 std::string dso_key;
349 continue;
350
351 else if (
line.compare (0, 8,
"Library.")==0) {
353 boost::algorithm::split(ll, line,
354 boost::is_any_of(" "),
355 boost::token_compress_on);
357 std::cerr << "DsoDb:: **error** could not parse "
358 << dsomap << ":" << line_nbr
359 << "\n"
360 << "DsoDb:: (some) reflex-dicts may fail to be autoloaded"
361 << "\n";
362 continue;
363 }
365 if (::is_rootcint_dict(libname)) {
366 continue;
367 }
369 libname = ::getlibname(libname);
370 boost::algorithm::replace_all(dso_key, "Library.", "");
371 boost::algorithm::replace_all(dso_key, ":", "");
372 std::replace(dso_key.begin(), dso_key.end(), '@', ':');
373 std::replace(dso_key.begin(), dso_key.end(), '-', ' ');
374 }
375
376 else if (line[0] == '[') {
377 libname =
line.substr (1,
line.size()-2);
378 boost::algorithm::trim (libname);
379 if (::is_rootcint_dict(libname)) {
380 lastlib.clear();
381 continue;
382 }
383 if (!libname.empty())
384 lastlib = ::getlibname (libname);
385 continue;
386 }
387
388 else if (
line.compare(0, 8,
"# --End ")==0) {
389 lastlib.clear();
390 continue;
391 }
392
393 else if (
line.compare(0, 6,
"class ")==0) {
394 libname = lastlib;
396 dso_key = std::move(line);
397 }
398
399 else if (is_components &&
line.compare(0, 3,
"lib") ==0) {
400 std::string::size_type
pos =
line.find (
':');
401 if (pos == std::string::npos) continue;
402 libname =
line.substr(0, pos);
403 line.erase (0, pos+1);
404 dso_key = std::move(line);
405
406 if (dso_key.compare(0, 6, "_PERS_")==0 ||
407 dso_key.compare(0, 7, "_TRANS_")==0)
408 continue;
409
410 if (libname.find ("AthenaPoolPoolCnv") != std::string::npos)
411 continue;
412 }
413
414 if (libname.empty() || dso_key.empty()) continue;
415
416 const std::string fullpath_libname =
to_string(dsomap.parent_path() / fs::path(libname));
417
418
419
421 if (dso_key.starts_with(PluginNs) || is_components) {
423 } else {
425 }
426 if (
db->find(dso_key) ==
db->end()) {
427 db->insert(std::make_pair(dso_key, Strings_t()));
428 }
429 (*db)[dso_key].push_back(std::move(fullpath_libname));
430 }
431
432 }
433
434 }
435
437 std::copy(dsofiles.begin(), dsofiles.end(), std::back_inserter(
m_dsofiles));
438
439
440 return;
441}
std::unordered_map< std::string, Libs_t > DsoMap_t
const DsoMap_t & db() const
repository of components
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.