teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.7.1-perl-heredoc.patch

Panu Matilainen 11e840
commit 007218488a33678c66b19b34ab1ef9fd2ffaec9e
Panu Matilainen 11e840
Author: Ville Skyttä <ville.skytta@iki.fi>
Panu Matilainen 11e840
Date:   Tue Sep 22 21:11:20 2009 +0300
Panu Matilainen 11e840
Panu Matilainen 11e840
    Improve perl.req here-doc skipping.
Panu Matilainen 11e840
    
Panu Matilainen 11e840
    This version is stricter in finding the end identifier by using equality test
Panu Matilainen 11e840
    instead of a regex (as a side effect, fixes rhbz#524929) as well as parsing
Panu Matilainen 11e840
    quoted identifiers, and adds support for identifiers in backticks.
Panu Matilainen 11e840
    (cherry picked from commit dab575b24498e2362845e7da6dc76015fa88b4a9)
Panu Matilainen 11e840
Panu Matilainen 11e840
diff --git a/scripts/perl.req b/scripts/perl.req
Panu Matilainen 11e840
index 0d26346..4c08dcd 100755
Panu Matilainen 11e840
--- a/scripts/perl.req
Panu Matilainen 11e840
+++ b/scripts/perl.req
Panu Matilainen 11e840
@@ -82,12 +82,14 @@ sub process_file {
Panu Matilainen 11e840
     
Panu Matilainen 11e840
     # skip the "= <<" block
Panu Matilainen 11e840
 
Panu Matilainen 11e840
-    if ( ( m/^\s*\$(.*)\s*=\s*<<\s*["'](.*)['"]/) ||
Panu Matilainen 11e840
-         ( m/^\s*\$(.*)\s*=\s*<<\s*(.*);/) ) {
Panu Matilainen 11e840
+    if ( ( m/^\s*\$(?:.*)\s*=\s*<<\s*(["'`])(.*)\1/) ||
Panu Matilainen 11e840
+         ( m/^\s*\$(.*)\s*=\s*<<(\w*)\s*;/) ) {
Panu Matilainen 11e840
       $tag = $2;
Panu Matilainen 11e840
       while (<FILE>) {
Panu Matilainen 11e840
-        ( $_ =~ /^$tag/) && last;
Panu Matilainen 11e840
+        chomp;
Panu Matilainen 11e840
+        ( $_ eq $tag ) && last;
Panu Matilainen 11e840
       }
Panu Matilainen 11e840
+      $_ = <FILE>;
Panu Matilainen 11e840
     }
Panu Matilainen 11e840
 
Panu Matilainen 11e840
     # skip q{} quoted sections - just hope we don't have curly brackets