From 3b4566be852a5319345f960917a6881da44c2bd3 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 8 Jul 2008 17:50:31 +0000 Subject: - compute $blist->{list} first url instead of having it in $blist->{url} - create file_or_synthesis_dir_from_blist() and use it --- urpm/cdrom.pm | 2 +- urpm/removable.pm | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'urpm') diff --git a/urpm/cdrom.pm b/urpm/cdrom.pm index c09c55a2..6fcfe9f7 100644 --- a/urpm/cdrom.pm +++ b/urpm/cdrom.pm @@ -21,7 +21,7 @@ sub _find_blist_url_matching { # set it, then verify $blist->{medium}{mntpoint} = $mntpoint; - if (-r urpm::removable::file_or_synthesis_dir($blist->{medium}, $blist->{url})) { + if (-r urpm::removable::file_or_synthesis_dir_from_blist($blist)) { $urpm->{log}("found cdrom $blist->{medium}{name} mounted in $mntpoint"); push @l, $blist; } else { diff --git a/urpm/removable.pm b/urpm/removable.pm index 6e392ddd..558e95a6 100644 --- a/urpm/removable.pm +++ b/urpm/removable.pm @@ -17,6 +17,12 @@ sub file_or_synthesis_dir { file_from_local_medium($medium, $o_url); } +sub file_or_synthesis_dir_from_blist { + my ($blist) = @_; + + file_or_synthesis_dir($blist->{medium}, _blist_first_url($blist)); +} + #- side-effects: #- + those of try_mounting_medium_ ($medium->{mntpoint}) sub try_mounting_medium { @@ -135,7 +141,7 @@ sub try_mounting_non_cdroms { my $blists = create_blists($urpm->{media}, $list); foreach my $blist (grep { urpm::file_from_local_url($_->{medium}{url}) } @$blists) { - try_mounting_medium($urpm, $blist->{medium}, $blist->{url}); + try_mounting_medium($urpm, $blist->{medium}, _blist_first_url($blist)); } } @@ -150,9 +156,16 @@ sub create_blists { my $i; [ map { my $list = $list->[$i++]; - my ($url) = values %$list; # first url - $url ? { medium => $_, list => $list, url => $url } : (); + %$list ? { medium => $_, list => $list } : (); } @$media ]; } +#- side-effects: none +sub _blist_first_url { + my ($blist) = @_; + + my ($url) = values %{$blist->{list}}; + $url; +} + 1; -- cgit v1.2.1