8238953: tools/jpackage tests do not work on Ubuntu Linux

Reviewed-by: asemenyuk, clanger
This commit is contained in:
Matthias Baesken 2020-02-18 16:46:08 +01:00
parent 7f3bbc3f20
commit 09f5194d38
2 changed files with 27 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -117,9 +117,8 @@ public enum PackageType {
MAC.stream()).collect(Collectors.toUnmodifiableSet());
private final static class Inner {
private final static Set<String> DISABLED_PACKAGERS = Optional.ofNullable(
TKit.tokenizeConfigProperty("disabledPackagers")).orElse(
Collections.emptySet());
TKit.isUbuntu() ? Set.of("rpm") : Collections.emptySet());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,10 @@
*/
package jdk.jpackage.test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
@ -178,6 +181,27 @@ final public class TKit {
return ((OS.contains("nix") || OS.contains("nux")));
}
public static boolean isUbuntu() {
if (!isLinux()) {
return false;
}
File releaseFile = new File("/etc/os-release");
if (releaseFile.exists()) {
try (BufferedReader lineReader = new BufferedReader(new FileReader(releaseFile))) {
String lineText = null;
while ((lineText = lineReader.readLine()) != null) {
if (lineText.indexOf("NAME=\"Ubuntu") != -1) {
lineReader.close();
return true;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
return false;
}
static void log(String v) {
System.out.println(v);
if (extraLogStream != null) {