dcavalca / rpms / rpm

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