| 385 | } |
| 386 | |
| 387 | ComponentContainer ComponentUpdateTask::collectTreeLinked(const QString& uid) |
| 388 | { |
| 389 | ComponentContainer linked; |
| 390 | |
| 391 | auto& components = d->m_profile->d->components; |
| 392 | auto& componentIndex = d->m_profile->d->componentIndex; |
| 393 | auto& instance = d->m_profile->d->m_instance; |
| 394 | for (auto comp : components) { |
| 395 | qCDebug(instanceProfileResolveC) << instance->name() << "|" |
| 396 | << "scanning" << comp->getID() << ":" << comp->getVersion() << "for tree link"; |
| 397 | auto dep = std::find_if(comp->m_cachedRequires.cbegin(), comp->m_cachedRequires.cend(), |
| 398 | [uid](const Meta::Require& req) -> bool { return req.uid == uid; }); |
| 399 | if (dep != comp->m_cachedRequires.cend()) { |
| 400 | qCDebug(instanceProfileResolveC) << instance->name() << "|" << comp->getID() << ":" << comp->getVersion() << "depends on" |
| 401 | << uid; |
| 402 | linked.append(comp); |
| 403 | } |
| 404 | } |
| 405 | auto iter = componentIndex.find(uid); |
| 406 | if (iter != componentIndex.end()) { |
| 407 | ComponentPtr comp = *iter; |
| 408 | comp->updateCachedData(); |
| 409 | qCDebug(instanceProfileResolveC) << instance->name() << "|" << comp->getID() << ":" << comp->getVersion() << "has" |
| 410 | << comp->m_cachedRequires.size() << "dependencies"; |
| 411 | for (auto dep : comp->m_cachedRequires) { |
| 412 | qCDebug(instanceProfileC) << instance->name() << "|" << uid << "depends on" << dep.uid; |
| 413 | auto found = componentIndex.find(dep.uid); |
| 414 | if (found != componentIndex.end()) { |
| 415 | qCDebug(instanceProfileC) << instance->name() << "|" << (*found)->getID() << "is present"; |
| 416 | linked.append(*found); |
| 417 | } |
| 418 | } |
| 419 | } |
| 420 | return linked; |
| 421 | } |
| 422 | |
| 423 | // FIXME, TODO: decouple dependency resolution from loading |
| 424 | // FIXME: This works directly with the PackProfile internals. It shouldn't! It needs richer data types than PackProfile uses. |
nothing calls this directly
no test coverage detected