Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan McCourt2014-06-06 17:46:24 +0000
committerPascal Rapicault2014-06-28 03:26:42 +0000
commit9ea8e4cc9aa6ec8ff70a4e0a811401f5c941ad68 (patch)
treeb69d499e8504c5ed1c058c5b92038eaab2431297 /bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2
parent775d3353cbbd08cb5605f993b32081438f5674b3 (diff)
downloadrt.equinox.p2-9ea8e4cc9aa6ec8ff70a4e0a811401f5c941ad68.tar.gz
rt.equinox.p2-9ea8e4cc9aa6ec8ff70a4e0a811401f5c941ad68.tar.xz
rt.equinox.p2-9ea8e4cc9aa6ec8ff70a4e0a811401f5c941ad68.zip
Bug 436872 - [category] Specify download stats URL and type of artifacts
to monitor in category.xml Adds an argument to MirroringApplication to mirror artifact repository properties. This is needed in order to properly export the p2.statsURI property generated in the publisher. Change-Id: I0947d6320f24ef09e67f650b765bbe3908dd382e Signed-off-by: Pascal Rapicault <pascal@rapicorp.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2')
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java23
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java8
2 files changed, 31 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
index 69ca5e92a..ab37668b5 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
@@ -14,6 +14,7 @@ package org.eclipse.equinox.p2.internal.repository.mirroring;
import java.util.*;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
import org.eclipse.equinox.internal.p2.artifact.repository.RawMirrorRequest;
import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.p2.core.ProvisionException;
@@ -46,6 +47,7 @@ public class Mirroring {
private IArtifactMirrorLog comparatorLog;
private Transport transport;
private boolean includePacked = true;
+ private boolean mirrorProperties = false;
private IArtifactComparator getComparator() {
if (comparator == null)
@@ -79,6 +81,10 @@ public class Mirroring {
this.validate = validate;
}
+ public void setMirrorProperties(boolean properties) {
+ this.mirrorProperties = properties;
+ }
+
public MultiStatus run(boolean failOnError, boolean verbose) {
if (!destination.isModifiable())
throw new IllegalStateException(NLS.bind(Messages.exception_destinationNotModifiable, destination.getLocation()));
@@ -111,6 +117,23 @@ public class Mirroring {
return multiStatus;
}
}
+
+ // mirror the source repository's properties unless they are already set up
+ // in the destination repository
+ if (mirrorProperties) {
+ IArtifactRepository toCopyFrom = source;
+ if (toCopyFrom instanceof CompositeArtifactRepository) {
+ List<IArtifactRepository> children = ((CompositeArtifactRepository) toCopyFrom).getLoadedChildren();
+ if (children.size() > 0)
+ toCopyFrom = children.get(0);
+ }
+ Map<String, String> sourceProperties = toCopyFrom.getProperties();
+ for (String key : sourceProperties.keySet()) {
+ if (!destination.getProperties().containsKey(key))
+ destination.setProperty(key, sourceProperties.get(key));
+ }
+ }
+
if (validate) {
// Simple validation of the mirror
IStatus validation = validateMirror(verbose);
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
index 30dfeb06f..80bf3bf40 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
@@ -51,6 +51,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
private String metadataOrArtifacts = null;
private String[] rootIUs = null;
private boolean includePacked = true;
+ private boolean mirrorProperties = false;
private File mirrorLogFile; // file to log mirror output to (optional)
private File comparatorLogFile; // file to comparator output to (optional)
@@ -130,6 +131,8 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
validate = true;
else if (args[i].equalsIgnoreCase("-references")) //$NON-NLS-1$
mirrorReferences = true;
+ else if (args[i].equalsIgnoreCase("-properties")) //$NON-NLS-1$
+ mirrorProperties = true;
// check for args with parameters. If we are at the last argument or
// if the next one has a '-' as the first character, then we can't have
@@ -233,6 +236,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
mirror.setCompareExclusions(compareExclusions);
mirror.setTransport((Transport) agent.getService(Transport.SERVICE_NAME));
mirror.setIncludePacked(includePacked);
+ mirror.setMirrorProperties(mirrorProperties);
// If IUs have been specified then only they should be mirrored, otherwise mirror everything.
if (iusSpecified)
@@ -464,4 +468,8 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
public void setIncludePacked(boolean includePacked) {
this.includePacked = includePacked;
}
+
+ public void setMirrorProperties(boolean mirrorProperties) {
+ this.mirrorProperties = mirrorProperties;
+ }
}

Back to the top