summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-08-11 15:37:48 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-08-11 15:37:48 +0000
commitf0c0ba3c176af4afd6659f532541043c7143e0e8 (patch)
tree5df0e46ab225d23dd99ff615f29dd31649e6a4a7
parentc5399523daa90db86e0dd1220d5480e7baf1cfd3 (diff)
downloadurpmi-f0c0ba3c176af4afd6659f532541043c7143e0e8.tar
urpmi-f0c0ba3c176af4afd6659f532541043c7143e0e8.tar.gz
urpmi-f0c0ba3c176af4afd6659f532541043c7143e0e8.tar.bz2
urpmi-f0c0ba3c176af4afd6659f532541043c7143e0e8.tar.xz
urpmi-f0c0ba3c176af4afd6659f532541043c7143e0e8.zip
- 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
-rw-r--r--urpm/sys.pm14
1 files 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