summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2012-04-27 22:33:50 (EDT)
committerPascal Rapicault2012-04-27 22:33:50 (EDT)
commit26efa8031a837dfcee7c3a327055cb23623c26e5 (patch)
treeb7d44e4ffae1737cb224ec3bf4f5f05a95359827
parent3ae7052955faa45c91b29e331a7e221cdd15562c (diff)
downloadrt.equinox.p2-26efa8031a837dfcee7c3a327055cb23623c26e5.zip
rt.equinox.p2-26efa8031a837dfcee7c3a327055cb23623c26e5.tar.gz
rt.equinox.p2-26efa8031a837dfcee7c3a327055cb23623c26e5.tar.bz2
Bug 377358 - API to disable/enable mirroring of packed artifactsv20120428-0233
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java27
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java4
3 files changed, 31 insertions, 8 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 dcc6fec..470d47a 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
@@ -46,6 +46,7 @@ public class Mirroring {
private List<IArtifactKey> keysToMirror;
private IArtifactMirrorLog comparatorLog;
private Transport transport;
+ private boolean includePacked = true;
private IArtifactComparator getComparator() {
if (comparator == null)
@@ -121,6 +122,9 @@ public class Mirroring {
}
private IStatus mirror(IArtifactDescriptor sourceDescriptor, boolean verbose) {
+ if (!includePacked && IArtifactDescriptor.FORMAT_PACKED.equals(sourceDescriptor.getProperty(IArtifactDescriptor.FORMAT)))
+ return Status.OK_STATUS;
+
IArtifactDescriptor targetDescriptor = raw ? sourceDescriptor : new ArtifactDescriptor(sourceDescriptor);
IArtifactDescriptor baselineDescriptor = getBaselineDescriptor(sourceDescriptor);
@@ -313,4 +317,8 @@ public class Mirroring {
public void setTransport(Transport transport) {
this.transport = transport;
}
+
+ public void setIncludePacked(boolean includePacked) {
+ this.includePacked = includePacked;
+ }
}
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 15a7c7f..dd5bb6c 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
@@ -50,6 +50,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
private boolean mirrorReferences = true;
private String metadataOrArtifacts = null;
private String[] rootIUs = null;
+ private boolean includePacked = true;
private File mirrorLogFile; // file to log mirror output to (optional)
private File comparatorLogFile; // file to comparator output to (optional)
@@ -201,6 +202,18 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
}
private IStatus mirrorArtifacts(IQueryable<IInstallableUnit> slice, IProgressMonitor monitor) {
+ Mirroring mirror = getMirroring(slice, monitor);
+
+ IStatus result = mirror.run(failOnError, verbose);
+
+ if (mirrorLog != null)
+ mirrorLog.log(result);
+ else
+ LogHelper.log(result);
+ return result;
+ }
+
+ protected Mirroring getMirroring(IQueryable<IInstallableUnit> slice, IProgressMonitor monitor) {
// Obtain ArtifactKeys from IUs
IQueryResult<IInstallableUnit> ius = slice.query(QueryUtil.createIUAnyQuery(), monitor);
ArrayList<IArtifactKey> keys = new ArrayList<IArtifactKey>();
@@ -216,6 +229,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
mirror.setValidate(validate);
mirror.setCompareExclusions(compareExclusions);
mirror.setTransport((Transport) agent.getService(Transport.SERVICE_NAME));
+ mirror.setIncludePacked(includePacked);
// If IUs have been specified then only they should be mirrored, otherwise mirror everything.
if (keys.size() > 0)
@@ -223,14 +237,7 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
if (comparatorLog != null)
mirror.setComparatorLog(comparatorLog);
-
- IStatus result = mirror.run(failOnError, verbose);
-
- if (mirrorLog != null)
- mirrorLog.log(result);
- else
- LogHelper.log(result);
- return result;
+ return mirror;
}
private IArtifactRepository initializeBaseline() {
@@ -450,4 +457,8 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
public void setComparatorExclusions(IQuery<IArtifactDescriptor> exclusions) {
compareExclusions = exclusions;
}
+
+ public void setIncludePacked(boolean includePacked) {
+ this.includePacked = includePacked;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java
index 6368f01..b24750d 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java
@@ -133,4 +133,8 @@ public class MirrorTask extends AbstractRepositoryTask {
public void setValidate(boolean value) {
((MirrorApplication) application).setValidate(value);
}
+
+ public void setIncludePacked(boolean value) {
+ ((MirrorApplication) application).setIncludePacked(value);
+ }
}