ekeyword: Don't touch an empty KEYWORDS variable in case it occurs more
authoridl0r <idl0r@gentoo.org>
Sun, 4 Jul 2010 09:18:48 +0000 (09:18 -0000)
committeridl0r <idl0r@gentoo.org>
Sun, 4 Jul 2010 09:18:48 +0000 (09:18 -0000)
than once, like in live ebuilds. Bug 321475.

svn path=/trunk/gentoolkit-dev/; revision=795

ChangeLog
src/ekeyword/ekeyword

index 6263afd8c74894f07fc9587c09b297f0936a7f95..bcd5eb77818d94e4c1b405046fd5d648b86c4f0d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-03: Christian Ruppert <idl0r@gentoo.org>
+       * ekeyword: Don't touch an empty KEYWORDS variable in case it occurs more
+       than once, like in live ebuilds. Bug 321475.
+
 2010-07-03: Christian Ruppert <idl0r@gentoo.org>
        * ekeyword: Fix stabilization with "all", bug 304133#c11.
 
index 95289116d82e261d14af96210d8cf08ca8bd0f1d..1ac0403cdd4f8511c026a3b24b5ceb23bfa19cbb 100755 (executable)
@@ -112,6 +112,12 @@ for my $f (@ARGV) {
        open O, ">$f.new"   or die "Can't create $f.new: $!\n";
        select O;
 
+       my $count = 0;
+       while(<I>) {
+               $count++ if m/^\s*KEYWORDS=/;
+       }
+       seek(I, 0, 0);
+
        while (<I>) {
                if (/^\s*KEYWORDS=/) {
 
@@ -123,6 +129,13 @@ for my $f (@ARGV) {
                        }
                        (my $quoted = $_) =~ s/^.*?["'](.*?)["'].*/$1/s;
 
+                       if($count > 1 && length($quoted) eq 0) {
+                               # Skip empty KEYWORDS variables in case they occur more than
+                               # once, bug 321475.
+                               print $_;
+                               next;
+                       }
+
                        # replace -* with -STAR for our convenience below
                        $quoted =~ s/-\*/-STAR/;