From e45af3d34527db9b4dc4d683da5ad5d515aea7b7 Mon Sep 17 00:00:00 2001 From: Tobias Oberlies Date: Mon, 1 Aug 2011 16:57:08 +0200 Subject: 325611 Publish correctly if action returns a warning - In case of a warning or info message, the publisher actions are expected to have performed their tasks correctly, and hence the published IUs can be stored in the metadata repository. - This change is a follow-up of bug 325611 and something that will be needed for enhancement 351056. --- .../src/org/eclipse/equinox/p2/publisher/Publisher.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java index 49eeb0cab..76df6080f 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/Publisher.java @@ -229,7 +229,7 @@ public class Publisher { IStatus finalStatus = null; if (info.getArtifactRepository() != null) { finalStatus = info.getArtifactRepository().executeBatch(artifactProcess, sub); - if (finalStatus.isOK()) + if (!finalStatus.matches(IStatus.ERROR | IStatus.CANCEL)) // If the batch process didn't report any errors, then // Use the status from our actions finalStatus = artifactProcess.getStatus(); @@ -240,17 +240,24 @@ public class Publisher { if (Tracing.DEBUG_PUBLISHING) Tracing.debug("Publishing complete. Result=" + finalStatus); //$NON-NLS-1$ + + // if there were no errors, publish all the ius. + if (finalStatus.isOK() || finalStatus.matches(IStatus.INFO | IStatus.WARNING)) + savePublishedIUs(); + if (!finalStatus.isOK()) return finalStatus; + return Status.OK_STATUS; } finally { sub.done(); } - // if there were no errors, publish all the ius. + } + + protected void savePublishedIUs() { IMetadataRepository metadataRepository = info.getMetadataRepository(); if (metadataRepository != null) { Collection ius = results.getIUs(null, null); metadataRepository.addInstallableUnits(ius); } - return Status.OK_STATUS; } } -- cgit v1.2.3