Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
071139f8
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
071139f8
编写于
10月 04, 2013
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:jenkinsci/jenkins
上级
f1205fa4
7b38b7c5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
30 deletion
+12
-30
core/src/main/java/hudson/FilePath.java
core/src/main/java/hudson/FilePath.java
+3
-23
test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
+9
-7
未找到文件。
core/src/main/java/hudson/FilePath.java
浏览文件 @
071139f8
...
...
@@ -27,6 +27,7 @@ package hudson;
import
hudson.Launcher.LocalLauncher
;
import
hudson.Launcher.RemoteLauncher
;
import
hudson.os.PosixAPI
;
import
jenkins.model.Jenkins
;
import
hudson.model.TaskListener
;
import
hudson.model.AbstractProject
;
...
...
@@ -48,7 +49,6 @@ import hudson.util.FormValidation;
import
hudson.util.IOUtils
;
import
static
hudson
.
Util
.*;
import
static
hudson
.
util
.
jna
.
GNUCLibrary
.
LIBC
;
import
static
hudson
.
FilePath
.
TarCompression
.
GZIP
;
import
hudson.org.apache.tools.tar.TarInputStream
;
import
hudson.util.io.Archiver
;
...
...
@@ -1432,32 +1432,12 @@ public final class FilePath implements Serializable {
}
/**
* Run chmod via
libc if we can, otherwise fall back to Ant.
* Run chmod via
jnr-posix
*/
private
static
void
_chmod
(
File
f
,
int
mask
)
throws
IOException
{
if
(
Functions
.
isWindows
())
return
;
// noop
try
{
if
(
LIBC
.
chmod
(
f
.
getAbsolutePath
(),
mask
)!=
0
)
{
throw
new
IOException
(
"Failed to chmod "
+
f
+
" : "
+
LIBC
.
strerror
(
Native
.
getLastError
()));
}
}
catch
(
NoClassDefFoundError
e
)
{
// cf. https://groups.google.com/group/hudson-dev/browse_thread/thread/6d16c3e8ea0dbc9?hl=fr
_chmodAnt
(
f
,
mask
);
}
catch
(
UnsatisfiedLinkError
e2
)
{
// HUDSON-8155: use Ant's chmod task on non-GNU C systems
_chmodAnt
(
f
,
mask
);
}
}
private
static
void
_chmodAnt
(
File
f
,
int
mask
)
{
if
(!
CHMOD_WARNED
)
{
// only warn this once to avoid flooding the log
CHMOD_WARNED
=
true
;
LOGGER
.
warning
(
"GNU C Library not available: Using Ant's chmod task instead."
);
}
Chmod
chmodTask
=
new
Chmod
();
chmodTask
.
setProject
(
new
Project
());
chmodTask
.
setFile
(
f
);
chmodTask
.
setPerm
(
Integer
.
toOctalString
(
mask
));
chmodTask
.
execute
();
PosixAPI
.
jnr
().
chmod
(
f
.
getAbsolutePath
(),
mask
);
}
private
static
boolean
CHMOD_WARNED
=
false
;
...
...
test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
浏览文件 @
071139f8
...
...
@@ -57,6 +57,7 @@ import hudson.model.*;
import
hudson.model.Executor
;
import
hudson.model.Node.Mode
;
import
hudson.model.Queue.Executable
;
import
hudson.os.PosixAPI
;
import
hudson.remoting.Which
;
import
hudson.security.ACL
;
import
hudson.security.AbstractPasswordBasedSecurityRealm
;
...
...
@@ -82,7 +83,6 @@ import hudson.tools.ToolProperty;
import
hudson.util.PersistedList
;
import
hudson.util.ReflectionUtils
;
import
hudson.util.StreamTaskListener
;
import
hudson.util.jna.GNUCLibrary
;
import
java.beans.PropertyDescriptor
;
import
java.io.BufferedReader
;
...
...
@@ -587,8 +587,9 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
mvn
.
copyFrom
(
HudsonTestCase
.
class
.
getClassLoader
().
getResource
(
mavenVersion
+
"-bin.zip"
));
mvn
.
unzip
(
new
FilePath
(
buildDirectory
));
// TODO: switch to tar that preserves file permissions more easily
if
(!
Functions
.
isWindows
())
GNUCLibrary
.
LIBC
.
chmod
(
new
File
(
mvnHome
,
"bin/mvn"
).
getPath
(),
0755
);
if
(!
Functions
.
isWindows
())
{
PosixAPI
.
jnr
().
chmod
(
new
File
(
mvnHome
,
"bin/mvn"
).
getPath
(),
0755
);
}
MavenInstallation
mavenInstallation
=
new
MavenInstallation
(
"default"
,
mvnHome
.
getAbsolutePath
(),
NO_PROPERTIES
);
...
...
@@ -611,8 +612,9 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
File
antHome
=
createTmpDir
();
ant
.
unzip
(
new
FilePath
(
antHome
));
// TODO: switch to tar that preserves file permissions more easily
if
(!
Functions
.
isWindows
())
GNUCLibrary
.
LIBC
.
chmod
(
new
File
(
antHome
,
"apache-ant-1.8.1/bin/ant"
).
getPath
(),
0755
);
if
(!
Functions
.
isWindows
())
{
PosixAPI
.
jnr
().
chmod
(
new
File
(
antHome
,
"apache-ant-1.8.1/bin/ant"
).
getPath
(),
0755
);
}
antInstallation
=
new
AntInstallation
(
"default"
,
new
File
(
antHome
,
"apache-ant-1.8.1"
).
getAbsolutePath
(),
NO_PROPERTIES
);
}
...
...
@@ -1976,8 +1978,8 @@ public abstract class HudsonTestCase extends TestCase implements RootAction {
if
(!
Functions
.
isWindows
())
{
try
{
GNUCLibrary
.
LIBC
.
unsetenv
(
"MAVEN_OPTS"
);
GNUCLibrary
.
LIBC
.
unsetenv
(
"MAVEN_DEBUG_OPTS"
);
PosixAPI
.
jnr
()
.
unsetenv
(
"MAVEN_OPTS"
);
PosixAPI
.
jnr
()
.
unsetenv
(
"MAVEN_DEBUG_OPTS"
);
}
catch
(
Exception
e
)
{
LOGGER
.
log
(
Level
.
WARNING
,
"Failed to cancel out MAVEN_OPTS"
,
e
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录