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