[devscripts] 01/01: grep-excuses: Convert all embedded <li> elements to new lines

James McCoy jamessan at debian.org
Sat Feb 25 05:52:56 UTC 2017


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit e1a18a8fea607dcfcfae3b4c65ed446f51ed8455
Author: James McCoy <jamessan at debian.org>
Date:   Sat Feb 25 00:09:10 2017 -0500

    grep-excuses: Convert all embedded <li> elements to new lines
    
    There was already code to do this when we have a matching item, but
    embedded <li> elements could actually prevent detecting a matching
    excuse (c.f., #856104).
    
    Lift the existing munging up so it happens while we collect the data for
    each excuse, thus fixing the matching of relevant excuses.
    
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog        | 3 +++
 scripts/grep-excuses.pl | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 9e2bca3..7e28ad1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,9 @@ devscripts (2.17.2) UNRELEASED; urgency=medium
   [ James McCoy ]
   * deb-reversion:
     + Correct parsing of long-form --new-version switch.  (Closes: #853919)
+  * grep-excuses:
+    + Improve robustness of HTML parsing to avoid issues like #856104, until
+      grep-excuses is converted to consume YAML.
 
   [ Antonio Terceiro ]
   * rc-alert:
diff --git a/scripts/grep-excuses.pl b/scripts/grep-excuses.pl
index ebe82de..adeeebd 100755
--- a/scripts/grep-excuses.pl
+++ b/scripts/grep-excuses.pl
@@ -306,6 +306,7 @@ while (<EXCUSES>) {
     # New item?
     if (! $sublist and /^\s*<li>/) {
 	s%<li>%%;
+	s%<li>%\n%g;
 	$item = $_;
     }
     elsif (! $sublist and /^\s*<ul>/) {
@@ -316,13 +317,12 @@ while (<EXCUSES>) {
 	# Did the last item match?
 	if ($item=~/^-?\Q$string\E\s/ or
 	    $item=~/^\s*Maintainer:\s[^\n]*\b\Q$string\E\b[^\n]*$/m) {
-	    # In case there are embedded <li> tags
-	    $item =~ s%<li>%\n    %g;
 	    print $item;
 	}
     }
     elsif ($sublist and /^\s*<li>/) {
 	s%<li>%    %;
+	s%<li>%\n    %g;
 	$item .= $_;
     }
     else {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list