summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2014-01-22 13:37:14 (EST)
committerPascal Rapicault2014-01-22 13:40:00 (EST)
commit136ee4a661b6c61e08b249a7cbf5511712b96e38 (patch)
tree0e585178ba294073bcff2f45b320ee6f43422a7b
parent87834171a7d49a7efb53d4574b87aef17a97bcf9 (diff)
downloadrt.equinox.p2-136ee4a661b6c61e08b249a7cbf5511712b96e38.zip
rt.equinox.p2-136ee4a661b6c61e08b249a7cbf5511712b96e38.tar.gz
rt.equinox.p2-136ee4a661b6c61e08b249a7cbf5511712b96e38.tar.bz2
Bug 426388 - Provide fall back mechanism to find migration source M20140129-0800M20140124-1600
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
index b798159..4bef663 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
@@ -155,8 +155,34 @@ public class PreviousConfigurationFinder {
if (match == null)
match = findMostRelevantConfigurationFromProductId(potentialConfigurations, runningConfiguration);
if (match == null)
+ match = findSpecifiedConfiguration(searchRoot);
+ if (match == null)
return null;
return AgentFromInstall.createAgentFrom(AutomaticUpdatePlugin.getDefault().getAgentProvider(), null, new File(match.getConfig(), "configuration"), null); //$NON-NLS-1$
+
+ }
+
+ public ConfigurationDescriptor findSpecifiedConfiguration(File searchRoot) {
+ final String prefixesAsString = System.getProperty("p2.forcedMigrationLocation"); //$NON-NLS-1$
+ if (prefixesAsString == null)
+ return null;
+
+ String[] prefixes = prefixesAsString.split(","); //$NON-NLS-1$
+ for (String prefix : prefixes) {
+ final String p = prefix;
+ File[] match = searchRoot.listFiles(new FileFilter() {
+ public boolean accept(File candidate) {
+ if (!candidate.isDirectory())
+ return false;
+ if (currentConfig.equals(candidate))
+ return false;
+ return candidate.getName().contains(p);
+ }
+ });
+ if (match.length != 0)
+ return new ConfigurationDescriptor("unknown", new Identifier("0.0.0"), "unknown", "unknown", match[0]); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
+ }
+ return null;
}
private ConfigurationDescriptor getConfigdataFromProductFile(File installFolder) {