Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
喜羊羊3508
Dak
提交
060ddb5f
D
Dak
项目概览
喜羊羊3508
/
Dak
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
060ddb5f
编写于
7月 20, 2017
作者:
A
Ansgar Burchardt
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'waldi/byhash-symlink'
上级
aa24a96b
184c4512
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
35 addition
and
21 deletion
+35
-21
dak/generate_releases.py
dak/generate_releases.py
+33
-20
daklib/regexes.py
daklib/regexes.py
+2
-1
未找到文件。
dak/generate_releases.py
浏览文件 @
060ddb5f
...
...
@@ -45,7 +45,7 @@ import commands
from
sqlalchemy.orm
import
object_session
from
daklib
import
utils
,
daklog
from
daklib.regexes
import
re_gensubrelease
,
re_includeinrelease
from
daklib.regexes
import
re_gensubrelease
,
re_includeinrelease
_byhash
,
re_includeinrelease_plain
from
daklib.dak_exceptions
import
*
from
daklib.dbconn
import
*
from
daklib.config
import
Config
...
...
@@ -199,7 +199,7 @@ class ReleaseWriter(object):
# Update the hashfile table with new or updated files
for
filename
in
fileinfo
:
if
not
os
.
path
.
exists
(
filename
):
if
not
os
.
path
.
l
exists
(
filename
):
# probably an uncompressed index we didn't generate
continue
byhashdir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
filename
),
'by-hash'
)
...
...
@@ -227,20 +227,10 @@ class ReleaseWriter(object):
def
_make_byhash_links
(
self
,
fileinfo
,
hashes
):
# Create hardlinks in by-hash directories
for
filename
in
fileinfo
:
if
not
os
.
path
.
exists
(
filename
):
if
not
os
.
path
.
l
exists
(
filename
):
# probably an uncompressed index we didn't generate
continue
for
h
in
hashes
:
field
=
h
.
release_field
hashfile
=
os
.
path
.
join
(
os
.
path
.
dirname
(
filename
),
'by-hash'
,
field
,
fileinfo
[
filename
][
field
])
# if the hash is known to exist, re-use the old file
if
os
.
path
.
exists
(
hashfile
):
os
.
unlink
(
filename
)
os
.
link
(
hashfile
,
filename
)
break
for
h
in
hashes
:
field
=
h
.
release_field
hashfile
=
os
.
path
.
join
(
os
.
path
.
dirname
(
filename
),
'by-hash'
,
field
,
fileinfo
[
filename
][
field
])
...
...
@@ -255,6 +245,23 @@ class ReleaseWriter(object):
if
exc
.
errno
!=
errno
.
EEXIST
:
raise
def
_make_byhash_base_symlink
(
self
,
fileinfo
,
hashes
):
# Create symlinks to files in by-hash directories
for
filename
in
fileinfo
:
if
not
os
.
path
.
lexists
(
filename
):
# probably an uncompressed index we didn't generate
continue
besthash
=
hashes
[
-
1
]
field
=
besthash
.
release_field
hashfilebase
=
os
.
path
.
join
(
'by-hash'
,
field
,
fileinfo
[
filename
][
field
])
hashfile
=
os
.
path
.
join
(
os
.
path
.
dirname
(
filename
),
hashfilebase
)
assert
os
.
path
.
exists
(
hashfile
),
'by-hash file {} is missing'
.
format
(
hashfile
)
os
.
unlink
(
filename
)
os
.
symlink
(
hashfilebase
,
filename
)
def
generate_release_files
(
self
):
"""
Generate Release files for the given suite
...
...
@@ -367,20 +374,25 @@ class ReleaseWriter(object):
hashes
=
[
x
for
x
in
RELEASE_HASHES
if
x
.
db_name
in
suite
.
checksums
]
fileinfo
=
{}
fileinfo_byhash
=
{}
uncompnotseen
=
{}
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
"."
,
followlinks
=
True
,
topdown
=
True
):
for
entry
in
filenames
:
# Skip things we don't want to include
if
not
re_includeinrelease
.
match
(
entry
):
continue
if
dirpath
==
'.'
and
entry
in
[
"Release"
,
"Release.gpg"
,
"InRelease"
]:
continue
filename
=
os
.
path
.
join
(
dirpath
.
lstrip
(
'./'
),
entry
)
fileinfo
[
filename
]
=
{}
if
re_includeinrelease_byhash
.
match
(
entry
):
fileinfo
[
filename
]
=
fileinfo_byhash
[
filename
]
=
{}
elif
re_includeinrelease_plain
.
match
(
entry
):
fileinfo
[
filename
]
=
{}
# Skip things we don't want to include
else
:
continue
contents
=
open
(
filename
,
'r'
).
read
()
# If we find a file for which we have a compressed version and
...
...
@@ -423,8 +435,9 @@ class ReleaseWriter(object):
out
.
close
()
os
.
rename
(
outfile
+
'.new'
,
outfile
)
self
.
_update_hashfile_table
(
session
,
fileinfo
,
hashes
)
self
.
_make_byhash_links
(
fileinfo
,
hashes
)
self
.
_update_hashfile_table
(
session
,
fileinfo_byhash
,
hashes
)
self
.
_make_byhash_links
(
fileinfo_byhash
,
hashes
)
self
.
_make_byhash_base_symlink
(
fileinfo_byhash
,
hashes
)
sign_release_dir
(
suite
,
os
.
path
.
dirname
(
outfile
))
...
...
daklib/regexes.py
浏览文件 @
060ddb5f
...
...
@@ -103,7 +103,8 @@ re_parse_lintian = re.compile(r"^(?P<level>W|E|O): (?P<package>.*?): (?P<tag>[^
# in generate-releases
re_gensubrelease
=
re
.
compile
(
r
".*/(binary-[0-9a-z-]+|source)$"
)
re_includeinrelease
=
re
.
compile
(
r
"(Translation-[a-zA-Z_]+\.(?:bz2|xz)|Contents-[0-9a-z-]+.gz|Index|Packages(.gz|.bz2|.xz)?|Sources(.gz|.bz2|.xz)?|Components-[0-9a-z-]+.yml(.gz|.xz)|icons-[0-9x-]+.tar(.gz|.xz)|MD5SUMS|SHA256SUMS|Release)$"
)
re_includeinrelease_byhash
=
re
.
compile
(
r
"(Translation-[a-zA-Z_]+\.(?:bz2|xz)|Contents-[0-9a-z-]+.gz|Index|Packages(.gz|.bz2|.xz)?|Sources(.gz|.bz2|.xz)?|Components-[0-9a-z-]+.yml(.gz|.xz)|icons-[0-9x-]+.tar(.gz|.xz)|Release)$"
)
re_includeinrelease_plain
=
re
.
compile
(
r
"(MD5SUMS|SHA256SUMS)$"
)
# in generate_index_diffs
re_includeinpdiff
=
re
.
compile
(
r
"(Translation-[a-zA-Z_]+\.(?:bz2|xz))"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录