Changeset 6962 in josm for trunk/src


Ignore:
Timestamp:
2014-04-07T23:49:09+02:00 (10 years ago)
Author:
Don-vip
Message:

see #8465 - rework apturl stuff

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r6953 r6962  
    4848                    os.startsWith("Linux Debian GNU/Linux 7") || os.startsWith("Linux Mint") ||
    4949                    os.startsWith("Linux Ubuntu 12") || os.startsWith("Linux Ubuntu 13") || os.startsWith("Linux Ubuntu 14"))) {
    50                 askUpdateJava(java, "apt://openjdk-7-jre");
     50                String url;
     51                // apturl does not exist on Debian (see #8465)
     52                if (os.startsWith("Linux Debian")) {
     53                    url = "https://packages.debian.org/stable/openjdk-7-jre";
     54                } else if (getPackageDetails("apturl") != null) {
     55                    url = "apt://openjdk-7-jre";
     56                } else if (os.startsWith("Linux Mint")) {
     57                    url = "http://community.linuxmint.com/software/view/openjdk-7-jre";
     58                } else {
     59                    url = "http://packages.ubuntu.com/trusty/openjdk-7-jre";
     60                }
     61                askUpdateJava(java, url);
    5162            }
    5263        }
     
    149160     * @return The package name and package version if it can be identified, null otherwise
    150161     */
    151     public String getPackageDetails(String packageName) {
     162    public static String getPackageDetails(String packageName) {
    152163        try {
    153             String version = Utils.execOutput(Arrays.asList("dpkg-query", "--show", "--showformat", "${Architecture}-${Version}", packageName));
    154             return packageName + ":" + version;
     164            String version = Utils.execOutput(Arrays.asList(
     165                    "dpkg-query", "--show", "--showformat", "${Architecture}-${Version}", packageName));
     166            if (version != null) {
     167                return packageName + ":" + version;
     168            }
    155169        } catch (IOException e) {
    156170            Main.warn(e);
    157             return null;
    158         }
     171        }
     172        return null;
    159173    }
    160174
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r6889 r6962  
    804804     */
    805805    public static String execOutput(List<String> command) throws IOException {
     806        if (Main.isDebugEnabled()) {
     807            Main.debug(join(" ", command));
     808        }
    806809        Process p = new ProcessBuilder(command).start();
    807810        BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
     
    817820        }
    818821        Utils.close(input);
    819         return all.toString();
     822        return all != null ? all.toString() : null;
    820823    }
    821824
Note: See TracChangeset for help on using the changeset viewer.