* handles: * - trivial addition (there is an unmet requirement and it can be trivially met by adding something) * - trivial version conflict of dependencies == explicit version required and installed is different * * toAdd - set of requirements than mean adding a new component * toChange - set of requirements that mean changing version of an existing component */
| 416 | * toChange - set of requirements that mean changing version of an existing component |
| 417 | */ |
| 418 | static bool getTrivialComponentChanges(const ComponentIndex & index, const RequireExSet & input, RequireExSet & toAdd, RequireExSet & toChange) |
| 419 | { |
| 420 | enum class Decision |
| 421 | { |
| 422 | Undetermined, |
| 423 | Met, |
| 424 | Missing, |
| 425 | VersionNotSame, |
| 426 | LockedVersionNotSame |
| 427 | } decision = Decision::Undetermined; |
| 428 | |
| 429 | QString reqStr; |
| 430 | bool succeeded = true; |
| 431 | // list the composed requirements and say if they are met or unmet |
| 432 | for(auto & req: input) |
| 433 | { |
| 434 | do |
| 435 | { |
| 436 | if(req.equalsVersion.isEmpty()) |
| 437 | { |
| 438 | reqStr = QString("Req: %1").arg(req.uid); |
| 439 | if(index.contains(req.uid)) |
| 440 | { |
| 441 | decision = Decision::Met; |
| 442 | } |
| 443 | else |
| 444 | { |
| 445 | toAdd.insert(req); |
| 446 | decision = Decision::Missing; |
| 447 | } |
| 448 | break; |
| 449 | } |
| 450 | else |
| 451 | { |
| 452 | reqStr = QString("Req: %1 == %2").arg(req.uid, req.equalsVersion); |
| 453 | const auto & compIter = index.find(req.uid); |
| 454 | if(compIter == index.cend()) |
| 455 | { |
| 456 | toAdd.insert(req); |
| 457 | decision = Decision::Missing; |
| 458 | break; |
| 459 | } |
| 460 | auto & comp = (*compIter); |
| 461 | if(comp->getVersion() != req.equalsVersion) |
| 462 | { |
| 463 | if(comp->isCustom()) { |
| 464 | decision = Decision::LockedVersionNotSame; |
| 465 | } else { |
| 466 | if(comp->m_dependencyOnly) |
| 467 | { |
| 468 | decision = Decision::VersionNotSame; |
| 469 | } |
| 470 | else |
| 471 | { |
| 472 | decision = Decision::LockedVersionNotSame; |
| 473 | } |
| 474 | } |
| 475 | break; |
no test coverage detected