Skip to content
Permalink
Browse files

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

Reviewed-by: asemenyuk, clanger
  • Loading branch information
Matthias Baesken
Matthias Baesken committed Feb 18, 2020
1 parent 7f3bbc3 commit 09f5194d3877bb7878fdb04072bb5c4670e6cf01
@@ -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 @@ private static boolean isBundlerSupported(String bundlerClass) {
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());
}
}
@@ -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 @@ public static boolean isLinux() {
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) {

0 comments on commit 09f5194

Please sign in to comment.