Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Kaegi2009-03-02 22:58:10 +0000
committerSimon Kaegi2009-03-02 22:58:10 +0000
commitccd6609d44f72e95661888e08e788dd4bde05a65 (patch)
tree12c48c4622706c4241a1cc94b1847cecdc073fdd /bundles/org.eclipse.equinox.p2.publisher
parenteecb7e3760c56186c2602c6aa9d6545cd68a46fc (diff)
downloadrt.equinox.p2-ccd6609d44f72e95661888e08e788dd4bde05a65.tar.gz
rt.equinox.p2-ccd6609d44f72e95661888e08e788dd4bde05a65.tar.xz
rt.equinox.p2-ccd6609d44f72e95661888e08e788dd4bde05a65.zip
Bug 210450 [metadata][artifact] Forwards compatibility of file formats
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.publisher')
-rw-r--r--bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java
index 5915ab214..2eb46efba 100644
--- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java
+++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/eclipse/AdviceFileParser.java
@@ -21,6 +21,8 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.Inst
public class AdviceFileParser {
+ private static final String ADVICE_VERSION = "advice.version"; //$NON-NLS-1$
+
private static final String QUALIFIER_SUBSTITUTION = "$qualifier$"; //$NON-NLS-1$
private static final String VERSION_SUBSTITUTION = "$version$"; //$NON-NLS-1$
@@ -56,6 +58,9 @@ public class AdviceFileParser {
private static final String ARTIFACTS_PREFIX = "artifacts."; //$NON-NLS-1$
private static final String HOST_REQUIREMENTS_PREFIX = "hostRequirements."; //$NON-NLS-1$
+ public static final Version COMPATIBLE_VERSION = new Version(1, 0, 0);
+ public static final VersionRange VERSION_TOLERANCE = new VersionRange(COMPATIBLE_VERSION, true, new Version(2, 0, 0), false);
+
private Properties adviceProperties = new Properties();
private List adviceProvides = new ArrayList();
private List adviceRequires = new ArrayList();
@@ -75,6 +80,10 @@ public class AdviceFileParser {
}
public void parse() {
+ String adviceVersion = (String) advice.get(ADVICE_VERSION);
+ if (adviceVersion != null)
+ checkAdviceVersion(adviceVersion);
+
List keys = new ArrayList(advice.keySet());
Collections.sort(keys);
@@ -92,13 +101,21 @@ public class AdviceFileParser {
parseInstructions(INSTRUCTIONS_PREFIX, adviceInstructions);
else if (current.startsWith(UNITS_PREFIX))
parseUnits(UNITS_PREFIX, adviceOtherIUs);
- else {
+ else if (current.equals(ADVICE_VERSION)) {
+ next();
+ } else {
// we ignore elements we do not understand
next();
}
}
}
+ private void checkAdviceVersion(String adviceVersion) {
+ Version version = new Version(adviceVersion);
+ if (!VERSION_TOLERANCE.isIncluded(version))
+ throw new IllegalStateException("bad version: " + version + ". Expected range was " + VERSION_TOLERANCE); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
private void next() {
current = (String) (keysIterator.hasNext() ? keysIterator.next() : null);
}

Back to the top