diff options
author | Todor Boev | 2017-05-19 09:24:37 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-06-27 09:45:54 +0000 |
commit | b37a78000139106dead4ef2c4efd5a9019f070f7 (patch) | |
tree | a82d63ace56dec2efa7f3a1ef700f8c5860d15c4 | |
parent | ff12ff963d3657c29884b15baa1f105c8a09ac77 (diff) | |
download | rt.equinox.p2-b37a78000139106dead4ef2c4efd5a9019f070f7.tar.gz rt.equinox.p2-b37a78000139106dead4ef2c4efd5a9019f070f7.tar.xz rt.equinox.p2-b37a78000139106dead4ef2c4efd5a9019f070f7.zip |
Bug 490896: Director app handles all result status codes.
When the provisioning operation completes with WARNING or INFO the
director command line application reports failure (equinox returns
non-zero execution code). At the same time P2 has in fact performed
changes to the installation and these were not reverted as would happen
on an ERROR IStatus. The director should not report failure when
provisioning completes with INFO or WARNING IStatus.
Change-Id: I9a683174ffe9e49aa4456b4aa5134f9067ecc7a7
Signed-off-by: Todor Boev <rinsvind@gmail.com>
-rw-r--r-- | bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java index 567a2f857..c301cea55 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java +++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java @@ -807,24 +807,37 @@ public class DirectorApplication implements IApplication, ProvisioningListener { } private void executePlan(ProvisioningContext context, IProvisioningPlan result) throws CoreException { + if (verifyOnly) { + return; + } + IStatus operationStatus; - if (!verifyOnly) { - if (!downloadOnly) - operationStatus = PlanExecutionHelper.executePlan(result, engine, context, new NullProgressMonitor()); - else - operationStatus = PlanExecutionHelper.executePlan(result, engine, PhaseSetFactory.createPhaseSetIncluding(new String[] {PhaseSetFactory.PHASE_COLLECT, PhaseSetFactory.PHASE_CHECK_TRUST}), context, new NullProgressMonitor()); - if (!operationStatus.isOK()) { + if (!downloadOnly) + operationStatus = PlanExecutionHelper.executePlan(result, engine, context, new NullProgressMonitor()); + else + operationStatus = PlanExecutionHelper.executePlan(result, engine, PhaseSetFactory.createPhaseSetIncluding(new String[] {PhaseSetFactory.PHASE_COLLECT, PhaseSetFactory.PHASE_CHECK_TRUST}), context, new NullProgressMonitor()); + + switch (operationStatus.getSeverity()) { + case IStatus.OK : + break; + case IStatus.INFO : + case IStatus.WARNING : + logStatus(operationStatus); + break; + //. All other status codes correspond to IStatus.isOk() == false + default : if (noArtifactRepositorySpecified && hasNoRepositoryFound(operationStatus)) throw new ProvisionException(Messages.Application_NoRepositories); throw new CoreException(operationStatus); - } - if (tag != null) { - long newState = result.getProfile().getTimestamp(); - IProfileRegistry registry = (IProfileRegistry) targetAgent.getService(IProfileRegistry.SERVICE_NAME); - registry.setProfileStateProperty(result.getProfile().getProfileId(), newState, IProfile.STATE_PROP_TAG, tag); - } + } + if (tag == null) { + return; } + + long newState = result.getProfile().getTimestamp(); + IProfileRegistry registry = (IProfileRegistry) targetAgent.getService(IProfileRegistry.SERVICE_NAME); + registry.setProfileStateProperty(result.getProfile().getProfileId(), newState, IProfile.STATE_PROP_TAG, tag); } private boolean hasNoRepositoryFound(IStatus status) { |