* 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 */
| 408 | * toChange - set of requirements that mean changing version of an existing component |
| 409 | */ |
| 410 | static bool getTrivialComponentChanges(const ComponentIndex & index, const RequireExSet & input, RequireExSet & toAdd, RequireExSet & toChange) |
| 411 | { |
| 412 | enum class Decision |
| 413 | { |
| 414 | Undetermined, |
| 415 | Met, |
| 416 | Missing, |
| 417 | VersionNotSame, |
| 418 | LockedVersionNotSame |
| 419 | } decision = Decision::Undetermined; |
| 420 | |
| 421 | QString reqStr; |
| 422 | bool succeeded = true; |
| 423 | // list the composed requirements and say if they are met or unmet |
| 424 | for(auto & req: input) |
| 425 | { |
| 426 | do |
| 427 | { |
| 428 | if(req.equalsVersion.isEmpty()) |
| 429 | { |
| 430 | reqStr = QString("Req: %1").arg(req.uid); |
| 431 | if(index.contains(req.uid)) |
| 432 | { |
| 433 | decision = Decision::Met; |
| 434 | } |
| 435 | else |
| 436 | { |
| 437 | toAdd.insert(req); |
| 438 | decision = Decision::Missing; |
| 439 | } |
| 440 | break; |
| 441 | } |
| 442 | else |
| 443 | { |
| 444 | reqStr = QString("Req: %1 == %2").arg(req.uid, req.equalsVersion); |
| 445 | const auto & compIter = index.find(req.uid); |
| 446 | if(compIter == index.cend()) |
| 447 | { |
| 448 | toAdd.insert(req); |
| 449 | decision = Decision::Missing; |
| 450 | break; |
| 451 | } |
| 452 | auto & comp = (*compIter); |
| 453 | if(comp->getVersion() != req.equalsVersion) |
| 454 | { |
| 455 | if(comp->isCustom()) { |
| 456 | decision = Decision::LockedVersionNotSame; |
| 457 | } else { |
| 458 | if(comp->m_dependencyOnly) |
| 459 | { |
| 460 | decision = Decision::VersionNotSame; |
| 461 | } |
| 462 | else |
| 463 | { |
| 464 | decision = Decision::LockedVersionNotSame; |
| 465 | } |
| 466 | } |
| 467 | break; |
no test coverage detected