Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
d552e34e
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
d552e34e
编写于
5月 18, 2017
作者:
T
Tatsuyuki Ishi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use the improved submodule handling
上级
cf747fcb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
48 deletion
+18
-48
src/bootstrap/bootstrap.py
src/bootstrap/bootstrap.py
+18
-48
未找到文件。
src/bootstrap/bootstrap.py
浏览文件 @
d552e34e
...
...
@@ -127,13 +127,13 @@ def unpack(tarball, dst, verbose=False, match=None):
shutil
.
move
(
tp
,
fp
)
shutil
.
rmtree
(
os
.
path
.
join
(
dst
,
fname
))
def
run
(
args
,
verbose
=
False
,
exception
=
False
,
cwd
=
None
,
env
=
None
):
def
run
(
args
,
verbose
=
False
,
exception
=
False
,
**
kwargs
):
if
verbose
:
print
(
"running: "
+
' '
.
join
(
args
))
sys
.
stdout
.
flush
()
# Use Popen here instead of call() as it apparently allows powershell on
# Windows to not lock up waiting for input presumably.
ret
=
subprocess
.
Popen
(
args
,
cwd
=
cwd
,
env
=
env
)
ret
=
subprocess
.
Popen
(
args
,
**
kwargs
)
code
=
ret
.
wait
()
if
code
!=
0
:
err
=
"failed to run: "
+
' '
.
join
(
args
)
...
...
@@ -395,16 +395,6 @@ class RustBuild(object):
args
.
append
(
"--frozen"
)
run
(
args
,
env
=
env
,
verbose
=
self
.
verbose
)
def
output
(
self
,
args
,
env
=
None
,
cwd
=
None
):
default_encoding
=
sys
.
getdefaultencoding
()
proc
=
subprocess
.
Popen
(
args
,
stdout
=
subprocess
.
PIPE
,
env
=
env
,
cwd
=
cwd
)
(
out
,
err
)
=
proc
.
communicate
()
ret
=
proc
.
wait
()
if
ret
!=
0
:
print
(
out
)
sys
.
exit
(
ret
)
return
out
.
decode
(
default_encoding
)
def
build_triple
(
self
):
default_encoding
=
sys
.
getdefaultencoding
()
config
=
self
.
get_toml
(
'build'
)
...
...
@@ -549,46 +539,26 @@ class RustBuild(object):
return
print
(
'Updating submodules'
)
output
=
self
.
output
([
"git"
,
"submodule"
,
"status"
],
cwd
=
self
.
rust_root
)
submodules
=
[]
for
line
in
output
.
splitlines
():
# NOTE `git submodule status` output looks like this:
#
# -5066b7dcab7e700844b0e2ba71b8af9dc627a59b src/liblibc
# +b37ef24aa82d2be3a3cc0fe89bf82292f4ca181c src/compiler-rt (remotes/origin/..)
# e058ca661692a8d01f8cf9d35939dfe3105ce968 src/jemalloc (3.6.0-533-ge058ca6)
#
# The first character can be '-', '+' or ' ' and denotes the
# `State` of the submodule Right next to this character is the
# SHA-1 of the submodule HEAD And after that comes the path to the
# submodule
path
=
line
[
1
:].
split
(
' '
)[
1
]
submodules
.
append
([
path
,
line
[
0
]])
run
([
"git"
,
"submodule"
,
"sync"
],
cwd
=
self
.
rust_root
)
for
submod
in
submodules
:
path
,
status
=
submod
if
path
.
endswith
(
'llvm'
)
and
\
run
([
"git"
,
"submodule"
,
"-q"
,
"sync"
],
cwd
=
self
.
rust_root
)
# FIXME: nobody does, but this won't work well with whitespace in
# submodule path
submodules
=
[
s
.
split
()[
1
]
for
s
in
subprocess
.
check_output
(
[
"git"
,
"config"
,
"--file"
,
os
.
path
.
join
(
self
.
rust_root
,
".gitmodules"
),
"--get-regexp"
,
"path"
]).
splitlines
()]
for
module
in
submodules
:
if
module
.
endswith
(
b
"llvm"
)
and
\
(
self
.
get_toml
(
'llvm-config'
)
or
self
.
get_mk
(
'CFG_LLVM_ROOT'
)):
continue
if
path
.
endswith
(
'jemalloc'
)
and
\
if
module
.
endswith
(
b
"jemalloc"
)
and
\
(
self
.
get_toml
(
'jemalloc'
)
or
self
.
get_mk
(
'CFG_JEMALLOC_ROOT'
)):
continue
submod_path
=
os
.
path
.
join
(
self
.
rust_root
,
path
)
if
status
==
' '
:
run
([
"git"
,
"reset"
,
"--hard"
],
cwd
=
submod_path
)
run
([
"git"
,
"clean"
,
"-fdx"
],
cwd
=
submod_path
)
elif
status
==
'+'
:
run
([
"git"
,
"submodule"
,
"update"
,
path
],
cwd
=
self
.
rust_root
)
run
([
"git"
,
"reset"
,
"--hard"
],
cwd
=
submod_path
)
run
([
"git"
,
"clean"
,
"-fdx"
],
cwd
=
submod_path
)
elif
status
==
'-'
:
run
([
"git"
,
"submodule"
,
"init"
,
path
],
cwd
=
self
.
rust_root
)
run
([
"git"
,
"submodule"
,
"update"
,
path
],
cwd
=
self
.
rust_root
)
else
:
raise
ValueError
(
'unknown submodule status: '
+
status
)
run
([
"git"
,
"submodule"
,
"update"
,
"--init"
,
module
],
cwd
=
self
.
rust_root
)
run
([
"git"
,
"submodule"
,
"-q"
,
"foreach"
,
"git"
,
"reset"
,
"-q"
,
"--hard"
],
cwd
=
self
.
rust_root
)
run
([
"git"
,
"submodule"
,
"-q"
,
"foreach"
,
"git"
,
"clean"
,
"-qdfx"
],
cwd
=
self
.
rust_root
)
def
bootstrap
():
parser
=
argparse
.
ArgumentParser
(
description
=
'Build rust'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录