Changeset 6850 in josm
- Timestamp:
- 2014-02-14T01:09:29+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r6643 r6850 69 69 * @return The report header (software and system info) 70 70 */ 71 public static String getReportHeader() 72 { 71 public static String getReportHeader() { 73 72 StringBuilder text = new StringBuilder(); 74 73 text.append(Version.getInstance().getReleaseAttributes()); … … 87 86 text.append("\n"); 88 87 if (Main.platform.getClass() == PlatformHookUnixoid.class) { 88 // Add Java package details for Debian/Ubuntu 89 89 String packageDetails = ((PlatformHookUnixoid) Main.platform).getJavaPackageDetails(); 90 90 if (packageDetails != null) { … … 92 92 text.append(packageDetails); 93 93 text.append("\n"); 94 } 95 // Add WebStart package details for Debian/Ubuntu, if run from JNLP 96 if (Package.getPackage("javax.jnlp") != null) { 97 String webStartDetails = ((PlatformHookUnixoid) Main.platform).getWebStartPackageDetails(); 98 if (webStartDetails != null) { 99 text.append("WebStart package: "); 100 text.append(webStartDetails); 101 text.append("\n"); 102 } 94 103 } 95 104 } -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r6682 r6850 110 110 111 111 /** 112 * Determines if the distribution is Debian or Ubuntu. 113 * @return {@code true} if the distribution is Debian or Ubuntu, {@code false} otherwise 114 */ 115 public static boolean isDebianOrUbuntu() { 116 try { 117 String dist = Utils.execOutput(Arrays.asList("lsb_release", "-i", "-s")); 118 return "Debian".equalsIgnoreCase(dist) || "Ubuntu".equalsIgnoreCase(dist); 119 } catch (IOException e) { 120 Main.warn(e); 121 return false; 122 } 123 } 124 125 /** 126 * Get the package name including detailed version. 127 * @param packageName The package name 128 * @return The package name and package version if it can be identified, null otherwise 129 */ 130 public String getPackageDetails(String packageName) { 131 try { 132 String version = Utils.execOutput(Arrays.asList("dpkg-query", "--show", "--showformat", "${Architecture}-${Version}", packageName)); 133 return packageName + ":" + version; 134 } catch (IOException e) { 135 Main.warn(e); 136 return null; 137 } 138 } 139 140 /** 112 141 * Get the Java package name including detailed version. 113 142 * … … 123 152 */ 124 153 public String getJavaPackageDetails() { 125 try { 126 String dist = Utils.execOutput(Arrays.asList("lsb_release", "-i", "-s")); 127 if ("Debian".equalsIgnoreCase(dist) || "Ubuntu".equalsIgnoreCase(dist)) { 128 String javaHome = System.getProperty("java.home"); 129 if ("/usr/lib/jvm/java-6-openjdk-amd64/jre".equals(javaHome) || 130 "/usr/lib/jvm/java-6-openjdk-i386/jre".equals(javaHome) || 131 "/usr/lib/jvm/java-6-openjdk/jre".equals(javaHome)) { 132 String version = Utils.execOutput(Arrays.asList("dpkg-query", "--show", "--showformat", "${Architecture}-${Version}", "openjdk-6-jre")); 133 return "openjdk-6-jre:" + version; 134 } 135 if ("/usr/lib/jvm/java-7-openjdk-amd64/jre".equals(javaHome) || 136 "/usr/lib/jvm/java-7-openjdk-i386/jre".equals(javaHome)) { 137 String version = Utils.execOutput(Arrays.asList("dpkg-query", "--show", "--showformat", "${Architecture}-${Version}", "openjdk-7-jre")); 138 return "openjdk-7-jre:" + version; 139 } 140 } 141 } catch (IOException e) { 142 Main.warn(e); 154 if (isDebianOrUbuntu()) { 155 String javaHome = System.getProperty("java.home"); 156 if ("/usr/lib/jvm/java-6-openjdk-amd64/jre".equals(javaHome) || 157 "/usr/lib/jvm/java-6-openjdk-i386/jre".equals(javaHome) || 158 "/usr/lib/jvm/java-6-openjdk/jre".equals(javaHome)) { 159 return getPackageDetails("openjdk-6-jre"); 160 } 161 if ("/usr/lib/jvm/java-7-openjdk-amd64/jre".equals(javaHome) || 162 "/usr/lib/jvm/java-7-openjdk-i386/jre".equals(javaHome)) { 163 return getPackageDetails("openjdk-7-jre"); 164 } 165 } 166 return null; 167 } 168 169 /** 170 * Get the Web Start package name including detailed version. 171 * 172 * Debian and Ubuntu OpenJDK packages are shipped with icedtea-web package, 173 * but its version does not match main java package version. 174 * 175 * Only Debian based distributions are covered at the moment. 176 * This can be extended to other distributions if needed. 177 * 178 * Simply return {@code null} if there's no separate package for Java WebStart. 179 * 180 * @return The package name and package version if it can be identified, null otherwise 181 */ 182 public String getWebStartPackageDetails() { 183 if (isDebianOrUbuntu()) { 184 String javaHome = System.getProperty("java.home"); 185 if (javaHome != null && javaHome.contains("openjdk")) { 186 return getPackageDetails("icedtea-netx"); 187 } 143 188 } 144 189 return null;
Note:
See TracChangeset
for help on using the changeset viewer.