mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8273595: tools/jpackage tests do not work on apt-based Linux distros like Debian
Co-authored-by: Sun Xu <sunxu01@loongson.cn> Reviewed-by: asemenyuk, herrick
This commit is contained in:
parent
922e86f4ff
commit
f189dff5cb
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2021, 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
|
||||
@ -119,6 +119,6 @@ public enum PackageType {
|
||||
private final static class Inner {
|
||||
private final static Set<String> DISABLED_PACKAGERS = Optional.ofNullable(
|
||||
TKit.tokenizeConfigProperty("disabledPackagers")).orElse(
|
||||
TKit.isUbuntu() ? Set.of("rpm") : Collections.emptySet());
|
||||
TKit.isLinuxAPT() ? Set.of("rpm") : Collections.emptySet());
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,10 +22,8 @@
|
||||
*/
|
||||
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;
|
||||
@ -184,25 +182,12 @@ final public class TKit {
|
||||
return ((OS.contains("nix") || OS.contains("nux")));
|
||||
}
|
||||
|
||||
public static boolean isUbuntu() {
|
||||
public static boolean isLinuxAPT() {
|
||||
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;
|
||||
File aptFile = new File("/usr/bin/apt-get");
|
||||
return aptFile.exists();
|
||||
}
|
||||
|
||||
private static String addTimestamp(String msg) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user