Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-01-04 11:59:47 -0500
committerChristian W. Damus2016-01-04 12:15:32 -0500
commitdd6efb9cee08786b0506475db72e22f1cd996f09 (patch)
tree9221c0e1fa3fc83a5e8483f4e9b2bff19b9bb210 /plugins
parent842171237bcb839505954cc060da6a09b3022f1b (diff)
downloadorg.eclipse.papyrus-dd6efb9cee08786b0506475db72e22f1cd996f09.tar.gz
org.eclipse.papyrus-dd6efb9cee08786b0506475db72e22f1cd996f09.tar.xz
org.eclipse.papyrus-dd6efb9cee08786b0506475db72e22f1cd996f09.zip
[Releng] Dependency updater tool
Ignore equivalent URL prefixes in detecting suspicious updates
Diffstat (limited to 'plugins')
-rw-r--r--plugins/developer/org.eclipse.papyrus.releng.tools/.classpath14
-rw-r--r--plugins/developer/org.eclipse.papyrus.releng.tools/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--plugins/developer/org.eclipse.papyrus.releng.tools/META-INF/MANIFEST.MF2
-rw-r--r--plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/DependencyUpdater.java40
4 files changed, 42 insertions, 20 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.releng.tools/.classpath b/plugins/developer/org.eclipse.papyrus.releng.tools/.classpath
index b1dabee3829..eca7bdba8f0 100644
--- a/plugins/developer/org.eclipse.papyrus.releng.tools/.classpath
+++ b/plugins/developer/org.eclipse.papyrus.releng.tools/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/developer/org.eclipse.papyrus.releng.tools/.settings/org.eclipse.jdt.core.prefs b/plugins/developer/org.eclipse.papyrus.releng.tools/.settings/org.eclipse.jdt.core.prefs
index 9ca8e68231b..62a08f4494d 100644
--- a/plugins/developer/org.eclipse.papyrus.releng.tools/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/developer/org.eclipse.papyrus.releng.tools/.settings/org.eclipse.jdt.core.prefs
@@ -1,10 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
diff --git a/plugins/developer/org.eclipse.papyrus.releng.tools/META-INF/MANIFEST.MF b/plugins/developer/org.eclipse.papyrus.releng.tools/META-INF/MANIFEST.MF
index 9b512415f9c..6f654e72da3 100644
--- a/plugins/developer/org.eclipse.papyrus.releng.tools/META-INF/MANIFEST.MF
+++ b/plugins/developer/org.eclipse.papyrus.releng.tools/META-INF/MANIFEST.MF
@@ -18,4 +18,4 @@ Bundle-Name: %Bundle-Name
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.releng.tools.internal.Activator
Bundle-SymbolicName: org.eclipse.papyrus.releng.tools;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/DependencyUpdater.java b/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/DependencyUpdater.java
index 8cba78c8113..97a0a521f34 100644
--- a/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/DependencyUpdater.java
+++ b/plugins/developer/org.eclipse.papyrus.releng.tools/src/org/eclipse/papyrus/releng/tools/internal/popup/actions/DependencyUpdater.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2015 Mia-Software, CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2011, 2016 Mia-Software, CEA LIST, Christian W. Damus, 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
@@ -10,6 +10,7 @@
* Camille Letavernier (CEA LIST) - Generalize to support POMs
* Christian W. Damus (CEA) - Add support for updating Oomph setup models
* Christian W. Damus - Support updating of multiple selected files
+ * Christian W. Damus - Ignore equivalent URL prefixes in detecting suspicious updates
*
*******************************************************************************/
package org.eclipse.papyrus.releng.tools.internal.popup.actions;
@@ -389,20 +390,26 @@ public abstract class DependencyUpdater {
}
private interface LocationUpdateStrategy {
+ Pattern URL_PREFIX_PATTERN = Pattern.compile("^(?:\\$\\{[^}]+\\}/|\\Qhttp://download.eclipse.org/\\E)"); //$NON-NLS-1$
+
boolean shouldAutoUpdate(UpdateItem update, String oldLocation, String newLocation);
String getUpdateConfirmationMessage(UpdateItem update, String oldLocation, String newLocation);
- }
- static class MilestoneLocationStrategy implements LocationUpdateStrategy {
- private final Pattern typicalBuildTimestampPattern = Pattern.compile("[NISMR](?:-\\d+\\.\\d+(?:\\.\\d+)?(?:M|RC)\\d[abcd]-)?20\\d\\d[-0-9]+"); //$NON-NLS-1$
+ default boolean hasRecognizedURLPrefix(String location) {
+ return URL_PREFIX_PATTERN.matcher(location).find();
+ }
- @Override
- public boolean shouldAutoUpdate(UpdateItem update, String oldLocation, String newLocation) {
- boolean result = true; // Optimistically assume sameness if we can't find any build timestamps
+ default String stripRecognizedURLPrefix(String location) {
+ Matcher m = URL_PREFIX_PATTERN.matcher(location);
+ return !m.find() ? location : location.substring(m.end());
+ }
- Matcher oldMatcher = typicalBuildTimestampPattern.matcher(oldLocation);
- Matcher newMatcher = typicalBuildTimestampPattern.matcher(newLocation);
+ default boolean matchURLPattern(Pattern urlPattern, String oldLocation, String newLocation) {
+ boolean result = true; // Optimistically assume sameness if we can't find matching URL path segment structures
+
+ Matcher oldMatcher = urlPattern.matcher(oldLocation);
+ Matcher newMatcher = urlPattern.matcher(newLocation);
boolean foundOld = oldMatcher.find();
boolean foundNew = newMatcher.find();
@@ -413,11 +420,26 @@ public abstract class DependencyUpdater {
// Compare prefixes
String oldPrefix = oldLocation.substring(0, oldMatcher.start());
String newPrefix = newLocation.substring(0, newMatcher.start());
+ if (hasRecognizedURLPrefix(oldPrefix) && hasRecognizedURLPrefix(newPrefix)) {
+ // Both have equivalent URL prefixes, so remove those for comparison
+ oldPrefix = stripRecognizedURLPrefix(oldPrefix);
+ newPrefix = stripRecognizedURLPrefix(newPrefix);
+ }
+
result = newPrefix.equals(oldPrefix);
}
return result;
}
+ }
+
+ static class MilestoneLocationStrategy implements LocationUpdateStrategy {
+ private final Pattern typicalBuildTimestampPattern = Pattern.compile("[NISMR](?:-\\d+\\.\\d+(?:\\.\\d+)?(?:M|RC)\\d[abcd]-)?20\\d\\d[-0-9]+"); //$NON-NLS-1$
+
+ @Override
+ public boolean shouldAutoUpdate(UpdateItem update, String oldLocation, String newLocation) {
+ return matchURLPattern(typicalBuildTimestampPattern, oldLocation, newLocation);
+ }
@Override
public String getUpdateConfirmationMessage(UpdateItem update, String oldLocation, String newLocation) {

Back to the top