summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-01-10 16:32:38 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-01-10 16:32:38 +0000
commitc1a4747982fe3c5d9e3dbc3ade9da748b3f4a71d (patch)
treee42e74e37b14eb492b063e813c150a9fbed17db0 /urpm
parent79161af95d3aceb9c5fdccef65048c6b2b472a28 (diff)
downloadurpmi-c1a4747982fe3c5d9e3dbc3ade9da748b3f4a71d.tar
urpmi-c1a4747982fe3c5d9e3dbc3ade9da748b3f4a71d.tar.gz
urpmi-c1a4747982fe3c5d9e3dbc3ade9da748b3f4a71d.tar.bz2
urpmi-c1a4747982fe3c5d9e3dbc3ade9da748b3f4a71d.tar.xz
urpmi-c1a4747982fe3c5d9e3dbc3ade9da748b3f4a71d.zip
simplify
Diffstat (limited to 'urpm')
-rw-r--r--urpm/get_pkgs.pm17
1 files changed, 7 insertions, 10 deletions
diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm
index c3029a2d..8cbcff70 100644
--- a/urpm/get_pkgs.pm
+++ b/urpm/get_pkgs.pm
@@ -37,14 +37,13 @@ sub selected2list {
}
#- examine the local repository, which is trusted (no gpg or pgp signature check but md5 is now done).
- my $dh = urpm::sys::opendir_safe($urpm, "$urpm->{cachedir}/rpms");
- if ($dh) {
- while (defined(my $filename = readdir $dh)) {
- my $filepath = "$urpm->{cachedir}/rpms/$filename";
- if (-d $filepath) {
- } elsif ($options{clean_all} || ! -s _) {
- unlink $filepath; #- this file should be removed or is already empty.
- } else {
+ foreach my $filepath (glob("$urpm->{cachedir}/rpms/*")) {
+ next if -d $filepath;
+
+ if (! -s $filepath) {
+ unlink $filepath; #- this file should be removed or is already empty.
+ } else {
+ my $filename = basename($filepath);
if (keys(%{$file2fullnames{$filename} || {}}) > 1) {
$urpm->{error}(N("there are multiple packages with the same rpm filename \"%s\"", $filename));
} elsif (keys(%{$file2fullnames{$filename} || {}}) == 1) {
@@ -57,9 +56,7 @@ sub selected2list {
} else {
$options{clean_other} && ! exists $protected_files{$filepath} and unlink $filepath;
}
- }
}
- closedir $dh;
}
if ($options{clean_all}) {