[lintian] 03/04: L::Relation: Parse elements more defensively and forgivingly
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit b0ac4bef66d968e6968416af56d0756093b446ff
Author: Niels Thykier <niels@thykier.net>
Date: Tue Oct 7 21:51:16 2014 +0200
L::Relation: Parse elements more defensively and forgivingly
Allow single character package names (we already allow uppercase
characters in package names) and silently ignore elements that cannot
be parsed.
Signed-off-by: Niels Thykier <niels@thykier.net>
---
lib/Lintian/Relation.pm | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/Lintian/Relation.pm b/lib/Lintian/Relation.pm
index 690e06a..89efda1 100644
--- a/lib/Lintian/Relation.pm
+++ b/lib/Lintian/Relation.pm
@@ -89,11 +89,11 @@ satisfied).
# the unparsed debian/control file.
sub parse_element {
my ($class, $element) = @_;
- $element =~ /
+ return if not $element =~ /
^\s* # skip leading whitespace
( # package name or substvar (1)
(?: # start of the name
- [a-zA-Z0-9][a-zA-Z0-9+.-]+ # start of a package name
+ [a-zA-Z0-9][a-zA-Z0-9+.-]* # start of a package name
| # or
\$\{[a-zA-Z0-9:-]+\} # substvar
) # end of start of the name
@@ -174,7 +174,9 @@ sub new {
next if $element eq '';
my @alternatives;
for my $alternative (split(/\s*\|\s*/o, $element)) {
- push(@alternatives, $class->parse_element($alternative));
+ my $dep = $class->parse_element($alternative);
+ next if not $dep;
+ push(@alternatives, $dep);
}
if (@alternatives == 1) {
push(@result, @alternatives);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: