提交 8f29260b 编写于 作者: V Vojtech Juranek

[FIXED JENKINS-29507] Make JenkinsRule useable on systems without glibc

上级 63e6ac6d
......@@ -75,6 +75,7 @@ import hudson.tasks.UserAvatarResolver;
import hudson.util.Area;
import hudson.util.FormValidation.CheckMethod;
import hudson.util.Iterators;
import hudson.util.jna.GNUCLibrary;
import hudson.util.Secret;
import hudson.views.MyViewsTabBar;
import hudson.views.ViewsTabBar;
......@@ -459,6 +460,15 @@ public class Functions {
public static boolean isWindows() {
return File.pathSeparatorChar==';';
}
public static boolean isGlibcSupported() {
try {
GNUCLibrary.LIBC.getpid();
return true;
} catch(Throwable t) {
return false;
}
}
public static List<LogRecord> getLogRecords() {
return Jenkins.logRecords;
......
......@@ -696,7 +696,7 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction {
mvn.copyFrom(JenkinsRule.class.getClassLoader().getResource(mavenVersion + "-bin.zip"));
mvn.unzip(new FilePath(buildDirectory));
// TODO: switch to tar that preserves file permissions more easily
if(!Functions.isWindows())
if(Functions.isGlibcSupported())
GNUCLibrary.LIBC.chmod(new File(mvnHome, "bin/mvn").getPath(),0755);
Maven.MavenInstallation mavenInstallation = new Maven.MavenInstallation("default",
......@@ -720,7 +720,7 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction {
File antHome = createTmpDir();
ant.unzip(new FilePath(antHome));
// TODO: switch to tar that preserves file permissions more easily
if(!Functions.isWindows())
if(Functions.isGlibcSupported())
GNUCLibrary.LIBC.chmod(new File(antHome,"apache-ant-1.8.1/bin/ant").getPath(),0755);
antInstallation = new Ant.AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES);
......@@ -2318,7 +2318,7 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction {
// this also prevents tests from falsely advertising Hudson
DNSMultiCast.disabled = true;
if (!Functions.isWindows()) {
if (Functions.isGlibcSupported()) {
try {
GNUCLibrary.LIBC.unsetenv("MAVEN_OPTS");
GNUCLibrary.LIBC.unsetenv("MAVEN_DEBUG_OPTS");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册