Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
喜羊羊3508
Dak
提交
55173b9c
D
Dak
项目概览
喜羊羊3508
/
Dak
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
55173b9c
编写于
1月 22, 2011
作者:
T
Torsten Werner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Test and Improve source_exists().
Signed-off-by:
N
Torsten Werner
<
twerner@debian.org
>
上级
617d2852
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
40 addition
and
20 deletion
+40
-20
daklib/dbconn.py
daklib/dbconn.py
+9
-16
daklib/queue.py
daklib/queue.py
+7
-3
tests/dbtest_packages.py
tests/dbtest_packages.py
+24
-1
未找到文件。
daklib/dbconn.py
浏览文件 @
55173b9c
...
...
@@ -2115,10 +2115,14 @@ def source_exists(source, source_version, suites = ["any"], session=None):
"""
cnf = Config()
ret = 1
ret = True
from daklib.regexes import re_bin_only_nmu
orig_source_version = re_bin_only_nmu.sub('', source_version)
for suite in suites:
q = session.query(DBSource).filter_by(source=source)
q = session.query(DBSource).filter_by(source=source).
\
filter(DBSource.version.in_([source_version, orig_source_version]))
if suite != "
any
":
# source must exist in suite X, or in some other suite that's
# mapped to X, recursively... silent-maps are counted too,
...
...
@@ -2133,24 +2137,13 @@ def source_exists(source, source_version, suites = ["any"], session=None):
if x[1] in s and x[0] not in s:
s.append(x[0])
q = q.join(SrcAssociation).join(Suite)
q = q.filter(Suite.suite_name.in_(s))
# Reduce the query results to a list of version numbers
ql = [ j.version for j in q.all() ]
# Try (1)
if source_version in ql:
continue
q = q.filter(DBSource.suites.any(Suite.suite_name.in_(s)))
# Try (2)
from daklib.regexes import re_bin_only_nmu
orig_source_version = re_bin_only_nmu.sub('', source_version)
if orig_source_version in ql:
if q.count() > 0:
continue
# No source found so return not ok
ret =
0
ret =
False
return ret
...
...
daklib/queue.py
浏览文件 @
55173b9c
...
...
@@ -795,7 +795,8 @@ class Upload(object):
(
source_version
,
f
,
self
.
pkg
.
changes
[
"version"
]))
else
:
# Check in the SQL database
if
not
source_exists
(
source_package
,
source_version
,
self
.
pkg
.
changes
[
"distribution"
].
keys
(),
session
):
if
not
source_exists
(
source_package
,
source_version
,
suites
=
\
self
.
pkg
.
changes
[
"distribution"
].
keys
(),
session
=
session
):
# Check in one of the other directories
source_epochless_version
=
re_no_epoch
.
sub
(
''
,
source_version
)
dsc_filename
=
"%s_%s.dsc"
%
(
source_package
,
source_epochless_version
)
...
...
@@ -2681,7 +2682,8 @@ distribution."""
source_version
=
entry
[
"source version"
]
source_package
=
entry
[
"source package"
]
if
not
self
.
pkg
.
changes
[
"architecture"
].
has_key
(
"source"
)
\
and
not
source_exists
(
source_package
,
source_version
,
self
.
pkg
.
changes
[
"distribution"
].
keys
(),
session
):
and
not
source_exists
(
source_package
,
source_version
,
\
suites
=
self
.
pkg
.
changes
[
"distribution"
].
keys
(),
session
=
session
):
source_epochless_version
=
re_no_epoch
.
sub
(
''
,
source_version
)
dsc_filename
=
"%s_%s.dsc"
%
(
source_package
,
source_epochless_version
)
found
=
False
...
...
@@ -2728,7 +2730,9 @@ distribution."""
source_version
=
entry
[
"source version"
]
source_package
=
entry
[
"source package"
]
if
not
self
.
pkg
.
changes
[
"architecture"
].
has_key
(
"source"
)
\
and
not
source_exists
(
source_package
,
source_version
,
self
.
pkg
.
changes
[
"distribution"
].
keys
()):
and
not
source_exists
(
source_package
,
source_version
,
\
suites
=
self
.
pkg
.
changes
[
"distribution"
].
keys
(),
\
session
=
session
):
self
.
rejects
.
append
(
"no source found for %s %s (%s)."
%
(
source_package
,
source_version
,
checkfile
))
# Version and file overwrite checks
...
...
tests/dbtest_packages.py
浏览文件 @
55173b9c
...
...
@@ -5,7 +5,7 @@ from db_test import DBDakTestCase
from
daklib.dbconn
import
Architecture
,
Suite
,
get_suite_architectures
,
\
get_architecture_suites
,
Maintainer
,
DBSource
,
Location
,
PoolFile
,
\
check_poolfile
,
get_poolfile_like_name
,
get_source_in_suite
,
\
get_suites_source_in
,
add_dsc_to_db
get_suites_source_in
,
add_dsc_to_db
,
source_exists
from
sqlalchemy.orm.exc
import
MultipleResultsFound
import
unittest
...
...
@@ -320,6 +320,29 @@ class PackageTestCase(DBDakTestCase):
self
.
assertEqual
(
None
,
dsc_location_id
)
self
.
assertEqual
([],
pfs
)
def
test_source_exists
(
self
):
'test function source_exists()'
self
.
setup_sources
()
self
.
session
.
flush
()
hello
=
self
.
source
[
'hello'
]
self
.
assertTrue
(
source_exists
(
hello
.
source
,
hello
.
version
,
\
suites
=
[
'sid'
],
session
=
self
.
session
))
# binNMU
self
.
assertTrue
(
source_exists
(
hello
.
source
,
hello
.
version
+
'+b7'
,
\
suites
=
[
'sid'
],
session
=
self
.
session
))
self
.
assertTrue
(
not
source_exists
(
hello
.
source
,
hello
.
version
,
\
suites
=
[
'lenny'
,
'squeeze'
],
session
=
self
.
session
))
self
.
assertTrue
(
not
source_exists
(
hello
.
source
,
hello
.
version
,
\
suites
=
[
'lenny'
,
'sid'
],
session
=
self
.
session
))
self
.
assertTrue
(
not
source_exists
(
hello
.
source
,
hello
.
version
,
\
suites
=
[
'sid'
,
'lenny'
],
session
=
self
.
session
))
self
.
assertTrue
(
not
source_exists
(
hello
.
source
,
'0815'
,
\
suites
=
[
'sid'
],
session
=
self
.
session
))
# 'any' suite
self
.
assertTrue
(
source_exists
(
hello
.
source
,
hello
.
version
,
\
session
=
self
.
session
))
if
__name__
==
'__main__'
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录