Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
喜羊羊3508
Dak
提交
7ea096eb
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,发现更多精彩内容 >>
提交
7ea096eb
编写于
6月 14, 2012
作者:
A
Ansgar Burchardt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dak/manage_build_queues.py: update for multi-archive changes
上级
a7a03efd
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
59 addition
and
24 deletion
+59
-24
dak/manage_build_queues.py
dak/manage_build_queues.py
+59
-24
未找到文件。
dak/manage_build_queues.py
浏览文件 @
7ea096eb
...
...
@@ -5,6 +5,7 @@
@contact: Debian FTPMaster <ftpmaster@debian.org>
@copyright: 2000, 2001, 2002, 2006 James Troup <james@nocrew.org>
@copyright: 2009 Mark Hymers <mhy@debian.org>
@copyright: 2012, Ansgar Burchardt <ansgar@debian.org>
"""
...
...
@@ -24,14 +25,12 @@
################################################################################
import
os
import
os.path
import
stat
import
sys
from
datetime
import
datetime
import
apt_pkg
from
datetime
import
datetime
,
timedelta
import
sys
from
daklib
import
daklog
from
daklib.archive
import
ArchiveTransaction
from
daklib.dbconn
import
*
from
daklib.config
import
Config
...
...
@@ -54,6 +53,44 @@ Manage the contents of one or more build queues
################################################################################
def
clean
(
build_queue
,
transaction
,
now
=
None
):
session
=
transaction
.
session
if
now
is
None
:
now
=
datetime
.
now
()
delete_before
=
now
-
timedelta
(
seconds
=
build_queue
.
stay_of_execution
)
suite
=
build_queue
.
suite
# Remove binaries
query
=
"""
SELECT b.*
FROM binaries b
JOIN bin_associations ba ON b.id = ba.bin
WHERE ba.suite = :suite_id
AND ba.created < :delete_before"""
binaries
=
session
.
query
(
DBBinary
).
from_statement
(
query
)
\
.
params
({
'suite_id'
:
suite
.
suite_id
,
'delete_before'
:
delete_before
})
for
binary
in
binaries
:
Logger
.
log
([
"removed binary from build queue"
,
build_queue
.
queue_name
,
binary
.
package
,
binary
.
version
])
transaction
.
remove_binary
(
binary
,
suite
)
# Remove sources
query
=
"""
SELECT s.*
FROM source s
JOIN src_associations sa ON s.id = sa.source
WHERE sa.suite = :suite_id
AND sa.created < :delete_before
AND NOT EXISTS (SELECT 1 FROM bin_associations ba
JOIN binaries b ON ba.bin = b.id
WHERE ba.suite = :suite_id
AND b.source = s.id)"""
sources
=
session
.
query
(
DBSource
).
from_statement
(
query
)
\
.
params
({
'suite_id'
:
suite
.
suite_id
,
'delete_before'
:
delete_before
})
for
source
in
sources
:
Logger
.
log
([
"removed source from build queue"
,
build_queue
.
queue_name
,
source
.
source
,
source
.
version
])
transaction
.
remove_source
(
source
,
suite
)
def
main
():
global
Options
,
Logger
...
...
@@ -79,25 +116,23 @@ def main ():
session
=
DBConn
().
session
()
if
Options
[
"All"
]:
with
ArchiveTransaction
()
as
transaction
:
session
=
transaction
.
session
if
Options
[
'All'
]:
if
len
(
queue_names
)
!=
0
:
print
"E: Cannot use both -a and a queue_
name"
print
"E: Cannot use both -a and a queue
name"
sys
.
exit
(
1
)
queues
=
session
.
query
(
BuildQueue
).
all
()
else
:
queues
=
[]
for
q
in
queue_names
:
queue
=
get_build_queue
(
q
.
lower
(),
session
)
if
queue
:
queues
.
append
(
queue
)
queues
=
session
.
query
(
BuildQueue
)
else
:
Logger
.
log
([
'cannot find queue %s'
%
q
]
)
queues
=
session
.
query
(
BuildQueue
).
filter
(
BuildQueue
.
queue_name
.
in_
(
queue_names
)
)
# For each given queue, look up object and call manage_queue
for
q
in
queues
:
Logger
.
log
([
'cleaning queue %s using datetime %s'
%
(
q
.
queue_name
,
starttime
)])
q
.
clean_and_update
(
starttime
,
Logger
,
dryrun
=
Options
[
"No-Action"
])
clean
(
q
,
transaction
,
now
=
starttime
)
if
not
Options
[
'No-Action'
]:
transaction
.
commit
()
else
:
transaction
.
rollback
()
Logger
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录