Skip to content
Permalink
Browse files
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
  • Loading branch information
2 people authored and DamonFool committed Sep 10, 2021
1 parent 922e86f commit f189dff5cbd4d47e1b2f3c0e5f2c866a7effccdf
Showing with 5 additions and 20 deletions.
  1. +2 −2 test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageType.java
  2. +3 −18 test/jdk/tools/jpackage/helpers/jdk/jpackage/test/TKit.java
@@ -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 @@ private static boolean isBundlerSupported(String bundlerClass) {
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 @@ public static boolean isLinux() {
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) {

1 comment on commit f189dff

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on f189dff Sep 10, 2021

Please sign in to comment.