From e397212b405a465b69a90aaa6a486d00aa9a64cb Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Fri, 4 Nov 2005 11:36:34 +0000 Subject: Avoid useless use of cat --- urpmq | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'urpmq') diff --git a/urpmq b/urpmq index c192ad02..7062b13b 100755 --- a/urpmq +++ b/urpmq @@ -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}") { -- cgit v1.2.1