summaryrefslogtreecommitdiff
path: root/scripts/dpkg-shlibdeps.pl
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2015-09-14 04:45:15 +0200
committerGuillem Jover <guillem@debian.org>2015-09-14 05:44:10 +0200
commit23020a4da876727a0b1c412bf287cf80ba1cfc66 (patch)
treea9f2dbe9dbc60f25752e57296f3330965298107a /scripts/dpkg-shlibdeps.pl
parentbc7701399f90ec24fc54ca7d893d2088a188b4d8 (diff)
downloaddpkg-23020a4da876727a0b1c412bf287cf80ba1cfc66.tar.gz
perl: Split overlong regexes into multiline extended regexes
This should make the regular expressions easier to read and understand, and allows to add comments describing specific parts. Addresses RegularExpressions::RequireExtendedFormatting. Warned-by: perlcritic
Diffstat (limited to 'scripts/dpkg-shlibdeps.pl')
-rwxr-xr-xscripts/dpkg-shlibdeps.pl14
1 files changed, 13 insertions, 1 deletions
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index db970ddc3..c8b2336a5 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -670,6 +670,18 @@ sub split_soname {
}
}
+my $shlibs_re = qr{
+ ^\s*
+ (?:(\S+):\s+)? # Optional type
+ (\S+)\s+ # Library
+ (\S+) # Version
+ (?:
+ \s+
+ (\S.*\S) # Dependencies
+ )?
+ \s*$
+}x;
+
sub extract_from_shlibs {
my ($soname, $shlibfile) = @_;
# Split soname in name/version
@@ -686,7 +698,7 @@ sub extract_from_shlibs {
while (<$shlibs_fh>) {
s/\s*\n$//;
next if m/^\#/;
- if (!m/^\s*(?:(\S+):\s+)?(\S+)\s+(\S+)(?:\s+(\S.*\S))?\s*$/) {
+ if (!m/$shlibs_re/) {
warning(g_("shared libs info file '%s' line %d: bad line '%s'"),
$shlibfile, $., $_);
next;