Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
喜羊羊3508
Dak
提交
58083133
D
Dak
项目概览
喜羊羊3508
/
Dak
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dak
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
58083133
编写于
1月 21, 2009
作者:
M
Mike O'Connor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
getting rid of popen2 in generate_releases
Signed-off-by:
N
Mike O'Connor
<
stew@vireo.org
>
上级
aa0907e8
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
31 addition
and
24 deletion
+31
-24
dak/generate_releases.py
dak/generate_releases.py
+31
-24
未找到文件。
dak/generate_releases.py
浏览文件 @
58083133
...
...
@@ -22,7 +22,8 @@
################################################################################
import
sys
,
os
,
popen2
,
tempfile
,
stat
,
time
,
pg
import
sys
,
os
,
stat
,
time
,
pg
import
zlib
,
bz2
import
apt_pkg
from
daklib
import
utils
from
daklib.dak_exceptions
import
*
...
...
@@ -77,23 +78,23 @@ def compressnames (tree,type,file):
result
.
append
(
file
+
".bz2"
)
return
result
def
create_temp_file
(
cmd
):
f
=
tempfile
.
TemporaryFile
()
r
=
popen2
.
popen2
(
cmd
)
r
[
1
].
close
()
r
=
r
[
0
]
size
=
0
while
1
:
x
=
r
.
readline
()
if
not
x
:
r
.
close
(
)
del
x
,
r
break
f
.
write
(
x
)
size
+=
len
(
x
)
f
.
flush
()
f
.
seek
(
0
)
return
(
size
,
f
)
compressors
=
{
'zcat'
:
zlib
.
compress
,
'bzip2'
:
bz2
.
compress
}
def
compress
(
how
,
filename
):
compressor
=
compressors
[
how
]
uncompressed
=
None
output
=
None
try
:
uncompressed
=
utils
.
open_file
(
filename
)
output
=
compressor
(
uncompressed
.
read
()
)
except
:
raise
else
:
if
uncompressed
:
uncompressed
.
close
()
return
output
def
print_md5sha_files
(
tree
,
files
,
hashop
):
path
=
Cnf
[
"Dir::Root"
]
+
tree
+
"/"
...
...
@@ -103,17 +104,23 @@ def print_md5sha_files (tree, files, hashop):
j
=
name
.
index
(
"/"
)
k
=
name
.
index
(
">"
)
(
cat
,
ext
,
name
)
=
(
name
[
1
:
j
],
name
[
j
+
1
:
k
],
name
[
k
+
1
:])
(
size
,
file_handle
)
=
create_temp_file
(
"%s %s%s%s"
%
(
cat
,
path
,
name
,
ext
))
contents
=
compress
(
cat
,
"%s%s%s"
%
(
path
,
name
,
ext
)
)
else
:
size
=
os
.
stat
(
path
+
name
)[
stat
.
ST_SIZE
]
try
:
file_handle
=
utils
.
open_file
(
path
+
name
)
contents
=
file_handle
.
read
()
except
:
raise
else
:
if
file_handle
:
file_handle
.
close
()
except
CantOpenError
:
print
"ALERT: Couldn't open "
+
path
+
name
else
:
hash
=
hashop
(
file_handle
)
file_handle
.
close
()
out
.
write
(
" %s %8d %s
\n
"
%
(
hash
,
size
,
name
))
hash
=
hashop
(
contents
)
out
.
write
(
" %s %8d %s
\n
"
%
(
hash
,
len
(
contents
),
name
))
def
print_md5_files
(
tree
,
files
):
print_md5sha_files
(
tree
,
files
,
apt_pkg
.
md5sum
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录