Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
remove duplicated code
· e117a079
Ansgar
authored
Jun 10, 2019
The only difference between the two versions was the function used to parse the dependency.
e117a079
BinaryCheck: stricter check for Provides and Built-Using fields
· a25f6b67
Ansgar
authored
Jun 10, 2019
a25f6b67
Show whitespace changes
Inline
Side-by-side
daklib/checks.py
View file @
a25f6b67
...
...
@@ -460,26 +460,37 @@ class BinaryCheck(Check):
# check dependency field syntax
for
field
in
(
'
Breaks
'
,
'
Conflicts
'
,
'
Depends
'
,
'
Enhances
'
,
'
Pre-Depends
'
,
'
Provides
'
,
'
Recommends
'
,
'
Replaces
'
,
'
Suggests
'
):
def
check_dependency_field
(
field
,
control
,
dependency_parser
=
apt_pkg
.
parse_depends
,
allow_alternatives
=
True
,
require_strict_dependency
=
False
):
value
=
control
.
get
(
field
)
if
value
is
not
None
:
if
value
.
strip
()
==
''
:
raise
Reject
(
'
{0}: empty {1} field
'
.
format
(
fn
,
field
))
try
:
apt_pkg
.
parse_depends
(
value
)
depends
=
dependency_parser
(
value
)
except
:
raise
Reject
(
'
{0}: APT could not parse {1} field
'
.
format
(
fn
,
field
))
for
group
in
depends
:
if
not
allow_alternatives
and
len
(
group
)
!=
1
:
raise
Reject
(
'
{0}: {1}: alternatives are not allowed
'
.
format
(
fn
))
if
require_strict_dependency
\
and
any
(
dependency
[
2
]
!=
'
=
'
for
dependency
in
group
):
raise
Reject
(
'
{0}: {1}: only strict dependencies (
"
=
"
) are allowed
'
.
format
(
fn
,
field
))
for
field
in
(
'
Built-Using
'
,):
value
=
control
.
get
(
field
)
if
value
is
not
None
:
if
value
.
strip
()
==
''
:
raise
Reject
(
'
{0}: empty {1} field
'
.
format
(
fn
,
field
))
try
:
apt_pkg
.
parse_src_depends
(
value
)
except
:
raise
Reject
(
'
{0}: APT could not parse {1} field
'
.
format
(
fn
,
field
))
for
field
in
(
'
Breaks
'
,
'
Conflicts
'
,
'
Depends
'
,
'
Enhances
'
,
'
Pre-Depends
'
,
'
Recommends
'
,
'
Replaces
'
,
'
Suggests
'
):
check_dependency_field
(
field
,
control
)
check_dependency_field
(
"
Provides
"
,
control
,
allow_alternatives
=
False
,
require_strict_dependency
=
True
)
check_dependency_field
(
"
Built-Using
"
,
control
,
dependency_parser
=
apt_pkg
.
parse_src_depends
,
allow_alternatives
=
False
,
require_strict_dependency
=
True
)
class
BinaryTimestampCheck
(
Check
):
...
...