summaryrefslogtreecommitdiffstats
path: root/urpmq
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-04 11:36:34 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-04 11:36:34 +0000
commite397212b405a465b69a90aaa6a486d00aa9a64cb (patch)
tree9b248b53762e4511e8375414e7ab40a3f5f29e0d /urpmq
parent57402bbd4f0809adfdb984fd1a103a2ccd3af0e1 (diff)
downloadurpmi-e397212b405a465b69a90aaa6a486d00aa9a64cb.tar
urpmi-e397212b405a465b69a90aaa6a486d00aa9a64cb.tar.gz
urpmi-e397212b405a465b69a90aaa6a486d00aa9a64cb.tar.bz2
urpmi-e397212b405a465b69a90aaa6a486d00aa9a64cb.tar.xz
urpmi-e397212b405a465b69a90aaa6a486d00aa9a64cb.zip
Avoid useless use of cat
Diffstat (limited to 'urpmq')
-rwxr-xr-xurpmq14
1 files changed, 10 insertions, 4 deletions
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}") {