Skip to main content
summaryrefslogtreecommitdiffstats
path: root/p2
diff options
context:
space:
mode:
authorDoug Schaefer2008-12-18 16:58:02 -0500
committerDoug Schaefer2008-12-18 16:58:02 -0500
commited9ade92a23ebaaac7c625348488c79d38006be3 (patch)
tree265936db2e93773d2407b66798d27411ae3ea641 /p2
parent9a0bcfe2c6623508f020ba62dd33c6e9e9dc1984 (diff)
downloadorg.eclipse.cdt-ed9ade92a23ebaaac7c625348488c79d38006be3.tar.gz
org.eclipse.cdt-ed9ade92a23ebaaac7c625348488c79d38006be3.tar.xz
org.eclipse.cdt-ed9ade92a23ebaaac7c625348488c79d38006be3.zip
Add zlib. General clean up. Set versions to 5.0.0 consistently.
Diffstat (limited to 'p2')
-rw-r--r--p2/org.eclipse.cdt.p2-feature/feature.xml2
-rw-r--r--p2/org.eclipse.cdt.p2.generator/META-INF/MANIFEST.MF2
-rw-r--r--p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/MinGWGenerator.java35
-rw-r--r--p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/p2/internal/repo/artifact/InstallArtifactRepository.java4
-rw-r--r--p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/p2/internal/repo/artifact/ZipExtractor.java76
5 files changed, 105 insertions, 14 deletions
diff --git a/p2/org.eclipse.cdt.p2-feature/feature.xml b/p2/org.eclipse.cdt.p2-feature/feature.xml
index bf7113a479..936c588c6a 100644
--- a/p2/org.eclipse.cdt.p2-feature/feature.xml
+++ b/p2/org.eclipse.cdt.p2-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.cdt.p2"
label="%featureName"
- version="1.0.0.qualifier"
+ version="5.0.0.qualifier"
provider-name="%providerName"
plugin="org.eclipse.cdt.p2">
diff --git a/p2/org.eclipse.cdt.p2.generator/META-INF/MANIFEST.MF b/p2/org.eclipse.cdt.p2.generator/META-INF/MANIFEST.MF
index 439a879d82..3bd1a1bd33 100644
--- a/p2/org.eclipse.cdt.p2.generator/META-INF/MANIFEST.MF
+++ b/p2/org.eclipse.cdt.p2.generator/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Generator Plug-in
Bundle-SymbolicName: org.eclipse.cdt.p2.generator;singleton:=true
-Bundle-Version: 1.0.0
+Bundle-Version: 5.0.0.qualifier
Bundle-Activator: org.eclipse.cdt.p2.generator.Activator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.p2;bundle-version="5.0.0",
diff --git a/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/MinGWGenerator.java b/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/MinGWGenerator.java
index 6d56ea6db3..b1ac1bd050 100644
--- a/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/MinGWGenerator.java
+++ b/p2/org.eclipse.cdt.p2.generator/src/org/eclipse/cdt/p2/generator/MinGWGenerator.java
@@ -71,6 +71,7 @@ public class MinGWGenerator implements IApplication {
License publicDomainLic = MetadataFactory.createLicense(null, publicDomain);
License gplLic = MetadataFactory.createLicense(gplURL, gpl);
License lgplLic = MetadataFactory.createLicense(lgplURL, lgpl);
+ License zlibLic = MetadataFactory.createLicense(zlibLicURL, zlibLicText);
Version wascanaVersion = new Version("1.0.0");
String mingwSubdir = "mingw";
@@ -78,7 +79,7 @@ public class MinGWGenerator implements IApplication {
// MinGW Runtime
String runtimeId = "wascana.mingw.mingwrt";
Version runtimeVersion = new Version("4.15.1");
- InstallableUnitDescription runtimeIUDesc = createIUDesc(runtimeId, runtimeVersion, "MinGW Runtime Library", publicDomainLic);
+ InstallableUnitDescription runtimeIUDesc = createIUDesc(runtimeId, runtimeVersion, "Wascana MinGW Runtime Library", publicDomainLic);
IInstallableUnit runtimeIU = createIU(runtimeIUDesc, runtimeId, runtimeVersion,
"http://downloads.sourceforge.net/mingw/mingwrt-3.15.1-mingw32.tar.gz",
mingwSubdir,
@@ -87,7 +88,7 @@ public class MinGWGenerator implements IApplication {
// w32api
String w32apiId = "wascana.mingw.w32api";
Version w32apiVersion = new Version("3.13");
- InstallableUnitDescription w32apiIUDesc = createIUDesc(w32apiId, w32apiVersion, "MinGW Windows Library", publicDomainLic);
+ InstallableUnitDescription w32apiIUDesc = createIUDesc(w32apiId, w32apiVersion, "Wascana MinGW Windows Library", publicDomainLic);
IInstallableUnit w32apiIU = createIU(w32apiIUDesc, w32apiId, w32apiVersion,
"http://downloads.sourceforge.net/mingw/w32api-3.13-mingw32-dev.tar.gz",
mingwSubdir,
@@ -96,7 +97,7 @@ public class MinGWGenerator implements IApplication {
// binutils
String binutilsId = "wascana.mingw.binutils";
Version binutilsVersion = new Version("2.19");
- InstallableUnitDescription binutilsIUDesc = createIUDesc(binutilsId, binutilsVersion, "MinGW binutils", gplLic);
+ InstallableUnitDescription binutilsIUDesc = createIUDesc(binutilsId, binutilsVersion, "Wascana MinGW binutils", gplLic);
IInstallableUnit binutilsIU = createIU(binutilsIUDesc, binutilsId, binutilsVersion,
"http://downloads.sourceforge.net/mingw/binutils-2.19-mingw32-bin.tar.gz",
mingwSubdir,
@@ -105,7 +106,7 @@ public class MinGWGenerator implements IApplication {
// gcc-4 core
String gcc4coreId = "wascana.mingw.gcc4.core";
Version gcc4Version = new Version("4.3.2.tdm-1");
- InstallableUnitDescription gcc4coreIUDesc = createIUDesc(gcc4coreId, gcc4Version, "MinGW gcc-4 core", gplLic);
+ InstallableUnitDescription gcc4coreIUDesc = createIUDesc(gcc4coreId, gcc4Version, "Wascana MinGW gcc-4 core", gplLic);
RequiredCapability[] gcc4coreReqs = new RequiredCapability[] {
MetadataFactory.createRequiredCapability(
IInstallableUnit.NAMESPACE_IU_ID,
@@ -125,7 +126,7 @@ public class MinGWGenerator implements IApplication {
// gcc-4 g++
String gcc4gppId = "wascana.mingw.gcc4.g++";
- InstallableUnitDescription gcc4gppIUDesc = createIUDesc(gcc4gppId, gcc4Version, "MinGW gcc-4 g++", gplLic);
+ InstallableUnitDescription gcc4gppIUDesc = createIUDesc(gcc4gppId, gcc4Version, "Wascana MinGW gcc-4 g++", gplLic);
gcc4gppIUDesc.setLicense(gplLic);
RequiredCapability[] gcc4gppReqs = new RequiredCapability[] {
MetadataFactory.createRequiredCapability(
@@ -141,7 +142,7 @@ public class MinGWGenerator implements IApplication {
// gdb
String gdbId = "wascana.mingw.gdb";
Version gdbVersion = new Version("6.8.0.4");
- InstallableUnitDescription gdbIUDesc = createIUDesc(gdbId, gdbVersion, "MinGW gdb", gplLic);
+ InstallableUnitDescription gdbIUDesc = createIUDesc(gdbId, gdbVersion, "Wascana MinGW gdb", gplLic);
IInstallableUnit gdbIU = createIU(gdbIUDesc, gdbId, gdbVersion,
"http://downloads.sourceforge.net/mingw/gdb-6.8-mingw-3.tar.bz2",
mingwSubdir,
@@ -150,7 +151,7 @@ public class MinGWGenerator implements IApplication {
// msys
String msysId = "wascana.msys.core";
Version msysVersion = new Version("1.0.11.20080826");
- InstallableUnitDescription msysIUDesc = createIUDesc(msysId, msysVersion, "MSYS Build System", gplLic);
+ InstallableUnitDescription msysIUDesc = createIUDesc(msysId, msysVersion, "Wascana MSYS Build System", gplLic);
IInstallableUnit msysIU = createIU(msysIUDesc, msysId, msysVersion,
"http://downloads.sourceforge.net/mingw/msysCORE-1.0.11-20080826.tar.gz",
"msys",
@@ -185,10 +186,19 @@ public class MinGWGenerator implements IApplication {
mingwToolchainDesc.setRequiredCapabilities(mingwToolchainReqs);
IInstallableUnit mingwToolchainIU = MetadataFactory.createInstallableUnit(mingwToolchainDesc);
+ // zlib
+ String zlibId = "wascana.zlib";
+ Version zlibVersion = new Version("1.2.3");
+ InstallableUnitDescription zlibIUDesc = createIUDesc(zlibId, zlibVersion, "Wascana zlib Library", zlibLic);
+ IInstallableUnit zlibIU = createIU(zlibIUDesc, zlibId, zlibVersion,
+ "http://downloads.sourceforge.net/wascana/zlib-mingw-1.2.3.zip",
+ mingwSubdir,
+ InstallArtifactRepository.ZIP_COMPRESSION);
+
// SDL
String sdlId = "wascana.sdl";
Version sdlVersion = new Version("1.2.13");
- InstallableUnitDescription sdlIUDesc = createIUDesc(sdlId, sdlVersion, "SDL (Simple Directmedia Layer) Library", lgplLic);
+ InstallableUnitDescription sdlIUDesc = createIUDesc(sdlId, sdlVersion, "Wascana SDL (Simple Directmedia Layer) Library", lgplLic);
IInstallableUnit sdlIU = createIU(sdlIUDesc, sdlId, sdlVersion,
"http://www.libsdl.org/release/SDL-devel-1.2.13-mingw32.tar.gz",
mingwSubdir,
@@ -200,7 +210,7 @@ public class MinGWGenerator implements IApplication {
RequiredCapability[] libsReqs = new RequiredCapability[] {
MetadataFactory.createRequiredCapability(
IInstallableUnit.NAMESPACE_IU_ID,
- sdlIU.getId(), new VersionRange(null), null, false, false),
+ zlibIU.getId(), new VersionRange(null), null, false, false),
};
libsIUDesc.setRequiredCapabilities(libsReqs);
IInstallableUnit libsIU = MetadataFactory.createInstallableUnit(libsIUDesc);
@@ -215,8 +225,8 @@ public class MinGWGenerator implements IApplication {
msysIU,
mingwToolchainIU,
-// sdlIU,
-// libsIU
+ zlibIU,
+ libsIU
});
System.out.println("done");
@@ -269,4 +279,7 @@ public class MinGWGenerator implements IApplication {
public static final String lgpl = "GNU LESSER GENERAL PUBLIC LICENSE\n" + lgplURL;
+ public static final String zlibLicURL = "http://www.zlib.net/zlib_license.html";
+
+ public static final String zlibLicText = "http://www.zlib.net/zlib_license.html";
}
diff --git a/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/p2/internal/repo/artifact/InstallArtifactRepository.java b/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/p2/internal/repo/artifact/InstallArtifactRepository.java
index 50ddd518c7..9c105aa88d 100644
--- a/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/p2/internal/repo/artifact/InstallArtifactRepository.java
+++ b/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/p2/internal/repo/artifact/InstallArtifactRepository.java
@@ -232,7 +232,9 @@ public class InstallArtifactRepository extends AbstractArtifactRepository {
PipedInputStream in = new PipedInputStream(out);
String compression = descriptor.getProperty(COMPRESSION);
if (ZIP_COMPRESSION.equals(compression)) {
- // TODO a zip extractor
+ ZipExtractor extractor = new ZipExtractor(in, installDir,
+ new FileListWriter(getFileListFile(descriptor.getArtifactKey().getId())));
+ extractor.start();
} else {
TarExtractor extractor = new TarExtractor(in, installDir,
new FileListWriter(getFileListFile(descriptor.getArtifactKey().getId())),
diff --git a/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/p2/internal/repo/artifact/ZipExtractor.java b/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/p2/internal/repo/artifact/ZipExtractor.java
new file mode 100644
index 0000000000..ef7d046343
--- /dev/null
+++ b/p2/org.eclipse.cdt.p2/src/org/eclipse/cdt/p2/internal/repo/artifact/ZipExtractor.java
@@ -0,0 +1,76 @@
+package org.eclipse.cdt.p2.internal.repo.artifact;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+public class ZipExtractor extends Thread {
+
+ private final InputStream in;
+ private final File installDir;
+ private final FileListWriter fileListWriter;
+
+ public ZipExtractor(InputStream in, File installDir, FileListWriter fileListWriter) {
+ this.in = in;
+ this.installDir = installDir;
+ this.fileListWriter = fileListWriter;
+ }
+
+ @Override
+ public void run() {
+ try {
+ ZipInputStream zipIn = new ZipInputStream(in);
+ for (ZipEntry zipEntry = zipIn.getNextEntry(); zipEntry != null; zipEntry = zipIn.getNextEntry()) {
+ File outFile = new File(installDir, zipEntry.getName());
+ if (zipEntry.isDirectory()) {
+ outFile.mkdirs();
+ } else {
+ if (outFile.exists())
+ outFile.delete();
+ else
+ outFile.getParentFile().mkdirs();
+ FileOutputStream outStream = new FileOutputStream(outFile);
+ copyStream(zipIn, false, outStream, true);
+ long lastModified = zipEntry.getTime();
+ outFile.setLastModified(lastModified);
+ fileListWriter.addFile(new InstalledFile(outFile, lastModified));
+ }
+ zipIn.closeEntry();
+ }
+ zipIn.close();
+ fileListWriter.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ private static int copyStream(InputStream in, boolean closeIn, OutputStream out, boolean closeOut) throws IOException {
+ try {
+ int written = 0;
+ byte[] buffer = new byte[1024];
+ int len;
+ while ((len = in.read(buffer)) != -1) {
+ out.write(buffer, 0, len);
+ written += len;
+ }
+ return written;
+ } finally {
+ try {
+ if (closeIn) {
+ in.close();
+ }
+ } finally {
+ if (closeOut) {
+ out.close();
+ }
+ }
+ }
+ }
+
+}

Back to the top