|
Lines 404-409
Link Here
|
| 404 |
createNegationImplication(iu, matches, explanation); |
404 |
createNegationImplication(iu, matches, explanation); |
| 405 |
} |
405 |
} |
| 406 |
|
406 |
|
|
|
407 |
private void determinePotentialHostsForFragment(IInstallableUnit iu) { |
| 408 |
// determine matching hosts only for fragments |
| 409 |
if (!(iu instanceof IInstallableUnitFragment)) |
| 410 |
return; |
| 411 |
|
| 412 |
IInstallableUnitFragment fragment = (IInstallableUnitFragment) iu; |
| 413 |
// for each host requirement, find matches and remember them |
| 414 |
for (IRequirement req : fragment.getHost()) { |
| 415 |
List<IInstallableUnit> matches = getApplicableMatches(req); |
| 416 |
rememberHostMatches((IInstallableUnitFragment) iu, matches); |
| 417 |
} |
| 418 |
} |
| 419 |
|
| 407 |
private void expandRequirement(IRequirement req, IInstallableUnit iu, List<AbstractVariable> optionalAbstractRequirements, boolean isRootIu) throws ContradictionException { |
420 |
private void expandRequirement(IRequirement req, IInstallableUnit iu, List<AbstractVariable> optionalAbstractRequirements, boolean isRootIu) throws ContradictionException { |
| 408 |
if (req.getMax() == 0) { |
421 |
if (req.getMax() == 0) { |
| 409 |
expandNegatedRequirement(req, iu, optionalAbstractRequirements, isRootIu); |
422 |
expandNegatedRequirement(req, iu, optionalAbstractRequirements, isRootIu); |
|
Lines 412-420
Link Here
|
| 412 |
if (!isApplicable(req)) |
425 |
if (!isApplicable(req)) |
| 413 |
return; |
426 |
return; |
| 414 |
List<IInstallableUnit> matches = getApplicableMatches(req); |
427 |
List<IInstallableUnit> matches = getApplicableMatches(req); |
| 415 |
if (isHostRequirement(iu, req)) { |
428 |
determinePotentialHostsForFragment(iu); |
| 416 |
rememberHostMatches((IInstallableUnitFragment) iu, matches); |
|
|
| 417 |
} |
| 418 |
if (req.getMin() > 0) { |
429 |
if (req.getMin() > 0) { |
| 419 |
if (matches.isEmpty()) { |
430 |
if (matches.isEmpty()) { |
| 420 |
if (iu == entryPoint && emptyBecauseFiltered) { |
431 |
if (iu == entryPoint && emptyBecauseFiltered) { |
|
Lines 524-541
Link Here
|
| 524 |
} |
535 |
} |
| 525 |
|
536 |
|
| 526 |
private Collection<IRequirement> getRequiredCapabilities(IInstallableUnit iu) { |
537 |
private Collection<IRequirement> getRequiredCapabilities(IInstallableUnit iu) { |
| 527 |
Collection<IRequirement> rqs = iu.getRequirements(); |
538 |
boolean isFragment = iu instanceof IInstallableUnitFragment; |
| 528 |
if (!considerMetaRequirements) |
539 |
//Short-circuit for the case of an IInstallableUnit |
| 529 |
return rqs; |
540 |
if ((!isFragment) && iu.getMetaRequirements().size() == 0) |
| 530 |
|
541 |
return iu.getRequirements(); |
| 531 |
Collection<IRequirement> metaRqs = iu.getMetaRequirements(); |
542 |
|
| 532 |
if (metaRqs.isEmpty()) |
543 |
ArrayList<IRequirement> aggregatedRequirements = new ArrayList<IRequirement>(iu.getRequirements().size() + iu.getMetaRequirements().size() + (isFragment ? ((IInstallableUnitFragment) iu).getHost().size() : 0)); |
| 533 |
return rqs; |
544 |
aggregatedRequirements.addAll(iu.getRequirements()); |
| 534 |
|
545 |
|
| 535 |
ArrayList<IRequirement> aggregatedRqs = new ArrayList<IRequirement>(rqs.size() + metaRqs.size()); |
546 |
if (iu instanceof IInstallableUnitFragment) { |
| 536 |
aggregatedRqs.addAll(rqs); |
547 |
aggregatedRequirements.addAll(((IInstallableUnitFragment) iu).getHost()); |
| 537 |
aggregatedRqs.addAll(metaRqs); |
548 |
} |
| 538 |
return aggregatedRqs; |
549 |
|
|
|
550 |
if (considerMetaRequirements) |
| 551 |
aggregatedRequirements.addAll(iu.getMetaRequirements()); |
| 552 |
return aggregatedRequirements; |
| 539 |
} |
553 |
} |
| 540 |
|
554 |
|
| 541 |
static final class Pending { |
555 |
static final class Pending { |
|
Lines 585-593
Link Here
|
| 585 |
if (isApplicable(reqs[i][1])) { |
599 |
if (isApplicable(reqs[i][1])) { |
| 586 |
IRequirement req = reqs[i][1]; |
600 |
IRequirement req = reqs[i][1]; |
| 587 |
List<IInstallableUnit> matches = getApplicableMatches(req); |
601 |
List<IInstallableUnit> matches = getApplicableMatches(req); |
| 588 |
if (isHostRequirement(iu, req)) { |
602 |
determinePotentialHostsForFragment(iu); |
| 589 |
rememberHostMatches((IInstallableUnitFragment) iu, matches); |
|
|
| 590 |
} |
| 591 |
if (req.getMin() > 0) { |
603 |
if (req.getMin() > 0) { |
| 592 |
if (matches.isEmpty()) { |
604 |
if (matches.isEmpty()) { |
| 593 |
missingRequirement(patch, req); |
605 |
missingRequirement(patch, req); |
|
Lines 661-669
Link Here
|
| 661 |
} |
673 |
} |
| 662 |
|
674 |
|
| 663 |
List<IInstallableUnit> matches = getApplicableMatches(req); |
675 |
List<IInstallableUnit> matches = getApplicableMatches(req); |
| 664 |
if (isHostRequirement(iu, req)) { |
676 |
determinePotentialHostsForFragment(iu); |
| 665 |
rememberHostMatches((IInstallableUnitFragment) iu, matches); |
|
|
| 666 |
} |
| 667 |
if (req.getMin() > 0) { |
677 |
if (req.getMin() > 0) { |
| 668 |
if (matches.isEmpty()) { |
678 |
if (matches.isEmpty()) { |
| 669 |
dependencyHelper.implication(new Object[] {iu}).implies(patch).named(new Explanation.HardRequirement(iu, null)); |
679 |
dependencyHelper.implication(new Object[] {iu}).implies(patch).named(new Explanation.HardRequirement(iu, null)); |
|
Lines 766-774
Link Here
|
| 766 |
} |
776 |
} |
| 767 |
IRequirement req = entry.getKey(); |
777 |
IRequirement req = entry.getKey(); |
| 768 |
List<IInstallableUnit> matches = getApplicableMatches(req); |
778 |
List<IInstallableUnit> matches = getApplicableMatches(req); |
| 769 |
if (isHostRequirement(iu, req)) { |
779 |
determinePotentialHostsForFragment(iu); |
| 770 |
rememberHostMatches((IInstallableUnitFragment) iu, matches); |
|
|
| 771 |
} |
| 772 |
if (req.getMin() > 0) { |
780 |
if (req.getMin() > 0) { |
| 773 |
if (matches.isEmpty()) { |
781 |
if (matches.isEmpty()) { |
| 774 |
if (requiredPatches.isEmpty()) { |
782 |
if (requiredPatches.isEmpty()) { |
|
Lines 1176-1191
Link Here
|
| 1176 |
} |
1184 |
} |
| 1177 |
existingMatches.retainAll(matches); |
1185 |
existingMatches.retainAll(matches); |
| 1178 |
} |
1186 |
} |
| 1179 |
|
|
|
| 1180 |
private boolean isHostRequirement(IInstallableUnit iu, IRequirement req) { |
| 1181 |
if (!(iu instanceof IInstallableUnitFragment)) |
| 1182 |
return false; |
| 1183 |
IInstallableUnitFragment fragment = (IInstallableUnitFragment) iu; |
| 1184 |
for (IRequirement hostReqs : fragment.getHost()) { |
| 1185 |
if (req.equals(hostReqs)) |
| 1186 |
return true; |
| 1187 |
} |
| 1188 |
return false; |
| 1189 |
} |
| 1190 |
|
| 1191 |
} |
1187 |
} |