Skip to main content
summaryrefslogtreecommitdiffstats
path: root/p2
diff options
context:
space:
mode:
Diffstat (limited to 'p2')
-rw-r--r--p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/WascanaGenerator.java54
-rw-r--r--p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/Activator.java10
-rw-r--r--p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/touchpoint/natives/actions/CleanupUntarAction.java13
-rw-r--r--p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/touchpoint/natives/actions/UntarAction.java94
4 files changed, 101 insertions, 70 deletions
diff --git a/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/WascanaGenerator.java b/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/WascanaGenerator.java
index 7a9ca9b693..f0d2c59c8d 100644
--- a/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/WascanaGenerator.java
+++ b/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/WascanaGenerator.java
@@ -15,7 +15,9 @@ import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.Path;
@@ -48,8 +50,9 @@ import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
*/
public class WascanaGenerator implements IApplication {
- private static Version wascanaVersion = Version.parseVersion("1.0.0.0");
private static Version binutilsVersion = Version.parseVersion("2.20.0.0");
+ private static Version mingwrtVersion = Version.parseVersion("3.15.2.4");
+ private static Version wascanaVersion = Version.parseVersion("1.0.0.0");
private static final String REPO_NAME = "Wascana";
@@ -61,6 +64,9 @@ public class WascanaGenerator implements IApplication {
private ILicense gpl30License;
private ILicense lgpl21License;
+ private ILicense pdLicense; // public domain
+
+ private List<IInstallableUnit> iuList = new ArrayList<IInstallableUnit>();
@Override
public Object start(IApplicationContext context) throws Exception {
@@ -76,21 +82,21 @@ public class WascanaGenerator implements IApplication {
createRepos(repoDir);
loadLicenses();
- // binutils
+ // tools
+
IInstallableUnit binutilsIU = createIU(
"wascana.binutils",
- "Wascana MinGW binutils",
+ "Wascana MinGW Binutils",
binutilsVersion,
gpl30License,
null);
IInstallableUnit binutilsSrcIU = createIU(
"wascana.binutils.source",
- "Wascana MinGW binutils source",
+ "Wascana MinGW Binutils Source",
binutilsVersion,
gpl30License,
null);
- // toolchain
IInstallableUnit toolsIU = createCategory(
"wascana.tools",
"Wascana Tools",
@@ -98,12 +104,29 @@ public class WascanaGenerator implements IApplication {
new IRequiredCapability[] {
createRequiredCap(binutilsIU),
});
+
+ // sdks
+ IInstallableUnit mingwrtIU = createIU(
+ "wascana.mingwrt",
+ "Wascana MinGW Runtime",
+ mingwrtVersion,
+ pdLicense,
+ null);
+
+ IInstallableUnit mingwrtSrcIU = createIU(
+ "wascana.mingwrt.source",
+ "Wascana MinGW Runtime Source",
+ mingwrtVersion,
+ pdLicense,
+ null);
+
IInstallableUnit sdksIU = createCategory(
"wascana.sdks",
"Wascana SDKs",
wascanaVersion,
new IRequiredCapability[] {
+ createRequiredCap(mingwrtIU),
});
IInstallableUnit sourceIU = createCategory(
@@ -112,6 +135,7 @@ public class WascanaGenerator implements IApplication {
wascanaVersion,
new IRequiredCapability[] {
createRequiredCap(binutilsSrcIU),
+ createRequiredCap(mingwrtSrcIU),
});
IInstallableUnit wascanaIU = createCategory(
@@ -124,16 +148,7 @@ public class WascanaGenerator implements IApplication {
createRequiredCap(sourceIU),
});
- metaRepo.addInstallableUnits(new IInstallableUnit[] {
- binutilsIU,
- binutilsSrcIU,
-
- toolsIU,
- sdksIU,
- sourceIU,
-
- wascanaIU
- });
+ metaRepo.addInstallableUnits(iuList.toArray(new IInstallableUnit[iuList.size()]));
System.out.println("done");
@@ -183,6 +198,7 @@ public class WascanaGenerator implements IApplication {
lgpl21License = MetadataFactory.createLicense(
new URI("http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html"),
Activator.getFileContents(new Path("licenses/lgpl-2.1.txt")));
+ pdLicense = MetadataFactory.createLicense(null, "This package has no copyright assignment and is placed in the Public Domain.");
}
private InstallableUnitDescription createIUDesc(String id, String name, Version version, ILicense license) throws ProvisionException {
@@ -217,7 +233,9 @@ public class WascanaGenerator implements IApplication {
ArtifactDescriptor artiDesc = new ArtifactDescriptor(artiKey);
artiRepo.addDescriptor(artiDesc);
iuDesc.setArtifacts(new IArtifactKey[] { artiKey });
- return MetadataFactory.createInstallableUnit(iuDesc);
+ IInstallableUnit iu = MetadataFactory.createInstallableUnit(iuDesc);
+ iuList.add(iu);
+ return iu;
}
private IInstallableUnit createCategory(String id, String name, Version version,
@@ -226,7 +244,9 @@ public class WascanaGenerator implements IApplication {
if (reqs != null)
iuDesc.setRequiredCapabilities(reqs);
iuDesc.setProperty(IInstallableUnit.PROP_TYPE_CATEGORY, String.valueOf(true));
- return MetadataFactory.createInstallableUnit(iuDesc);
+ IInstallableUnit iu = MetadataFactory.createInstallableUnit(iuDesc);
+ iuList.add(iu);
+ return iu;
}
private IRequiredCapability createRequiredCap(IInstallableUnit iu) {
diff --git a/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/Activator.java b/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/Activator.java
index cdc52fff46..00a69bd38a 100644
--- a/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/Activator.java
+++ b/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/Activator.java
@@ -61,7 +61,7 @@ public class Activator extends Plugin {
return plugin;
}
- static public BundleContext getContext() {
+ public static BundleContext getContext() {
return plugin.getBundle().getBundleContext();
}
@@ -72,8 +72,8 @@ public class Activator extends Plugin {
* @return the service
*/
@SuppressWarnings("unchecked")
- public <T> T getService(Class<T> clazz) {
- BundleContext context = getBundle().getBundleContext();
+ public static <T> T getService(Class<T> clazz) {
+ BundleContext context = plugin.getBundle().getBundleContext();
ServiceReference ref = context.getServiceReference(clazz.getName());
return (ref != null) ? (T)context.getService(ref) : null;
}
@@ -83,11 +83,11 @@ public class Activator extends Plugin {
*
* @param status
*/
- public void log(int severity, String message, Throwable exception) {
+ public static void log(int severity, String message, Throwable exception) {
Platform.getLog(plugin.getBundle()).log(new Status(severity, PLUGIN_ID, message, exception));
}
- public void log(IStatus status) {
+ public static void log(IStatus status) {
Platform.getLog(plugin.getBundle()).log(status);
}
diff --git a/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/touchpoint/natives/actions/CleanupUntarAction.java b/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/touchpoint/natives/actions/CleanupUntarAction.java
index e32c81678e..0a0e975a99 100644
--- a/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/touchpoint/natives/actions/CleanupUntarAction.java
+++ b/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/touchpoint/natives/actions/CleanupUntarAction.java
@@ -14,6 +14,7 @@ import java.io.File;
import java.util.Map;
import java.util.StringTokenizer;
+import org.eclipse.cdt.internal.p2.Activator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.engine.Profile;
@@ -38,12 +39,20 @@ public class CleanupUntarAction extends ProvisioningAction {
@Override
public IStatus execute(Map parameters) {
- return cleanup(parameters);
+ try {
+ return cleanup(parameters);
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e);
+ }
}
@Override
public IStatus undo(Map parameters) {
- return UntarAction.untar(parameters);
+ try {
+ return UntarAction.untar(parameters);
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e);
+ }
}
public static IStatus cleanup(Map parameters) {
diff --git a/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/touchpoint/natives/actions/UntarAction.java b/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/touchpoint/natives/actions/UntarAction.java
index ceeb7f9b3c..1478fbc252 100644
--- a/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/touchpoint/natives/actions/UntarAction.java
+++ b/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/internal/p2/touchpoint/natives/actions/UntarAction.java
@@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.p2.touchpoint.natives.actions;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Map;
@@ -22,6 +21,7 @@ import java.util.zip.GZIPInputStream;
import org.apache.tools.bzip2.CBZip2InputStream;
import org.apache.tools.tar.TarEntry;
import org.apache.tools.tar.TarInputStream;
+import org.eclipse.cdt.internal.p2.Activator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.engine.Profile;
@@ -59,15 +59,23 @@ public class UntarAction extends ProvisioningAction {
@Override
public IStatus execute(Map parameters) {
- return untar(parameters);
+ try {
+ return untar(parameters);
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e);
+ }
}
@Override
public IStatus undo(Map parameters) {
- return CleanupUntarAction.cleanup(parameters);
+ try {
+ return CleanupUntarAction.cleanup(parameters);
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e);
+ }
}
- public static IStatus untar(Map parameters) {
+ public static IStatus untar(Map parameters) throws Exception {
String source = (String)parameters.get(ActionConstants.PARM_SOURCE);
if (source == null)
return Util.createError(NLS.bind(Messages.param_not_set, ActionConstants.PARM_SOURCE, ACTION_NAME));
@@ -120,7 +128,7 @@ public class UntarAction extends ProvisioningAction {
return Status.OK_STATUS;
}
- private static File[] untar(String source, String destination, Compression compression) {
+ private static File[] untar(String source, String destination, Compression compression) throws Exception {
File zipFile = new File(source);
if (!zipFile.exists()) {
Util.log(UnzipAction.class.getName() + " the files to be unzipped is not here"); //$NON-NLS-1$
@@ -128,53 +136,47 @@ public class UntarAction extends ProvisioningAction {
File target = new File(destination);
- try {
- FileInputStream fileIn = new FileInputStream(zipFile);
- InputStream compIn = fileIn;
- if (compression.equals(Compression.gz))
- compIn = new GZIPInputStream(fileIn);
- else if (compression.equals(Compression.bz2)) {
- // Skip the magic bytes first
- fileIn.read(new byte[2]);
- compIn = new CBZip2InputStream(fileIn);
- }
+ FileInputStream fileIn = new FileInputStream(zipFile);
+ InputStream compIn = fileIn;
+ if (compression.equals(Compression.gz))
+ compIn = new GZIPInputStream(fileIn);
+ else if (compression.equals(Compression.bz2)) {
+ // Skip the magic bytes first
+ fileIn.read(new byte[2]);
+ compIn = new CBZip2InputStream(fileIn);
+ }
- ArrayList<File> fileList = new ArrayList<File>();
- TarInputStream tarIn = new TarInputStream(compIn);
- for (TarEntry tarEntry = tarIn.getNextEntry(); tarEntry != null; tarEntry = tarIn.getNextEntry()) {
- File outFile = new File(target, tarEntry.getName());
- if (tarEntry.isDirectory()) {
- outFile.mkdirs();
- } else {
- if (outFile.exists())
- outFile.delete();
- else
- outFile.getParentFile().mkdirs();
- FileOutputStream outStream = new FileOutputStream(outFile);
- tarIn.copyEntryContents(outStream);
- outStream.close();
+ ArrayList<File> fileList = new ArrayList<File>();
+ TarInputStream tarIn = new TarInputStream(compIn);
+ for (TarEntry tarEntry = tarIn.getNextEntry(); tarEntry != null; tarEntry = tarIn.getNextEntry()) {
+ File outFile = new File(target, tarEntry.getName());
+ if (tarEntry.isDirectory()) {
+ outFile.mkdirs();
+ } else {
+ if (outFile.exists())
+ outFile.delete();
+ else
+ outFile.getParentFile().mkdirs();
+ FileOutputStream outStream = new FileOutputStream(outFile);
+ tarIn.copyEntryContents(outStream);
+ outStream.close();
- // Set last modified time from the tar entry
- long lastModified = tarEntry.getModTime().getTime();
- outFile.setLastModified(lastModified);
+ // Set last modified time from the tar entry
+ long lastModified = tarEntry.getModTime().getTime();
+ outFile.setLastModified(lastModified);
- // Set the executable bits from the tar entry
- // we let the umask determine the r/w
- int mode = tarEntry.getMode();
- boolean exec = (mode & 0x111) != 0;
- boolean execOwner = (mode & 0x11) == 0;
-// outFile.setExecutable(exec, execOwner);
+ // Set the executable bits from the tar entry
+ // we let the umask determine the r/w
+ int mode = tarEntry.getMode();
+ boolean exec = (mode & 0x111) != 0;
+ boolean execOwner = (mode & 0x11) == 0;
+// outFile.setExecutable(exec, execOwner);
- fileList.add(outFile);
- }
+ fileList.add(outFile);
}
- tarIn.close();
- return fileList.toArray(new File[fileList.size()]);
- } catch (IOException e) {
- Util.log(UnzipAction.class.getName() + " error unzipping zipfile: " + zipFile.getAbsolutePath() + " destination: " + destination); //$NON-NLS-1$ //$NON-NLS-2$
- Util.log(e.getLocalizedMessage());
}
- return null;
+ tarIn.close();
+ return fileList.toArray(new File[fileList.size()]);
}
}

Back to the top