Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Oberlies2012-09-26 14:40:41 +0000
committerTobias Oberlies2012-09-27 17:32:07 +0000
commit58dc39a029e5e9c5304b0ab055134f6800de318f (patch)
tree2ceed8293201436243a8dc011676f6fa80b9f0f5
parentccc748ef552feebefc485081c30b400e280e762a (diff)
downloadrt.equinox.p2-58dc39a029e5e9c5304b0ab055134f6800de318f.tar.gz
rt.equinox.p2-58dc39a029e5e9c5304b0ab055134f6800de318f.tar.xz
rt.equinox.p2-58dc39a029e5e9c5304b0ab055134f6800de318f.zip
342890 Fail ProductAction if included IU is not in the context
- Unlike feature.xmls, product files don't specify filters on inclusions but rather use the filter of the included IU. This implies that all included IUs have to be in the context when running the ProductAction, or the result may be broken. Bug: 342890 Published products are broken if included fragments are not in context
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/Messages.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/messages.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java1
6 files changed, 15 insertions, 20 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/Messages.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/Messages.java
index f469e8040..96fcf947c 100644
--- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/Messages.java
+++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/Messages.java
@@ -30,6 +30,9 @@ public class Messages extends NLS {
public static String featuresInProductFileIgnored;
public static String bundlesInProductFileIgnored;
+ public static String message_problemPublishingProduct;
+ public static String message_includedElementNotFound;
+
static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/messages.properties b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/messages.properties
index bd388de84..6e82053c9 100644
--- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/messages.properties
@@ -23,3 +23,5 @@ feature_parse_emptyRequires = Error parsing feature: \"require\" must include at
featuresInProductFileIgnored=The features specified in the product definition are ignored; verify the value of the 'type' or 'useFeatures' attribute.
bundlesInProductFileIgnored=The bundles specified in the product definition are ignored; verify the value of the 'type' or 'useFeatures' attribute.
+message_includedElementNotFound=Included element not found: {0}/{1}
+message_problemPublishingProduct=Problems while publishing product {1}
diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
index d0f3fa92d..17747259f 100644
--- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
+++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ProductAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 Code 9 and others. All rights reserved. This
+ * Copyright (c) 2008, 2012 Code 9 and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -92,7 +92,7 @@ public class ProductAction extends AbstractPublisherAction {
monitor = SubMonitor.convert(monitor);
this.info = publisherInfo;
publisherResults = results;
- finalStatus = new MultiStatus(EclipseInstallAction.class.getName(), 0, "publishing result", null); //$NON-NLS-1$
+ finalStatus = new MultiStatus(Activator.ID, 0, NLS.bind(Messages.message_problemPublishingProduct, product.getId()), null);
IPublisherAction[] actions = createActions(results);
for (int i = 0; i < actions.length; i++) {
if (monitor.isCanceled())
@@ -183,12 +183,9 @@ public class ProductAction extends AbstractPublisherAction {
IInstallableUnit unit = queryForIU(publisherResults, element.getId(), elementVersion);
if (unit != null) {
result.add(unit);
- } else if (elementVersion != null) {
- //best effort
- result.add(new VersionedId(element.getId(), elementVersion));
+ } else {
+ finalStatus.add(new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.message_includedElementNotFound, element.getId(), elementVersion)));
}
- //TODO we could still add a requirement on version 0.0.0 to get any version, but if the
- //bundle is platform specific we will have broken metadata due to a missing filter
}
return result;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java
index 0a6add989..af1fdb8dd 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionCapturingTest.java
@@ -70,6 +70,8 @@ public class ProductActionCapturingTest extends ActionTest {
* IConfigAdvice (start levels, auto-start).
*/
public void testSetBundleConfigData() throws Exception {
+ addContextUnit("org.eclipse.rcp.feature.group", "3.5.0.v20081110-9C9tEvNEla71LZ2jFz-RFB-t");
+
ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "startLevel.product").toString());
testAction = new ProductAction(source, productFile, flavorArg, executablesFeatureLocation);
@@ -95,6 +97,7 @@ public class ProductActionCapturingTest extends ActionTest {
*/
public void testPlatformProduct() throws Exception {
ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "platform.product").toString());
+ addContextUnit("org.eclipse.platform.feature.group", "1.2.3");
testAction = new ProductAction(source, productFile, flavorArg, executablesFeatureLocation);
IStatus status = testAction.perform(publisherInfo, publisherResult, null);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java
index 7c02ee8d7..5a159cf78 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTest.java
@@ -76,6 +76,7 @@ public class ProductActionTest extends ActionTest {
*/
public void testBrandedApplication() throws Exception {
ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "brandedProduct/branded.product").toString());
+ addContextUnit("org.eclipse.platform.feature.group", "1.2.3");
performProductAction(productFile);
Collection ius = publisherResult.getIUs("branded.product", IPublisherResult.NON_ROOT);
@@ -218,22 +219,10 @@ public class ProductActionTest extends ActionTest {
}
- public void testCUNoHost() throws Exception {
- ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "unboundedVersionConfigurations.product").toString());
- setConfiguration(LINUX_CONFIG_SPEC);
-
- performProductAction(productFile);
-
- IQueryResult queryResult = publisherResult.query(QueryUtil.createIUQuery(flavorArg + LINUX_CONFIG_SPEC + "org.eclipse.core.runtime"), new NullProgressMonitor());
- assertEquals("1.0", 0, queryResultSize(queryResult));
-
- queryResult = publisherResult.query(QueryUtil.createIUQuery(flavorArg + WIN_CONFIG_SPEC + "org.eclipse.core.runtime"), new NullProgressMonitor());
- assertEquals("2.0", 0, queryResultSize(queryResult));
- }
-
public void testMultiConfigspecProductPublishing() throws IOException, Exception {
ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "platform.product").toString());
((PublisherInfo) publisherInfo).setConfigurations(new String[] {"carbon.macos.x86", "cocoa.macos.x86"});
+ addContextUnit("org.eclipse.platform.feature.group", "1.2.3");
performProductAction(productFile);
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java
index 460e65fc5..1f5442ae2 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/publisher/actions/ProductActionTestMac.java
@@ -66,6 +66,7 @@ public class ProductActionTestMac extends ActionTest {
*/
public void testPlatformProduct() throws Exception {
ProductFile productFile = new ProductFile(TestData.getFile("ProductActionTest", "platform.product").toString());
+ addContextUnit("org.eclipse.platform.feature.group", "3.8.3");
testAction = new ProductAction(source, productFile, flavorArg, executablesFeatureLocation);
IStatus status = testAction.perform(publisherInfo, publisherResult, null);
assertThat(status, is(okStatus()));

Back to the top