Package: lintian Version: 2.5.3 Severity: wishlist Tags: patch
With the attached patch debian/rules parsers in checks/rules and checks/debhelper will parse continuation lines correctly.
-- Jakub Wilk
diff --git a/checks/debhelper b/checks/debhelper --- a/checks/debhelper +++ b/checks/debhelper @@ -82,6 +82,9 @@ open(RULES, '<', "$droot/rules") or fail("cannot read debian/rules: $!"); while (<RULES>) { + while (s,\\$,, and defined (my $cont = <RULES>)) { + $_ .= $cont; + } if (/^ifn?(?:eq|def)\s/) { $maybe_skipping++; } elsif (/^endif\s/) { @@ -119,7 +122,7 @@ if ($dhcommand eq 'dh_scrollkeeper') { tag 'dh_scrollkeeper-is-deprecated', "line $."; } - if ($dhcommand eq 'dh_clean' and m/\s+\-k(?:\s+.*)?$/) { + if ($dhcommand eq 'dh_clean' and m/\s+\-k(?:\s+.*)?$/s) { $seendhcleank = 1; } } diff --git a/checks/rules b/checks/rules --- a/checks/rules +++ b/checks/rules @@ -76,13 +76,13 @@ ( [ 'ant | ant1.7' => qr'^\t\s*(\S+=\S+\s+)*ant\s' ], [ debhelper => qr'^\t\s*dh_.+' ], - [ 'dh-ocaml, ocaml-nox | ocaml' => qr'^\t\s*(?:dh_ocamlinit|dh\s.*--with(?:=|\s+)(?:\S+,)*ocaml)\s' ], + [ 'dh-ocaml, ocaml-nox | ocaml' => qr'^\t\s*(?:dh_ocamlinit|dh\s.*--with(?:=|\s+)(?:\S+,)*ocaml)\s's ], [ dpatch => qr'^\t\s*(\S+=\S+\s+)*dpatch\s' ], [ 'po-debconf' => qr'^\t\s*debconf-updatepo\s' ], [ $PYTHON_DEPEND => qr'^\t\s*python\s', 'missing-python-build-dependency' ], [ $PYTHON3_DEPEND => qr'^\t\s*python3\s', 'missing-python-build-dependency' ], [ $ANYPYTHON_DEPEND => qr'\ssetup\.py\b', 'missing-python-build-dependency' ], - [ quilt => qr'^\t\s*dh\s.*--with(?:=|\s+)(?:\S+,)*quilt' ], + [ quilt => qr'^\t\s*dh\s.*--with(?:=|\s+)(?:\S+,)*quilt's ], [ quilt => qr'^\t\s*(\S+=\S+\s+)*quilt\s' ], [ yada => qr'^\t\s*yada\s' ], ); @@ -156,6 +156,9 @@ my $uses_makefile_pl = 0; my %variables; while (<RULES>) { + while (s,\\$,, and defined (my $cont = <RULES>)) { + $_ .= $cont; + } next if /^\s*\#/; if (m/^\s*[s-]?include\s+(\S++)/o){ my $makefile = $1; @@ -185,8 +188,8 @@ if (/\$[\(\{]PWD[\)\}]/) { tag 'debian-rules-uses-pwd', "line $."; } - if (m/^\t\s*-(?:\$[\(\{]MAKE[\}\)]|make)\s.*(?:dist)?clean/ || - m/^\t\s*(?:\$[\(\{]MAKE[\}\)]|make)\s(?:.*\s)?-\w*i.*(?:dist)?clean/) { + if (m/^\t\s*-(?:\$[\(\{]MAKE[\}\)]|make)\s.*(?:dist)?clean/s || + m/^\t\s*(?:\$[\(\{]MAKE[\}\)]|make)\s(?:.*\s)?-\w*i.*(?:dist)?clean/s) { tag 'debian-rules-ignores-make-clean-error', "line $."; } if (/\$[\(\{]DEB_BUILD_OPTS[\)\}]/) { @@ -198,12 +201,12 @@ if (m/\bDEB_[^_ \t]+FLAGS_(?:SET|APPEND)\b/o) { tag 'debian-rules-uses-or-modifies-user-only-variable', "line $."; } - if ($uses_makefile_pl && m/install.*PREFIX/ && !/DESTDIR/) { + if ($uses_makefile_pl && m/install.*PREFIX/s && !/DESTDIR/) { tag 'debian-rules-makemaker-prefix-is-deprecated', "line $."; } # General assignment - save the variable - if (/^\s*(?:\S+\s+)*?(\S+)\s*([:\?\+])?=\s*(.*+)?$/o) { + if (/^\s*(?:\S+\s+)*?(\S+)\s*([:\?\+])?=\s*(.*+)?$/so) { # This is far too simple from a theoretical PoV, but should do # rather well. my ($var, $atype, $value) = ($1, $2, $3); @@ -234,7 +237,7 @@ # Listing a rule as a dependency of .PHONY is sufficient to make it # present for the purposes of GNU make and therefore the Policy # requirement. - if (/^(?:[^:]+\s)?\.PHONY(?:\s[^:]+)?:(.+)/) { + if (/^(?:[^:]+\s)?\.PHONY(?:\s[^:]+)?:(.+)/s) { my @targets = split (' ', $1); local $_; for (@targets) { @@ -261,7 +264,7 @@ next; #.PHONY implies the rest will not match } - if (!/^ifn?(?:eq|def)\s/ && m/^([^\s:][^:]*):+(.*)/) { + if (!/^ifn?(?:eq|def)\s/ && m/^([^\s:][^:]*):+(.*)/s) { @current_targets = split (' ', $1); my @depends = map { $_ = quotemeta $_;