teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

Blame SOURCES/rpm-4.11.x-perl.req-2.patch

5523e9
From 4c621e97776a47c2b4e7f17c1cd2a7961453babf Mon Sep 17 00:00:00 2001
5523e9
From: Lubos Kardos <lkardos@redhat.com>
5523e9
Date: Wed, 3 Dec 2014 14:01:14 +0100
5523e9
Subject: [PATCH 2/2] Ignore "use" or "requires" within multi-line print or
5523e9
 assign statement
5523e9
5523e9
- Now script perl.req ignores "use" and "requires" on lines that are
5523e9
  part of printing or assigning multi-line string i. e. string that
5523e9
  hasn't starting and ending quote on the same line.
5523e9
  (RhBug:1024517)
5523e9
---
5523e9
 scripts/perl.req | 13 +++++++++++++
5523e9
 1 file changed, 13 insertions(+)
5523e9
5523e9
diff --git a/scripts/perl.req b/scripts/perl.req
5523e9
index e17ad5a..6e53c91 100755
5523e9
--- a/scripts/perl.req
5523e9
+++ b/scripts/perl.req
5523e9
@@ -174,6 +174,19 @@ sub process_file {
5523e9
         $_ = <FILE>;
5523e9
     }
5523e9
 
5523e9
+    # Skip multiline print and assign statements
5523e9
+    if ( m/\$\S+\s*=\s*(")([^"\\]|(\\.))*$/ ||
5523e9
+         m/\$\S+\s*=\s*(')([^'\\]|(\\.))*$/ ||
5523e9
+         m/print\s+(")([^"\\]|(\\.))*$/ ||
5523e9
+         m/print\s+(')([^'\\]|(\\.))*$/ ) {
5523e9
+
5523e9
+        my $quote = $1;
5523e9
+        while (<FILE>) {
5523e9
+          m/^([^\\$quote]|(\\.))*$quote/ && last;
5523e9
+        }
5523e9
+        $_ = <FILE>;
5523e9
+    }
5523e9
+
5523e9
     if (
5523e9
 
5523e9
 # ouch could be in a eval, perhaps we do not want these since we catch
5523e9
-- 
5523e9
2.5.5
5523e9