chantra / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
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] Ignore "use" or "requires" within multi-line print or assign
5523e9
 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
--- rpm-4.8.0/scripts/perl.req.ignore-multiline2
5523e9
+++ rpm-4.8.0/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
1.9.3
5523e9