summaryrefslogtreecommitdiffstats
path: root/urpm/get_pkgs.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-08 16:49:03 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-08 16:49:03 +0000
commit1996511a162e6b4ee7c4b4a2e325100e483f5519 (patch)
tree0bc3450763196ed0c3dcfe85f0a195a7ed9afc0d /urpm/get_pkgs.pm
parente5a33d4993881ab56c414adee112e713c7d9984a (diff)
downloadurpmi-1996511a162e6b4ee7c4b4a2e325100e483f5519.tar
urpmi-1996511a162e6b4ee7c4b4a2e325100e483f5519.tar.gz
urpmi-1996511a162e6b4ee7c4b4a2e325100e483f5519.tar.bz2
urpmi-1996511a162e6b4ee7c4b4a2e325100e483f5519.tar.xz
urpmi-1996511a162e6b4ee7c4b4a2e325100e483f5519.zip
create cachedir_rpms() out of _selected2local_and_ids()
Diffstat (limited to 'urpm/get_pkgs.pm')
-rw-r--r--urpm/get_pkgs.pm31
1 files changed, 23 insertions, 8 deletions
diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm
index 0312321a..71336da0 100644
--- a/urpm/get_pkgs.pm
+++ b/urpm/get_pkgs.pm
@@ -17,6 +17,25 @@ sub clean_all_cache {
urpm::sys::empty_dir("$urpm->{cachedir}/rpms");
}
+sub cachedir_rpms {
+ my ($urpm) = @_;
+
+ #- examine the local repository, which is trusted (no gpg or pgp signature check but md5 is now done).
+ my %fn2file;
+ 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);
+ my ($fullname) = $filename =~ /(.*)\.rpm$/ or next;
+ $fn2file{$fullname} = $filepath;
+ }
+ }
+ \%fn2file;
+}
+
#- select sources for selected packages,
#- according to keys of the packages hash.
#- returns a list of lists containing the source description for each rpm,
@@ -39,20 +58,16 @@ sub _selected2local_and_ids {
}
#- examine the local repository, which is trusted (no gpg or pgp signature check but md5 is now done).
- foreach my $filepath (glob("$urpm->{cachedir}/rpms/*")) {
- next if -d $filepath;
+ my $cachedir_rpms = cachedir_rpms($urpm);
+
+ foreach my $fullname (keys %$cachedir_rpms) {
+ my $filepath = $cachedir_rpms->{$fullname};
- if (! -s $filepath) {
- unlink $filepath; #- this file should be removed or is already empty.
- } else {
- my $filename = basename($filepath);
- my ($fullname) = $filename =~ /(.*)\.rpm$/ or next;
if (my $id = delete $fullname2id{$fullname}) {
$local_sources{$id} = $filepath;
} else {
$options{clean_other} && ! exists $protected_files{$filepath} and unlink $filepath;
}
- }
}
my %id2ids;