summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-02-27 19:01:02 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-02-27 19:01:02 +0000
commit59a01a6fabd2ab19a5b5da320acdf02f0015b978 (patch)
tree1b78313f00b1ec5a517dbf89789b3fa803c792a5 /urpm
parent2e9fe3bdbc0022b37346e83c0f7c75841ea54a7b (diff)
downloadurpmi-59a01a6fabd2ab19a5b5da320acdf02f0015b978.tar
urpmi-59a01a6fabd2ab19a5b5da320acdf02f0015b978.tar.gz
urpmi-59a01a6fabd2ab19a5b5da320acdf02f0015b978.tar.bz2
urpmi-59a01a6fabd2ab19a5b5da320acdf02f0015b978.tar.xz
urpmi-59a01a6fabd2ab19a5b5da320acdf02f0015b978.zip
- urpmi
o do not copy rpms from cdrom if only one cdrom is used (#28083)
Diffstat (limited to 'urpm')
-rw-r--r--urpm/removable.pm14
1 files changed, 6 insertions, 8 deletions
diff --git a/urpm/removable.pm b/urpm/removable.pm
index 18ccb99d..2d5f35cf 100644
--- a/urpm/removable.pm
+++ b/urpm/removable.pm
@@ -205,8 +205,6 @@ sub _filepath {
sub _do_the_copy {
my ($urpm, $filepath) = @_;
- -r $filepath or return;
-
#- we should assume a possibly buggy removable device...
#- First, copy in partial cache, and if the package is still good,
#- transfer it to the rpms cache.
@@ -221,16 +219,16 @@ sub _do_the_copy {
#- side-effects: $sources
#- + those of _mount_it ($urpm->{removable_mounted}, "mount", "umount", "eject")
#- + those of _do_the_copy: "copy-move-files"
-sub _copy_from_cdrom {
- my ($urpm, $blist, $sources, $ask_for_medium) = @_;
+sub _copy_from_cdrom__if_needed {
+ my ($urpm, $blist, $sources, $ask_for_medium, $want_copy) = @_;
_mount_it($urpm, $blist, $ask_for_medium);
while (my ($i, $url) = each %{$blist->{list}}) {
my $filepath = _filepath($blist->{medium}, $url) or next;
- if (my $rpm = _do_the_copy($urpm, $filepath)) {
- $sources->{$i} = $rpm;
+ if (-r $filepath) {
+ $sources->{$i} = $want_copy ? _do_the_copy($urpm, $filepath) : $filepath;
} else {
#- fallback to use other method for retrieving the file later.
$urpm->{error}(N("unable to read rpm file [%s] from medium \"%s\"", $filepath, $blist->{medium}{name}));
@@ -296,7 +294,7 @@ sub _sort_media {
#- where there is one hash for each medium in {media}
#-
#- side-effects:
-#- + those of _copy_from_cdrom ($urpm->{removable_mounted}, $sources, "mount", "umount", "eject", "copy-move-files")
+#- + those of _copy_from_cdrom__if_needed ($urpm->{removable_mounted}, $sources, "mount", "umount", "eject", "copy-move-files")
sub copy_packages_of_removable_media {
my ($urpm, $list, $sources, $o_ask_for_medium) = @_;
@@ -306,7 +304,7 @@ sub copy_packages_of_removable_media {
my @l = _sort_media(grep { urpm::is_cdrom_url($_->{medium}{url}) } @$blists);
foreach my $blist (@l) {
- _copy_from_cdrom($urpm, $blist, $sources, $o_ask_for_medium);
+ _copy_from_cdrom__if_needed($urpm, $blist, $sources, $o_ask_for_medium, @l > 1);
}
1;