Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
喜羊羊3508
Dak
提交
a51c070b
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,发现更多精彩内容 >>
提交
a51c070b
编写于
10月 28, 2009
作者:
C
Chris Lamb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
While we're at it, split out another version of ensure_orig_files.
Signed-off-by:
N
Chris Lamb
<
lamby@debian.org
>
上级
4f29ddca
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
38 deletion
+63
-38
daklib/dbconn.py
daklib/dbconn.py
+16
-37
daklib/utils.py
daklib/utils.py
+47
-1
未找到文件。
daklib/dbconn.py
浏览文件 @
a51c070b
...
...
@@ -1414,47 +1414,26 @@ class Queue(object):
session
.
add
(
qb
)
# If the .orig tarballs are in the pool, create a symlink to
# them (if one doesn't already exist)
for
dsc_file
in
changes
.
dsc_files
.
keys
():
# Skip all files except orig tarballs
from
daklib.regexes
import
re_is_orig_source
if
not
re_is_orig_source
.
match
(
dsc_file
):
continue
# Skip orig files not identified in the pool
if
not
(
changes
.
orig_files
.
has_key
(
dsc_file
)
and
changes
.
orig_files
[
dsc_file
].
has_key
(
"id"
)):
continue
orig_file_id
=
changes
.
orig_files
[
dsc_file
][
"id"
]
dest
=
os
.
path
.
join
(
dest_dir
,
dsc_file
)
# If it doesn't exist, create a symlink
if
not
os
.
path
.
exists
(
dest
):
q
=
session
.
execute
(
"SELECT l.path, f.filename FROM location l, files f WHERE f.id = :id and f.location = l.id"
,
{
'id'
:
orig_file_id
})
res
=
q
.
fetchone
()
if
not
res
:
return
"[INTERNAL ERROR] Couldn't find id %s in files table."
%
(
orig_file_id
)
src
=
os
.
path
.
join
(
res
[
0
],
res
[
1
])
os
.
symlink
(
src
,
dest
)
exists
,
symlinked
=
utils
.
ensure_orig_files
(
changes
,
dest
,
session
)
# Add it to the list of packages for later processing by apt-ftparchive
qb
=
QueueBuild
()
qb
.
suite_id
=
s
.
suite_id
qb
.
queue_id
=
self
.
queue_id
qb
.
filename
=
dest
# Add symlinked files to the list of packages for later processing
# by apt-ftparchive
for
filename
in
symlinked
:
qb
=
QueueBuild
()
qb
.
suite_id
=
s
.
suite_id
qb
.
queue_id
=
self
.
queue_id
qb
.
filename
=
filename
qb
.
in_queue
=
True
session
.
add
(
qb
)
# Update files to ensure they are not removed prematurely
for
filename
in
exists
:
qb
=
get_queue_build
(
filename
,
s
.
suite_id
,
session
)
if
qb
is
None
:
qb
.
in_queue
=
True
qb
.
last_used
=
None
session
.
add
(
qb
)
# If it does, update things to ensure it's not removed prematurely
else
:
qb
=
get_queue_build
(
dest
,
s
.
suite_id
,
session
)
if
qb
is
None
:
qb
.
in_queue
=
True
qb
.
last_used
=
None
session
.
add
(
qb
)
if
privatetrans
:
session
.
commit
()
session
.
close
()
...
...
daklib/utils.py
浏览文件 @
a51c070b
...
...
@@ -45,7 +45,8 @@ from dak_exceptions import *
from
textutils
import
fix_maintainer
from
regexes
import
re_html_escaping
,
html_escaping
,
re_single_line_field
,
\
re_multi_line_field
,
re_srchasver
,
re_taint_free
,
\
re_gpg_uid
,
re_re_mark
,
re_whitespace_comment
,
re_issource
re_gpg_uid
,
re_re_mark
,
re_whitespace_comment
,
re_issource
,
\
re_is_orig_source
from
srcformats
import
get_format_from_string
from
collections
import
defaultdict
...
...
@@ -1507,3 +1508,48 @@ if which_conf_file() != default_config:
apt_pkg
.
ReadConfigFileISC
(
Cnf
,
which_conf_file
())
###############################################################################
def
ensure_orig_files
(
changes
,
dest_dir
,
session
):
"""
Ensure that dest_dir contains all the orig tarballs for the specified
changes. If it does not, symlink them into place.
Returns a 2-tuple (already_exists, symlinked) containing a list of files
that were already there and a list of files that were symlinked into place.
"""
exists
,
symlinked
=
[],
[]
for
dsc_file
in
changes
.
dsc_files
:
# Skip all files that are not orig tarballs
if
not
re_is_orig_source
.
match
(
dsc_file
):
continue
# Skip orig files not identified in the pool
if
not
(
dsc_file
in
changes
.
orig_files
and
'id'
in
changes
.
orig_files
[
dsc_file
]):
continue
dest
=
os
.
path
.
join
(
dest_dir
,
dsc_file
)
if
os
.
path
.
exists
(
dest
):
exists
.
append
(
dest
)
continue
orig_file_id
=
changes
.
orig_files
[
dsc_file
][
'id'
]
c
=
session
.
execute
(
'SELECT l.path, f.filename FROM location l, files f WHERE f.id = :id and f.location = l.id'
,
{
'id'
:
orig_file_id
}
)
res
=
c
.
fetchone
()
if
not
res
:
return
"[INTERNAL ERROR] Couldn't find id %s in files table."
%
orig_file_id
src
=
os
.
path
.
join
(
res
[
0
],
res
[
1
])
os
.
symlink
(
src
,
dest
)
symlinked
.
append
(
dest
)
return
files
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录