diff --git a/build.xml b/build.xml index c2e2481c48..911c75d015 100644 --- a/build.xml +++ b/build.xml @@ -451,6 +451,8 @@ + + @@ -460,7 +462,19 @@ + + + + + + + + + diff --git a/core/java/src/net/i2p/util/FileUtil.java b/core/java/src/net/i2p/util/FileUtil.java index fda5066412..ef73113018 100644 --- a/core/java/src/net/i2p/util/FileUtil.java +++ b/core/java/src/net/i2p/util/FileUtil.java @@ -12,9 +12,12 @@ import java.io.OutputStream; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; +import java.util.jar.JarOutputStream; +import java.util.jar.Pack200; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; + /** * General helper methods for messing with files * @@ -75,6 +78,10 @@ public class FileUtil { } } + /** + * As of release 0.7.12, any files inside the zip that have a .jar.pack or .war.pack suffix + * are transparently unpacked to a .jar or .war file using unpack200. + */ public static boolean extractZip(File zipfile, File targetDir) { ZipFile zip = null; try { @@ -109,15 +116,22 @@ public class FileUtil { } else { try { InputStream in = zip.getInputStream(entry); - FileOutputStream fos = new FileOutputStream(target); - int read = 0; - while ( (read = in.read(buf)) != -1) { - fos.write(buf, 0, read); + if (entry.getName().endsWith(".jar.pack") || entry.getName().endsWith(".war.pack")) { + target = new File(targetDir, entry.getName().substring(0, entry.getName().length() - ".pack".length())); + JarOutputStream fos = new JarOutputStream(new FileOutputStream(target)); + Pack200.newUnpacker().unpack(in, fos); + fos.close(); + System.err.println("INFO: File [" + entry.getName() + "] extracted and unpacked"); + } else { + FileOutputStream fos = new FileOutputStream(target); + int read = 0; + while ( (read = in.read(buf)) != -1) { + fos.write(buf, 0, read); + } + fos.close(); + System.err.println("INFO: File [" + entry.getName() + "] extracted"); } - fos.close(); in.close(); - - System.err.println("INFO: File [" + entry.getName() + "] extracted"); } catch (IOException ioe) { System.err.println("ERROR: Error extracting the zip entry (" + entry.getName() + "]"); ioe.printStackTrace(); diff --git a/history.txt b/history.txt index 895bba302a..07595dd115 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,9 @@ +2010-02-23 zzz + * Unzip: Any files in the zip with a .jar.pack or .war.pack extension + will be transparently unpacked with unpack200. Savings is about 60%. + Someday we will do this for suds, but we can do it for xpi2ps now. + * build: Add updater200 target + 2010-02-22 zzz * configclients.jsp: - Add js delete confirm diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 687f8db2f2..8c54ff98c5 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 4; + public final static long BUILD = 5; /** for example "-test" */ public final static String EXTRA = "";