summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2012-11-19 21:16:16 (EST)
committerPascal Rapicault2012-11-19 21:16:16 (EST)
commitf813b6677a7590b2636e4a0c1bfca026d1dd85b2 (patch)
treeb2959680ce313452c2a0f73a8331730eb21b6e6b
parenta63347a8fc10f3585c71cf5bddee00cc5abafbb2 (diff)
downloadrt.equinox.p2-f813b6677a7590b2636e4a0c1bfca026d1dd85b2.zip
rt.equinox.p2-f813b6677a7590b2636e4a0c1bfca026d1dd85b2.tar.gz
rt.equinox.p2-f813b6677a7590b2636e4a0c1bfca026d1dd85b2.tar.bz2
Bug 394434 - [mirror] Can't disable reference mirroringv20121120-021616I20121120-0800
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorArtifactsTask.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorMetadataTask.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorTask.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java22
5 files changed, 43 insertions, 2 deletions
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 dd5bb6c..b724824 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
@@ -152,6 +152,8 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
mirrorLogLocation = new File(arg);
} else if (args[i - 1].equalsIgnoreCase("-roots")) { //$NON-NLS-1$
rootIUs = getArrayArgsFromString(arg, ","); //$NON-NLS-1$
+ } else if (args[i - 1].equalsIgnoreCase("-references")) {//$NON-NLS-1$
+ mirrorReferences = Boolean.parseBoolean(args[i]);
} else {
try {
if (args[i - 1].equalsIgnoreCase("-source")) { //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorArtifactsTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorArtifactsTask.java
index 902cf3d..0811233 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorArtifactsTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorArtifactsTask.java
@@ -35,6 +35,7 @@ public class MirrorArtifactsTask extends Task {
boolean ignoreErrors = false;
boolean raw = false; // use raw artifact descriptors?
boolean verbose = false;
+ boolean references = true;
/* (non-Javadoc)
* @see org.apache.tools.ant.Task#execute()
@@ -62,6 +63,7 @@ public class MirrorArtifactsTask extends Task {
app.setCompare(compare);
app.setComparatorID(comparatorID);
app.setBaseline(baseline);
+ app.setReferences(references);
if (comparatorLog != null)
app.setComparatorLog(comparatorLog);
if (mirrorLog != null)
@@ -77,7 +79,7 @@ public class MirrorArtifactsTask extends Task {
try {
app.run(null);
} catch (Exception e) {
- throw new BuildException("Exception while running mirror application.", e);
+ throw new BuildException("Exception while running mirror application.", e); //$NON-NLS-1$
}
}
@@ -178,4 +180,11 @@ public class MirrorArtifactsTask extends Task {
public void setVerbose(boolean value) {
verbose = value;
}
+
+ /*
+ * Set whether the repository references should be copied to the new repository
+ */
+ public void setReferences(boolean value) {
+ references = value;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorMetadataTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorMetadataTask.java
index 3fd6fec..20b058a 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorMetadataTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/MirrorMetadataTask.java
@@ -28,6 +28,7 @@ public class MirrorMetadataTask extends Task {
URI destination;
String destinationName;
String writeMode;
+ boolean references = true;
/* (non-Javadoc)
* @see org.apache.tools.ant.Task#execute()
@@ -48,6 +49,7 @@ public class MirrorMetadataTask extends Task {
MirrorApplication app = new MirrorApplication();
app.addDestination(destinationRepo);
app.addSource(sourceRepo);
+ app.setReferences(references);
try {
IStatus result = app.run(null);
if (result.getSeverity() != IStatus.OK)
@@ -92,4 +94,8 @@ public class MirrorMetadataTask extends Task {
public void setWriteMode(String value) {
writeMode = value;
}
+
+ public void setReferences(boolean value) {
+ references = value;
+ }
} \ No newline at end of file
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 b24750d..f9d5a94 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
@@ -137,4 +137,8 @@ public class MirrorTask extends AbstractRepositoryTask {
public void setIncludePacked(boolean value) {
((MirrorApplication) application).setIncludePacked(value);
}
+
+ public void setReferences(boolean value) {
+ ((MirrorApplication) application).setReferences(value);
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java
index 21198de..7a032fc 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/NewMirrorApplicationMetadataTest.java
@@ -985,6 +985,26 @@ public class NewMirrorApplicationMetadataTest extends AbstractProvisioningTest {
IMetadataRepository destRepo = getMetadataRepositoryManager().loadRepository(destRepoLocation.toURI(), null);
Collection<IRepositoryReference> destRefs = destRepo.getReferences();
- assertEquals(destRefs.size(), 4);
+ assertEquals(4, destRefs.size());
+ }
+
+ public void testMirrorWithoutReferences() throws Exception {
+ MirrorApplication app = new MirrorApplication();
+ RepositoryDescriptor dest = new RepositoryDescriptor();
+ dest.setLocation(destRepoLocation.toURI());
+ dest.setAppend(false);
+ dest.setKind("metadata");
+ app.addDestination(dest);
+
+ RepositoryDescriptor src = new RepositoryDescriptor();
+ src.setLocation(sourceRepoWithRefs.toURI());
+ src.setKind("metadata");
+ app.addSource(src);
+ app.setReferences(false);
+ app.run(null);
+
+ IMetadataRepository destRepo = getMetadataRepositoryManager().loadRepository(destRepoLocation.toURI(), null);
+ Collection<IRepositoryReference> destRefs = destRepo.getReferences();
+ assertEquals(0, destRefs.size());
}
}