From f0c0ba3c176af4afd6659f532541043c7143e0e8 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sat, 11 Aug 2007 15:37:48 +0000 Subject: - get rid of a warning reading empty file - have extra first in the list (useful for --preferred being taken into account before /etc/urpmi/preferred.list) - cleanup --- urpm/sys.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/urpm/sys.pm b/urpm/sys.pm index 90f91e8d..612c9ed6 100644 --- a/urpm/sys.pm +++ b/urpm/sys.pm @@ -15,14 +15,14 @@ use POSIX (); #- typically from the inst.list or skip.list files. sub get_packages_list { my ($file, $o_extra) = @_; - my $val = []; - open(my $f, '<', $file); - foreach (<$f>, split /,/, $o_extra || '') { - chomp; s/#.*$//; s/^\s*//; s/\s*$//; - next if $_ eq ''; - push @$val, $_; + my @l = split(/,/, $o_extra || ''); + if (open(my $f, '<', $file)) { + push @l, <$f>; } - $val; + [ grep { $_ } map { + chomp; s/#.*$//; s/^\s*//; s/\s*$//; + $_; + } @l ]; } #- find used mount point from a pathname, use a optional mode to allow -- cgit v1.2.1