Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
72cb109b
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
72cb109b
编写于
3月 15, 2018
作者:
J
John Kåre Alsaker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Faster submodule updating
上级
ff2d506c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
12 deletion
+54
-12
config.toml.example
config.toml.example
+4
-0
src/bootstrap/bootstrap.py
src/bootstrap/bootstrap.py
+50
-12
未找到文件。
config.toml.example
浏览文件 @
72cb109b
...
...
@@ -118,6 +118,10 @@
# Indicate whether submodules are managed and updated automatically.
#submodules = true
# Update submodules only when the checked out commit in the submodules differs
# from what is committed in the main rustc repo.
#fast-submodules = true
# The path to (or name of) the GDB executable to use. This is only used for
# executing the debuginfo test suite.
#gdb = "gdb"
...
...
src/bootstrap/bootstrap.py
浏览文件 @
72cb109b
...
...
@@ -614,20 +614,55 @@ class RustBuild(object):
return
config
return
default_build_triple
()
def
check_submodule
(
self
,
module
,
slow_submodules
):
if
not
slow_submodules
:
checked_out
=
subprocess
.
Popen
([
"git"
,
"rev-parse"
,
"HEAD"
],
cwd
=
os
.
path
.
join
(
self
.
rust_root
,
module
),
stdout
=
subprocess
.
PIPE
)
return
checked_out
else
:
return
None
def
update_submodule
(
self
,
module
,
checked_out
,
recorded_submodules
):
module_path
=
os
.
path
.
join
(
self
.
rust_root
,
module
)
if
checked_out
!=
None
:
default_encoding
=
sys
.
getdefaultencoding
()
checked_out
=
checked_out
.
communicate
()[
0
].
decode
(
default_encoding
).
strip
()
if
recorded_submodules
[
module
]
==
checked_out
:
return
print
(
"Updating submodule"
,
module
)
run
([
"git"
,
"submodule"
,
"-q"
,
"sync"
,
module
],
cwd
=
self
.
rust_root
,
verbose
=
self
.
verbose
)
run
([
"git"
,
"submodule"
,
"update"
,
"--init"
,
"--recursive"
,
module
],
cwd
=
self
.
rust_root
,
verbose
=
self
.
verbose
)
run
([
"git"
,
"reset"
,
"-q"
,
"--hard"
],
cwd
=
module_path
,
verbose
=
self
.
verbose
)
run
([
"git"
,
"clean"
,
"-qdfx"
],
cwd
=
module_path
,
verbose
=
self
.
verbose
)
def
update_submodules
(
self
):
"""Update submodules"""
if
(
not
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
rust_root
,
".git"
)))
or
\
self
.
get_toml
(
'submodules'
)
==
"false"
:
return
print
(
'Updating submodules'
)
slow_submodules
=
self
.
get_toml
(
'fast-submodule'
)
==
"false"
start_time
=
time
()
if
slow_submodules
:
print
(
'Unconditionally updating all submodules'
)
else
:
print
(
'Updating only changed submodules'
)
default_encoding
=
sys
.
getdefaultencoding
()
run
([
"git"
,
"submodule"
,
"-q"
,
"sync"
],
cwd
=
self
.
rust_root
,
verbose
=
self
.
verbose
)
submodules
=
[
s
.
split
(
' '
,
1
)[
1
]
for
s
in
subprocess
.
check_output
(
[
"git"
,
"config"
,
"--file"
,
os
.
path
.
join
(
self
.
rust_root
,
".gitmodules"
),
"--get-regexp"
,
"path"
]
).
decode
(
default_encoding
).
splitlines
()]
filtered_submodules
=
[]
submodules_names
=
[]
for
module
in
submodules
:
if
module
.
endswith
(
"llvm"
):
if
self
.
get_toml
(
'llvm-config'
):
...
...
@@ -645,16 +680,19 @@ class RustBuild(object):
config
=
self
.
get_toml
(
'lld'
)
if
config
is
None
or
config
==
'false'
:
continue
filtered_submodules
.
append
(
module
)
run
([
"git"
,
"submodule"
,
"update"
,
"--init"
,
"--recursive"
]
+
filtered_submodules
,
cwd
=
self
.
rust_root
,
verbose
=
self
.
verbose
)
run
([
"git"
,
"submodule"
,
"-q"
,
"foreach"
,
"git"
,
"reset"
,
"-q"
,
"--hard"
],
cwd
=
self
.
rust_root
,
verbose
=
self
.
verbose
)
run
([
"git"
,
"submodule"
,
"-q"
,
"foreach"
,
"git"
,
"clean"
,
"-qdfx"
],
cwd
=
self
.
rust_root
,
verbose
=
self
.
verbose
)
check
=
self
.
check_submodule
(
module
,
slow_submodules
)
filtered_submodules
.
append
((
module
,
check
))
submodules_names
.
append
(
module
)
recorded
=
subprocess
.
Popen
([
"git"
,
"ls-tree"
,
"HEAD"
]
+
submodules_names
,
cwd
=
self
.
rust_root
,
stdout
=
subprocess
.
PIPE
)
recorded
=
recorded
.
communicate
()[
0
].
decode
(
default_encoding
).
strip
().
splitlines
()
recorded_submodules
=
{}
for
data
in
recorded
:
data
=
data
.
split
()
recorded_submodules
[
data
[
3
]]
=
data
[
2
]
for
module
in
filtered_submodules
:
self
.
update_submodule
(
module
[
0
],
module
[
1
],
recorded_submodules
)
print
(
"Submodules updated in %.2f seconds"
%
(
time
()
-
start_time
))
def
set_dev_environment
(
self
):
"""Set download URL for development environment"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录