Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
喜羊羊3508
Dak
提交
43ad74a8
D
Dak
项目概览
喜羊羊3508
/
Dak
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
43ad74a8
编写于
7月 23, 2009
作者:
M
Mark Hymers
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more conversion work for daklib/queue.py
Signed-off-by:
N
Mark Hymers
<
mhy@debian.org
>
上级
a24454b7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
71 addition
and
66 deletion
+71
-66
daklib/queue.py
daklib/queue.py
+71
-66
未找到文件。
daklib/queue.py
浏览文件 @
43ad74a8
...
...
@@ -36,21 +36,51 @@ import time
import
apt_inst
import
apt_pkg
import
utils
import
database
from
types
import
*
from
dak_exceptions
import
*
from
changes
import
*
from
regexes
import
re_default_answer
,
re_fdnic
,
re_bin_only_nmu
from
config
import
Config
from
dbconn
import
*
from
summarystats
import
SummaryStats
from
types
import
*
###############################################################################
def
get_type
(
f
,
session
=
None
):
"""
Get the file type of C{f}
@type f: dict
@param f: file entry from Changes object
@rtype: string
@return: filetype
"""
if
session
is
None
:
session
=
DBConn
().
session
()
# Determine the type
if
f
.
has_key
(
"dbtype"
):
file_type
=
file
[
"dbtype"
]
elif
f
[
"type"
]
in
[
"orig.tar.gz"
,
"orig.tar.bz2"
,
"tar.gz"
,
"tar.bz2"
,
"diff.gz"
,
"diff.bz2"
,
"dsc"
]:
file_type
=
"dsc"
else
:
utils
.
fubar
(
"invalid type (%s) for new. Dazed, confused and sure as heck not continuing."
%
(
file_type
))
# Validate the override type
type_id
=
get_override_type
(
file_type
,
session
)
if
type_id
is
None
:
utils
.
fubar
(
"invalid type (%s) for new. Say wha?"
%
(
file_type
))
return
file_type
################################################################################
# Determine what parts in a .changes are NEW
def
determine_new
(
changes
,
files
,
projectB
,
warn
=
1
):
def
determine_new
(
changes
,
files
,
warn
=
1
):
"""
Determine what parts in a C{changes} file are NEW.
...
...
@@ -60,9 +90,6 @@ def determine_new(changes, files, projectB, warn=1):
@type files: Upload.Pkg.files dict
@param files: Files dictionary
@type projectB: pgobject
@param projectB: DB handle
@type warn: bool
@param warn: Warn if overrides are added for (old)stable
...
...
@@ -72,9 +99,10 @@ def determine_new(changes, files, projectB, warn=1):
"""
new
=
{}
session
=
DBConn
().
session
()
# Build up a list of potentially new things
for
file_entry
in
files
.
keys
():
f
=
files
[
file_entry
]
for
name
,
f
in
files
.
items
():
# Skip byhand elements
if
f
[
"type"
]
==
"byhand"
:
continue
...
...
@@ -86,6 +114,7 @@ def determine_new(changes, files, projectB, warn=1):
if
file_type
==
"dsc"
:
priority
=
"source"
if
not
new
.
has_key
(
pkg
):
new
[
pkg
]
=
{}
new
[
pkg
][
"priority"
]
=
priority
...
...
@@ -102,28 +131,25 @@ def determine_new(changes, files, projectB, warn=1):
new
[
pkg
][
"section"
]
=
section
new
[
pkg
][
"type"
]
=
file_type
new
[
pkg
][
"component"
]
=
component
new
[
pkg
][
"files"
].
append
(
file_entry
)
new
[
pkg
][
"files"
].
append
(
name
)
if
f
.
has_key
(
"othercomponents"
):
new
[
pkg
][
"othercomponents"
]
=
f
[
"othercomponents"
]
for
suite
in
changes
[
"suite"
].
keys
():
suite_id
=
database
.
get_suite_id
(
suite
)
for
pkg
in
new
.
keys
():
component_id
=
database
.
get_component_id
(
new
[
pkg
][
"component"
])
type_id
=
database
.
get_override_type_id
(
new
[
pkg
][
"type"
])
q
=
projectB
.
query
(
"SELECT package FROM override WHERE package = '%s' AND suite = %s AND component = %s AND type = %s"
%
(
pkg
,
suite_id
,
component_id
,
type_id
))
ql
=
q
.
getresult
()
if
ql
:
ql
=
get_override
(
pkg
,
suite
,
new
[
pkg
][
"component"
],
new
[
pkg
][
"type"
],
session
)
if
len
(
ql
)
>
0
:
for
file_entry
in
new
[
pkg
][
"files"
]:
if
files
[
file_entry
].
has_key
(
"new"
):
del
files
[
file_entry
][
"new"
]
del
new
[
pkg
]
if
warn
:
if
changes
[
"suite"
].
has_key
(
"stable"
):
print
"WARNING: overrides will be added for stable!"
if
changes
[
"suite"
].
has_key
(
"oldstable"
):
print
"WARNING: overrides will be added for OLDstable!"
for
s
in
[
'stable'
,
'oldstable'
]:
if
changes
[
"suite"
].
has_key
(
s
):
print
"WARNING: overrides will be added for %s!"
%
s
for
pkg
in
new
.
keys
():
if
new
[
pkg
].
has_key
(
"othercomponents"
):
print
"WARNING: %s already present in %s distribution."
%
(
pkg
,
new
[
pkg
][
"othercomponents"
])
...
...
@@ -132,36 +158,6 @@ def determine_new(changes, files, projectB, warn=1):
################################################################################
def
get_type
(
file
):
"""
Get the file type of C{file}
@type file: dict
@param file: file entry
@rtype: string
@return: filetype
"""
# Determine the type
if
file
.
has_key
(
"dbtype"
):
file_type
=
file
[
"dbtype"
]
elif
file
[
"type"
]
in
[
"orig.tar.gz"
,
"orig.tar.bz2"
,
"tar.gz"
,
"tar.bz2"
,
"diff.gz"
,
"diff.bz2"
,
"dsc"
]:
file_type
=
"dsc"
else
:
utils
.
fubar
(
"invalid type (%s) for new. Dazed, confused and sure as heck not continuing."
%
(
file_type
))
# Validate the override type
type_id
=
database
.
get_override_type_id
(
file_type
)
if
type_id
==
-
1
:
utils
.
fubar
(
"invalid type (%s) for new. Say wha?"
%
(
file_type
))
return
file_type
################################################################################
def
check_valid
(
new
):
"""
Check if section and priority for NEW packages exist in database.
...
...
@@ -175,20 +171,35 @@ def check_valid(new):
"""
for
pkg
in
new
.
keys
():
section
=
new
[
pkg
][
"section"
]
priority
=
new
[
pkg
][
"priority"
]
section
_name
=
new
[
pkg
][
"section"
]
priority
_name
=
new
[
pkg
][
"priority"
]
file_type
=
new
[
pkg
][
"type"
]
new
[
pkg
][
"section id"
]
=
database
.
get_section_id
(
section
)
new
[
pkg
][
"priority id"
]
=
database
.
get_priority_id
(
new
[
pkg
][
"priority"
])
section
=
get_section
(
section_name
)
if
section
is
None
:
new
[
pkg
][
"section id"
]
=
-
1
else
:
new
[
pkg
][
"section id"
]
=
section
.
section_id
priority
=
get_priority
(
priority_name
)
if
priority
is
None
:
new
[
pkg
][
"priority id"
]
=
-
1
else
:
new
[
pkg
][
"priority id"
]
=
priority
.
priority_id
# Sanity checks
di
=
section
.
find
(
"debian-installer"
)
!=
-
1
if
(
di
and
file_type
not
in
(
"udeb"
,
"dsc"
))
or
(
not
di
and
file_type
==
"udeb"
):
di
=
section_name
.
find
(
"debian-installer"
)
!=
-
1
# If d-i, we must be udeb and vice-versa
if
(
di
and
file_type
not
in
(
"udeb"
,
"dsc"
))
or
\
(
not
di
and
file_type
==
"udeb"
):
new
[
pkg
][
"section id"
]
=
-
1
# If dsc we need to be source and vice-versa
if
(
priority
==
"source"
and
file_type
!=
"dsc"
)
or
\
(
priority
!=
"source"
and
file_type
==
"dsc"
):
new
[
pkg
][
"priority id"
]
=
-
1
###############################################################################
class
Upload
(
object
):
...
...
@@ -197,12 +208,6 @@ class Upload(object):
"""
def
__init__
(
self
):
"""
Initialize various variables and the global substitution template mappings.
Also connect to the DB and initialize the Database module.
"""
self
.
pkg
=
Changes
()
self
.
reset
()
...
...
@@ -220,7 +225,7 @@ class Upload(object):
self
.
Subst
[
"__DAK_ADDRESS__"
]
=
cnf
[
"Dinstall::MyEmailAddress"
]
self
.
reject_message
=
""
self
.
changes
.
reset
()
self
.
pkg
.
reset
()
###########################################################################
def
update_subst
(
self
,
reject_message
=
""
):
...
...
@@ -690,10 +695,10 @@ distribution."""
@param package: package name
@type component: string
@param component: database id of the component
, as returned by L{database.get_component_id}
@param component: database id of the component
@type suite: int
@param suite: database id of the suite
, as returned by L{database.get_suite_id}
@param suite: database id of the suite
@type binary_type: string
@param binary_type: type of the package
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录