Skip to content
Permalink
Browse files
8273595: tools/jpackage tests do not work on apt-based Linux distros …
…like Debian

Backport-of: f189dff5cbd4d47e1b2f3c0e5f2c866a7effccdf
  • Loading branch information
theaoqi authored and shipilev committed Nov 16, 2021
1 parent 9ff9e62 commit e8eec1f909960482abd6c61f8d3246fcdac6ff10
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
@@ -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 e8eec1f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.