Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
喜羊羊3508
Dak
提交
72ac5fce
D
Dak
项目概览
喜羊羊3508
/
Dak
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
72ac5fce
编写于
7月 07, 2012
作者:
A
Ansgar Burchardt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dak/show_new.py: update for multi-archive changes
上级
654c6d73
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
72 deletion
+45
-72
dak/show_new.py
dak/show_new.py
+45
-72
未找到文件。
dak/show_new.py
浏览文件 @
72ac5fce
...
@@ -30,8 +30,8 @@ import os, sys, time
...
@@ -30,8 +30,8 @@ import os, sys, time
import
apt_pkg
import
apt_pkg
import
examine_package
import
examine_package
from
daklib
import
policy
from
daklib.dbconn
import
*
from
daklib.dbconn
import
*
from
daklib.queue
import
determine_new
,
check_valid
,
Upload
,
get_policy_queue
from
daklib
import
utils
from
daklib
import
utils
from
daklib.regexes
import
re_source_ext
from
daklib.regexes
import
re_source_ext
from
daklib.config
import
Config
from
daklib.config
import
Config
...
@@ -53,7 +53,7 @@ timeout_str = "Timed out while processing"
...
@@ -53,7 +53,7 @@ timeout_str = "Timed out while processing"
################################################################################
################################################################################
################################################################################
################################################################################
def
html_header
(
name
,
filestoexamine
):
def
html_header
(
name
,
missing
):
if
name
.
endswith
(
'.changes'
):
if
name
.
endswith
(
'.changes'
):
name
=
' '
.
join
(
name
.
split
(
'_'
)[:
2
])
name
=
' '
.
join
(
name
.
split
(
'_'
)[:
2
])
result
=
"""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
result
=
"""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
...
@@ -122,8 +122,7 @@ def html_header(name, filestoexamine):
...
@@ -122,8 +122,7 @@ def html_header(name, filestoexamine):
<p><a href="#source-lintian" onclick="show('source-lintian-body')">source lintian</a></p>
<p><a href="#source-lintian" onclick="show('source-lintian-body')">source lintian</a></p>
"""
"""
for
fn
in
filter
(
lambda
x
:
x
.
endswith
(
'.deb'
)
or
x
.
endswith
(
'.udeb'
),
filestoexamine
):
for
binarytype
,
packagename
in
filter
(
lambda
m
:
m
[
0
]
in
(
'deb'
,
'udeb'
),
missing
):
packagename
=
fn
.
split
(
'_'
)[
0
]
result
+=
"""
result
+=
"""
<p class="subtitle">%(pkg)s</p>
<p class="subtitle">%(pkg)s</p>
<p><a href="#binary-%(pkg)s-control" onclick="show('binary-%(pkg)s-control-body')">control file</a></p>
<p><a href="#binary-%(pkg)s-control" onclick="show('binary-%(pkg)s-control-body')">control file</a></p>
...
@@ -154,86 +153,55 @@ def html_footer():
...
@@ -154,86 +153,55 @@ def html_footer():
################################################################################
################################################################################
def
do_pkg
(
changes_file
):
def
do_pkg
(
upload_id
):
changes_file
=
utils
.
validate_changes_file_arg
(
changes_file
,
0
)
session
=
DBConn
().
session
()
if
not
changes_file
:
upload
=
session
.
query
(
PolicyQueueUpload
).
filter_by
(
id
=
upload_id
).
one
()
return
print
"
\n
"
+
changes_file
u
=
Upload
()
queue
=
upload
.
policy_queue
u
.
pkg
.
changes_file
=
changes_file
changes
=
upload
.
changes
# We can afoord not to check the signature before loading the changes file
# as we've validated it already (otherwise it couldn't be in new)
# and we can more quickly skip over already processed files this way
u
.
load_changes
(
changes_file
)
origchanges
=
os
.
path
.
abspath
(
u
.
pkg
.
changes_file
)
origchanges
=
os
.
path
.
join
(
queue
.
path
,
changes
.
changesname
)
print
origchanges
# Still be cautious in case paring the changes file went badly
htmlname
=
"{0}_{1}.html"
.
format
(
changes
.
source
,
changes
.
version
)
if
u
.
pkg
.
changes
.
has_key
(
'source'
)
and
u
.
pkg
.
changes
.
has_key
(
'version'
):
htmlfile
=
os
.
path
.
join
(
cnf
[
'Show-New::HTMLPath'
],
htmlname
)
htmlname
=
u
.
pkg
.
changes
[
"source"
]
+
"_"
+
u
.
pkg
.
changes
[
"version"
]
+
".html"
htmlfile
=
os
.
path
.
join
(
cnf
[
"Show-New::HTMLPath"
],
htmlname
)
else
:
# Changes file was bad
print
"Changes file %s missing source or version field"
%
changes_file
return
# Have we already processed this?
# Have we already processed this?
if
os
.
path
.
exists
(
htmlfile
)
and
\
if
False
and
os
.
path
.
exists
(
htmlfile
)
and
\
os
.
stat
(
htmlfile
).
st_mtime
>
os
.
stat
(
origchanges
).
st_mtime
:
os
.
stat
(
htmlfile
).
st_mtime
>
time
.
mktime
(
changes
.
created
.
timetuple
())
:
with
open
(
htmlfile
,
"r"
)
as
fd
:
with
open
(
htmlfile
,
"r"
)
as
fd
:
if
fd
.
read
()
!=
timeout_str
:
if
fd
.
read
()
!=
timeout_str
:
sources
.
append
(
htmlname
)
sources
.
append
(
htmlname
)
return
(
PROC_STATUS_SUCCESS
,
return
(
PROC_STATUS_SUCCESS
,
'%s already up-to-date'
%
htmlfile
)
'%s already up-to-date'
%
htmlfile
)
# Now we'll load the fingerprint
# Go, process it... Now!
session
=
DBConn
().
session
()
htmlfiles_to_process
.
append
(
htmlfile
)
htmlfiles_to_process
.
append
(
htmlfile
)
(
u
.
pkg
.
changes
[
"fingerprint"
],
rejects
)
=
utils
.
check_signature
(
changes_file
,
session
=
session
)
new_queue
=
get_policy_queue
(
'new'
,
session
);
u
.
pkg
.
directory
=
new_queue
.
path
u
.
update_subst
()
files
=
u
.
pkg
.
files
changes
=
u
.
pkg
.
changes
sources
.
append
(
htmlname
)
sources
.
append
(
htmlname
)
for
deb_filename
,
f
in
files
.
items
():
with
open
(
htmlfile
,
'w'
)
as
outfile
:
if
deb_filename
.
endswith
(
".udeb"
)
or
deb_filename
.
endswith
(
".deb"
):
with
policy
.
UploadCopy
(
upload
)
as
upload_copy
:
u
.
binary_file_checks
(
deb_filename
,
session
)
handler
=
policy
.
PolicyQueueUploadHandler
(
upload
,
session
)
u
.
check_binary_against_db
(
deb_filename
,
session
)
missing
=
[
(
o
[
'type'
],
o
[
'package'
])
for
o
in
handler
.
missing_overrides
()
]
else
:
distribution
=
changes
.
distribution
u
.
source_file_checks
(
deb_filename
,
session
)
u
.
check_source_against_db
(
deb_filename
,
session
)
u
.
pkg
.
changes
[
"suite"
]
=
u
.
pkg
.
changes
[
"distribution"
]
new
,
byhand
=
determine_new
(
u
.
pkg
.
changes_file
,
u
.
pkg
.
changes
,
files
,
0
,
dsc
=
u
.
pkg
.
dsc
,
session
=
session
)
outfile
=
open
(
os
.
path
.
join
(
cnf
[
"Show-New::HTMLPath"
],
htmlname
),
"w"
)
filestoexamine
=
[]
for
pkg
in
new
.
keys
():
for
fn
in
new
[
pkg
][
"files"
]:
filestoexamine
.
append
(
fn
)
print
>>
outfile
,
html_header
(
changes
[
"source"
],
filestoexamine
)
check_valid
(
new
,
session
)
print
>>
outfile
,
html_header
(
changes
.
source
,
missing
)
distribution
=
changes
[
"distribution"
].
keys
()[
0
]
print
>>
outfile
,
examine_package
.
display_changes
(
distribution
,
origchanges
)
print
>>
outfile
,
examine_package
.
display_changes
(
distribution
,
changes_file
)
for
fn
in
filter
(
lambda
fn
:
fn
.
endswith
(
".dsc"
),
filestoexamine
):
if
upload
.
source
is
not
None
and
(
'dsc'
,
upload
.
source
.
source
)
in
missing
:
print
>>
outfile
,
examine_package
.
check_dsc
(
distribution
,
fn
,
session
)
fn
=
os
.
path
.
join
(
upload_copy
.
directory
,
upload
.
source
.
poolfile
.
basename
)
for
fn
in
filter
(
lambda
fn
:
fn
.
endswith
(
".deb"
)
or
fn
.
endswith
(
".udeb"
),
filestoexamine
):
print
>>
outfile
,
examine_package
.
check_dsc
(
distribution
,
fn
,
session
)
print
>>
outfile
,
examine_package
.
check_deb
(
distribution
,
fn
,
session
)
for
binary
in
upload
.
binaries
:
if
(
binary
.
binarytype
,
binary
.
package
)
not
in
missing
:
continue
fn
=
os
.
path
.
join
(
upload_copy
.
directory
,
binary
.
poolfile
.
basename
)
print
>>
outfile
,
examine_package
.
check_deb
(
distribution
,
fn
,
session
)
print
>>
outfile
,
html_footer
()
print
>>
outfile
,
html_footer
()
outfile
.
close
()
session
.
close
()
session
.
close
()
htmlfiles_to_process
.
remove
(
htmlfile
)
htmlfiles_to_process
.
remove
(
htmlfile
)
return
(
PROC_STATUS_SUCCESS
,
'
%s already updated'
%
htmlfile
)
return
(
PROC_STATUS_SUCCESS
,
'
{0} already updated'
.
format
(
htmlfile
)
)
################################################################################
################################################################################
...
@@ -258,17 +226,20 @@ def init(session):
...
@@ -258,17 +226,20 @@ def init(session):
if
not
cnf
.
has_key
(
"Show-New::Options::%s"
%
(
i
)):
if
not
cnf
.
has_key
(
"Show-New::Options::%s"
%
(
i
)):
cnf
[
"Show-New::Options::%s"
%
(
i
)]
=
""
cnf
[
"Show-New::Options::%s"
%
(
i
)]
=
""
changes_files
=
apt_pkg
.
parse_commandline
(
cnf
.
Cnf
,
Arguments
,
sys
.
argv
)
changesnames
=
apt_pkg
.
parse_commandline
(
cnf
.
Cnf
,
Arguments
,
sys
.
argv
)
if
len
(
changes_files
)
==
0
:
new_queue
=
get_policy_queue
(
'new'
,
session
);
changes_files
=
utils
.
get_changes_files
(
new_queue
.
path
)
Options
=
cnf
.
subtree
(
"Show-New::Options"
)
Options
=
cnf
.
subtree
(
"Show-New::Options"
)
if
Options
[
"help"
]:
if
Options
[
"help"
]:
usage
()
usage
()
return
changes_files
uploads
=
session
.
query
(
PolicyQueueUpload
)
\
.
join
(
PolicyQueueUpload
.
policy_queue
).
filter
(
PolicyQueue
.
queue_name
==
'new'
)
\
.
join
(
PolicyQueueUpload
.
changes
).
order_by
(
DBChange
.
source
)
if
len
(
changesnames
)
>
0
:
uploads
=
uploads
.
filter
(
DBChange
.
changesname
.
in_
(
changesnames
))
return
uploads
################################################################################
################################################################################
...
@@ -276,13 +247,15 @@ def init(session):
...
@@ -276,13 +247,15 @@ def init(session):
def
main
():
def
main
():
session
=
DBConn
().
session
()
session
=
DBConn
().
session
()
changes_files
=
init
(
session
)
upload_ids
=
[
u
.
id
for
u
in
init
(
session
)
]
session
.
close
()
examine_package
.
use_html
=
1
examine_package
.
use_html
=
1
pool
=
DakProcessPool
(
processes
=
5
)
pool
=
DakProcessPool
(
processes
=
5
)
p
=
pool
.
map_async
(
do_pkg
,
changes_file
s
)
p
=
pool
.
map_async
(
do_pkg
,
upload_id
s
)
pool
.
close
()
pool
.
close
()
p
.
wait
(
timeout
=
600
)
p
.
wait
(
timeout
=
600
)
for
htmlfile
in
htmlfiles_to_process
:
for
htmlfile
in
htmlfiles_to_process
:
with
open
(
htmlfile
,
"w"
)
as
fd
:
with
open
(
htmlfile
,
"w"
)
as
fd
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录