Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
喜羊羊3508
Dak
提交
2918ca9e
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,发现更多精彩内容 >>
提交
2918ca9e
编写于
1月 22, 2011
作者:
T
Torsten Werner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Create, test, and improve get_newest_source().
Signed-off-by:
N
Torsten Werner
<
twerner@debian.org
>
上级
97011892
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
12 deletion
+26
-12
daklib/queue.py
daklib/queue.py
+15
-11
tests/dbtest_packages.py
tests/dbtest_packages.py
+11
-1
未找到文件。
daklib/queue.py
浏览文件 @
2918ca9e
...
...
@@ -370,6 +370,19 @@ def edit_note(note, upload, session, trainee=False):
###############################################################################
# suite names DMs can upload to
dm_suites
=
[
'unstable'
,
'experimental'
]
def
get_newest_source
(
source
,
session
):
'returns the newest DBSource object in dm_suites'
## the most recent version of the package uploaded to unstable or
## experimental includes the field "DM-Upload-Allowed: yes" in the source
## section of its control file
q
=
session
.
query
(
DBSource
).
filter_by
(
source
=
source
).
\
filter
(
DBSource
.
suites
.
any
(
Suite
.
suite_name
.
in_
(
dm_suites
))).
\
order_by
(
desc
(
'source.version'
))
return
q
.
first
()
class
Upload
(
object
):
"""
Everything that has to do with an upload processed.
...
...
@@ -1681,22 +1694,13 @@ class Upload(object):
if
rej
:
return
## the most recent version of the package uploaded to unstable or
## experimental includes the field "DM-Upload-Allowed: yes" in the source
## section of its control file
q
=
session
.
query
(
DBSource
).
filter_by
(
source
=
self
.
pkg
.
changes
[
"source"
])
q
=
q
.
join
(
SrcAssociation
)
q
=
q
.
join
(
Suite
).
filter
(
Suite
.
suite_name
.
in_
([
'unstable'
,
'experimental'
]))
q
=
q
.
order_by
(
desc
(
'source.version'
)).
limit
(
1
)
r
=
q
.
all
()
r
=
get_newest_source
(
self
.
pkg
.
changes
[
"source"
],
session
)
if
len
(
r
)
!=
1
:
if
r
is
None
:
rej
=
"Could not find existing source package %s in unstable or experimental and this is a DM upload"
%
self
.
pkg
.
changes
[
"source"
]
self
.
rejects
.
append
(
rej
)
return
r
=
r
[
0
]
if
not
r
.
dm_upload_allowed
:
rej
=
"Source package %s does not have 'DM-Upload-Allowed: yes' in its most recent version (%s)"
%
(
self
.
pkg
.
changes
[
"source"
],
r
.
version
)
self
.
rejects
.
append
(
rej
)
...
...
tests/dbtest_packages.py
浏览文件 @
2918ca9e
...
...
@@ -7,6 +7,7 @@ from daklib.dbconn import Architecture, Suite, get_suite_architectures, \
check_poolfile
,
get_poolfile_like_name
,
get_source_in_suite
,
\
get_suites_source_in
,
add_dsc_to_db
,
source_exists
from
daklib.queue_install
import
package_to_suite
from
daklib.queue
import
get_newest_source
from
sqlalchemy.orm.exc
import
MultipleResultsFound
import
unittest
...
...
@@ -348,7 +349,6 @@ class PackageTestCase(DBDakTestCase):
'test function package_to_suite()'
self
.
setup_sources
()
self
.
session
.
flush
()
pkg
=
Pkg
()
pkg
.
changes
=
{
'distribution'
:
{}
}
upload
=
Upload
(
pkg
)
...
...
@@ -368,6 +368,16 @@ class PackageTestCase(DBDakTestCase):
pkg
.
changes
[
'distribution'
]
=
{
'lenny'
:
''
}
self
.
assertTrue
(
package_to_suite
(
upload
,
'lenny'
,
self
.
session
))
def
test_get_newest_source
(
self
):
'test function get_newest_source'
self
.
setup_sources
()
self
.
session
.
flush
()
import
daklib.queue
daklib
.
queue
.
dm_suites
=
[
'sid'
]
self
.
assertEqual
(
self
.
source
[
'hello'
],
get_newest_source
(
'hello'
,
self
.
session
))
self
.
assertEqual
(
None
,
get_newest_source
(
'foobar'
,
self
.
session
))
if
__name__
==
'__main__'
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录