diff options
author | 2014-10-28 12:44:09 +0100 | |
---|---|---|
committer | 2014-10-28 12:44:09 +0100 | |
commit | 59aa35d0fa3edf777e51c611a8d65bbc6799cf49 (patch) | |
tree | 81e2612670033753d951f6d8e3e77e79bb9b4b83 | |
parent | TODO: Added plan to support package.use editing. (diff) | |
download | ufed-59aa35d0fa3edf777e51c611a8d65bbc6799cf49.tar.gz ufed-59aa35d0fa3edf777e51c611a8d65bbc6799cf49.tar.bz2 ufed-59aa35d0fa3edf777e51c611a8d65bbc6799cf49.zip |
Portage.pm : Added fix by Martin Väth from Bug 525876 to allow the reading of directories that used to be files.
-rw-r--r-- | Portage.pm | 26 |
1 files changed, 17 insertions, 9 deletions
@@ -705,19 +705,27 @@ sub _merge_env { } -# returns a list of all lines of a given file +# returns a list of all lines of a given file/dir # that are no pure comments -# Parameter 1: filename +# Parameter 1: filename/dirname sub _noncomments { my ($fname) = @_; - my @result; - local $/; - if(open my $file, '<', $fname) { - binmode( $file, ":encoding(UTF-8)" ); - @result = split /(?:[^\S\n]*(?:#.*)?\n)+/, <$file>."\n"; - shift @result if @result>0 && $result[0] eq ''; - close $file; + my @result = (); + + if(-d $fname) { + for my $i (_get_files_from_dir($fname)) { + (-f $i) && push @result, _noncomments($i); + } + } else { + local $/; + if(open my $file, '<', $fname) { + binmode( $file, ":encoding(UTF-8)" ); + @result = split /(?:[^\S\n]*(?:#.*)?\n)+/, <$file>."\n"; + shift @result if @result>0 && $result[0] eq ''; + close $file; + } } + return @result; } |