JAL-3252 tgz unpacking no longer needed by getdown. Unfinished code and dependency...
authorBen Soares <bsoares@dundee.ac.uk>
Mon, 17 Feb 2020 14:49:18 +0000 (14:49 +0000)
committerBen Soares <bsoares@dundee.ac.uk>
Mon, 17 Feb 2020 14:49:18 +0000 (14:49 +0000)
19 files changed:
JAVA-11-README
THIRDPARTYLIBS
build.gradle
getdown/lib/getdown-core.jar
getdown/lib/getdown-launcher-local.jar
getdown/lib/getdown-launcher.jar
getdown/src/getdown/ant/pom.xml
getdown/src/getdown/core/pom.xml
getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java
getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Resource.java
getdown/src/getdown/core/src/main/java/com/threerings/getdown/util/FileUtil.java
getdown/src/getdown/launcher/pom.xml
getdown/src/getdown/lib/commons-compress-1.18.jar [deleted file]
getdown/src/getdown/mvn_cmd
getdown/src/getdown/pom.xml
j11lib/commons-compress-1.18.jar [deleted file]
j11lib/getdown-core.jar
j8lib/commons-compress-1.18.jar [deleted file]
j8lib/getdown-core.jar

index fabae31..028aa44 100644 (file)
@@ -3,8 +3,6 @@ Notes below are out of date, but might be useful for future development with Jav
 
 Presently the Java 11 build of Jalview treats all libraries as libraries on the classpath, and does not use them as modules. The Java 11 JRE prepped for future release is a standard AdoptOpenJDK release (possibly repackaged for getdown/install4j to use).
 
-At time of writing, the JRE cannot be updated over the air on macOS platform due to a limitation of getdown's unpackaging system only using jars and hence cannot work with symbolic links.  There is a symbolic link that is essential (as a symbolic link) in the macOS distribution (Contents/MacOS/libjli.dylib -> ../Home/lib/jli/libjli.dylib).  Without this, the install4j launcher will not work.  Some work has started on incorporating tar capabilities in getdown using the apache-commons-compress library, though this is not complete.
-
 Future releases might incorporate Java 11 modules into a bespoke Java 11 JRE that can be updated over the air via getdown.This could reduce the size of the distribution but will absolutely need the bespoke JRE.  This would mean Jalview being restricted to platforms that we (can) support, or distributing the modules as libraries in a second distribution (the shadowJar distribution).
 
 build.gradle is written to support compilation of either Java 1.8 or Java 11 compatible bytecode.  Please note that the compilation (and therefore build) process REQUIRES a Java 11 (or above) JDK.  This is because there is Java 11 specific code in some Jalview classes (devolved into separate classes which fail "gracefully" when read by a Java 1.8 JRE).
index 348827e..fa922d9 100644 (file)
@@ -21,7 +21,6 @@ axis.jar
 biojava-core-4.1.0.jar LGPLv2.1 - latest license at https://github.com/biojava/biojava/blob/master/LICENSE
 biojava-ontology-4.1.0.jar     LGPLv2.1 - latest license at https://github.com/biojava/biojava/blob/master/LICENSE
 commons-codec-1.3.jar
-commons-compress-1.18.jar
 commons-logging-1.1.1.jar
 getdown-core.jar       Getdown license - https://github.com/threerings/getdown/blob/master/LICENSE
 groovy-all-2.4.12-indy.jar     APL 2.0 License - downloaded and extracted from https://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.6.zip
index 522ce38..aeb62b6 100644 (file)
@@ -32,7 +32,6 @@ repositories {
 }
 
 dependencies {
-  compile 'org.apache.commons:commons-compress:1.18'
 }
 
 
index 5f3f9f0..794ca85 100644 (file)
Binary files a/getdown/lib/getdown-core.jar and b/getdown/lib/getdown-core.jar differ
index c976354..f273c51 100644 (file)
Binary files a/getdown/lib/getdown-launcher-local.jar and b/getdown/lib/getdown-launcher-local.jar differ
index a10b5d4..27d1b8e 100644 (file)
Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ
index b68fa8b..ff1c73a 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.threerings.getdown</groupId>
     <artifactId>getdown</artifactId>
-    <version>1.8.3-1.2.2_FJVL</version>
+    <version>1.8.3-1.2.3_FJVL</version>
   </parent>
 
   <artifactId>getdown-ant</artifactId>
index a170813..7eb03a8 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.threerings.getdown</groupId>
     <artifactId>getdown</artifactId>
-    <version>1.8.3-1.2.2_FJVL</version>
+    <version>1.8.3-1.2.3_FJVL</version>
   </parent>
 
   <artifactId>getdown-core</artifactId>
index 4184953..fd53c79 100644 (file)
@@ -28,7 +28,7 @@ import java.util.regex.Pattern;
 import java.util.zip.GZIPInputStream;
 
 import jalview.bin.MemorySetting;
-import com.install4j.api.launcher.Variables;
+//import com.install4j.api.launcher.Variables;
 
 import com.threerings.getdown.util.*;
 // avoid ambiguity with java.util.Base64 which we can't use as it's 1.8+
index adc2d4f..d48f1d6 100644 (file)
@@ -18,10 +18,6 @@ import java.util.Locale;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 
-import org.apache.commons.compress.archivers.ArchiveInputStream;
-import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
-import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
-
 import com.threerings.getdown.util.FileUtil;
 import com.threerings.getdown.util.ProgressObserver;
 import com.threerings.getdown.util.StringUtil;
@@ -145,14 +141,11 @@ public class Resource implements Comparable<Resource>
         _marker = new File(lpath + "v");
 
         _attrs = attrs;
-        _isTgz = isTgz(lpath);
         _isJar = isJar(lpath);
         _isPacked200Jar = isPacked200Jar(lpath);
         boolean unpack = attrs.contains(Attr.UNPACK);
         if (unpack && _isJar) {
             _unpacked = _local.getParentFile();
-        } else if(unpack && _isTgz) {
-            _unpacked = _local.getParentFile();
         } else if(unpack && _isPacked200Jar) {
             String dotJar = ".jar", lname = _local.getName();
             String uname = lname.substring(0, lname.lastIndexOf(dotJar) + dotJar.length());
@@ -307,20 +300,13 @@ public class Resource implements Comparable<Resource>
     public void unpack () throws IOException
     {
         // sanity check
-        if (!_isJar && !_isPacked200Jar && !_isTgz) {
-            throw new IOException("Requested to unpack non-jar/tgz file '" + _local + "'.");
+        if (!_isJar && !_isPacked200Jar) {
+            throw new IOException("Requested to unpack non-jar file '" + _local + "'.");
         }
         if (_isJar) {
             try (JarFile jar = new JarFile(_local)) {
                 FileUtil.unpackJar(jar, _unpacked, _attrs.contains(Attr.CLEAN));
             }
-        } else if (_isTgz) {
-            try (InputStream fi = Files.newInputStream(_local.toPath());
-                         InputStream bi = new BufferedInputStream(fi);
-                         InputStream gzi = new GzipCompressorInputStream(bi);
-                         TarArchiveInputStream tgz = new TarArchiveInputStream(gzi)) {
-                    FileUtil.unpackTgz(tgz, _unpacked, _attrs.contains(Attr.CLEAN));
-            }
         } else {
             FileUtil.unpackPacked200Jar(_local, _unpacked);
         }
@@ -387,11 +373,6 @@ public class Resource implements Comparable<Resource>
         return path.endsWith(".jar") || path.endsWith(".jar_new");
     }
     
-    protected static boolean isTgz (String path)
-    {
-        return path.endsWith(".tgz") || path.endsWith(".tgz_new");
-    }
-
     protected static boolean isPacked200Jar (String path)
     {
         return path.endsWith(".jar.pack") || path.endsWith(".jar.pack_new") ||
@@ -402,7 +383,7 @@ public class Resource implements Comparable<Resource>
     protected URL _remote;
     protected File _local, _localNew, _marker, _unpacked;
     protected EnumSet<Attr> _attrs;
-    protected boolean _isJar, _isPacked200Jar, _isTgz;
+    protected boolean _isJar, _isPacked200Jar;
 
     /** Used to sort the entries in a jar file. */
     protected static final Comparator<JarEntry> ENTRY_COMP = new Comparator<JarEntry>() {
index 67d0330..bba6c44 100644 (file)
@@ -12,11 +12,6 @@ import java.util.*;
 import java.util.jar.*;
 import java.util.zip.GZIPInputStream;
 
-import org.apache.commons.compress.archivers.ArchiveEntry;
-import org.apache.commons.compress.archivers.ArchiveInputStream;
-import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
-import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
-
 import com.threerings.getdown.util.StreamUtil;
 import com.threerings.getdown.Log;
 import static com.threerings.getdown.Log.log;
@@ -174,75 +169,6 @@ public class FileUtil
     }
 
     /**
-     * Unpacks the specified tgz file into the specified target directory.
-     * @param cleanExistingDirs if true, all files in all directories contained in {@code tgz} will
-     * be deleted prior to unpacking the tgz.
-     */
-    public static void unpackTgz (TarArchiveInputStream tgz, File target, boolean cleanExistingDirs)
-        throws IOException
-    {
-               TarArchiveEntry entry;
-               while ((entry = tgz.getNextTarEntry()) != null) {
-            // sanitize the entry name
-                       String entryName = entry.getName();
-                       if (entryName.startsWith(File.separator))
-                       {
-                               entryName = entryName.substring(File.separator.length());
-                       }
-            File efile = new File(target, entryName);
-
-            // if we're unpacking a normal tgz file, it will have special path
-            // entries that allow us to create our directories first
-            if (entry.isDirectory()) {
-               
-                               if (cleanExistingDirs) {
-                    if (efile.exists()) {
-                        for (File f : efile.listFiles()) {
-                            if (!f.isDirectory())
-                            f.delete();
-                        }
-                    }
-                               }
-                               
-                if (!efile.exists() && !efile.mkdir()) {
-                    log.warning("Failed to create tgz entry path", "tgz", tgz, "entry", entry);
-                }
-                continue;
-            }
-
-            // but some do not, so we want to ensure that our directories exist
-            // prior to getting down and funky
-            File parent = new File(efile.getParent());
-            if (!parent.exists() && !parent.mkdirs()) {
-                log.warning("Failed to create tgz entry parent", "tgz", tgz, "parent", parent);
-                continue;
-            }
-
-            if (entry.isLink())
-            {
-               System.out.println("Creating hard link "+efile.getName()+" -> "+entry.getLinkName());
-               Files.createLink(efile.toPath(), Paths.get(entry.getLinkName()));
-               continue;
-            }
-
-            if (entry.isSymbolicLink())
-            {
-               System.out.println("Creating symbolic link "+efile.getName()+" -> "+entry.getLinkName());
-               Files.createSymbolicLink(efile.toPath(), Paths.get(entry.getLinkName()));
-               continue;
-            }
-            
-            try (BufferedOutputStream fout = new BufferedOutputStream(new FileOutputStream(efile));
-                InputStream tin = tgz;) {
-                StreamUtil.copy(tin, fout);
-            } catch (Exception e) {
-                throw new IOException(
-                    Log.format("Failure unpacking", "tgz", tgz, "entry", efile), e);
-            }
-        }
-    }
-
-    /**
      * Unpacks a pack200 packed jar file from {@code packedJar} into {@code target}. If {@code
      * packedJar} has a {@code .gz} extension, it will be gunzipped first.
      */
index 109636a..dc2e676 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.threerings.getdown</groupId>
     <artifactId>getdown</artifactId>
-    <version>1.8.3-1.2.2_FJVL</version>
+    <version>1.8.3-1.2.3_FJVL</version>
   </parent>
 
   <artifactId>getdown-launcher</artifactId>
diff --git a/getdown/src/getdown/lib/commons-compress-1.18.jar b/getdown/src/getdown/lib/commons-compress-1.18.jar
deleted file mode 100644 (file)
index e401046..0000000
Binary files a/getdown/src/getdown/lib/commons-compress-1.18.jar and /dev/null differ
index cb001aa..0d2315d 100755 (executable)
@@ -3,7 +3,7 @@
 if [ x$JVLVERSION != x ]; then
   export VERSION=$JVLVERSION
 else
-  export VERSION=1.8.3-1.2.2_JVL
+  export VERSION=1.8.3-1.2.3_JVL
 fi
 
 if [ x${VERSION%_JVL} = x$VERSION ]; then
index 586f595..0299940 100644 (file)
@@ -10,7 +10,7 @@
   <groupId>com.threerings.getdown</groupId>
   <artifactId>getdown</artifactId>
   <packaging>pom</packaging>
-  <version>1.8.3-1.2.2_FJVL</version>
+  <version>1.8.3-1.2.3_FJVL</version>
 
   <name>getdown</name>
   <description>An application installer and updater.</description>
 
   <dependencies>
     <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-compress</artifactId>
-      <version>1.18</version>
+      <groupId>com.install4j</groupId>
+      <artifactId>install4j-runtime</artifactId>
+      <version>7.0.11</version>
+      <scope>provided</scope>
     </dependency>
-    <dependency>
-               <groupId>com.install4j</groupId>
-               <artifactId>install4j-runtime</artifactId>
-               <version>7.0.11</version>
-               <scope>provided</scope>
-       </dependency>
   </dependencies>
 
   <build>
diff --git a/j11lib/commons-compress-1.18.jar b/j11lib/commons-compress-1.18.jar
deleted file mode 100644 (file)
index e401046..0000000
Binary files a/j11lib/commons-compress-1.18.jar and /dev/null differ
index 5f3f9f0..794ca85 100644 (file)
Binary files a/j11lib/getdown-core.jar and b/j11lib/getdown-core.jar differ
diff --git a/j8lib/commons-compress-1.18.jar b/j8lib/commons-compress-1.18.jar
deleted file mode 100644 (file)
index e401046..0000000
Binary files a/j8lib/commons-compress-1.18.jar and /dev/null differ
index 5f3f9f0..794ca85 100644 (file)
Binary files a/j8lib/getdown-core.jar and b/j8lib/getdown-core.jar differ