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