diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-11-04 11:36:34 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-11-04 11:36:34 +0000 |
commit | e397212b405a465b69a90aaa6a486d00aa9a64cb (patch) | |
tree | 9b248b53762e4511e8375414e7ab40a3f5f29e0d | |
parent | 57402bbd4f0809adfdb984fd1a103a2ccd3af0e1 (diff) | |
download | urpmi-e397212b405a465b69a90aaa6a486d00aa9a64cb.tar urpmi-e397212b405a465b69a90aaa6a486d00aa9a64cb.tar.gz urpmi-e397212b405a465b69a90aaa6a486d00aa9a64cb.tar.bz2 urpmi-e397212b405a465b69a90aaa6a486d00aa9a64cb.tar.xz urpmi-e397212b405a465b69a90aaa6a486d00aa9a64cb.zip |
Avoid useless use of cat
-rwxr-xr-x | urpmq | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -310,10 +310,16 @@ if ($urpm::args::options{list_aliases}) { # TODO rewrite rpm2header in perl values %$local_sources and system 'rpm2header', values %$local_sources; foreach (0..$#{$urpm->{media} || []}) { - my @headers = (grep { my $file = "$urpm->{cachedir}/headers/$_"; - -s $file and system 'cat', $file; # TODO burk - ! -s $file } - map { m|(.*)/([^/]*)-([^-]*)-([^-]*)\.([^\.]*)\.rpm| and "$2-$3-$4.$5" } values %{$list->[$_]}); + my @headers = (grep { + my $file = "$urpm->{cachedir}/headers/$_"; + if (-s $file) { + my $fh; open $fh, '<', $file and do { + while (<$fh>) { print STDOUT $_ } + close $fh; + }; + } + ! -s $file; + } map { m|(.*)/([^/]*)-([^-]*)-([^-]*)\.([^\.]*)\.rpm| and "$2-$3-$4.$5" } values %{$list->[$_]}); @headers > 0 or next; if (-s "$urpm->{statedir}/$urpm->{media}[$_]{hdlist}") { |