summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-21 14:47:46 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-21 14:47:46 +0000
commit9bf2a395e40ada0ab2a798893fe270463429d1a3 (patch)
tree16b6b381d2b3b2b5a1773e54beb4c8a0946765fc
parent6c2bdf36b20c2f3b23e3923c7065840c780b31f4 (diff)
downloadurpmi-9bf2a395e40ada0ab2a798893fe270463429d1a3.tar
urpmi-9bf2a395e40ada0ab2a798893fe270463429d1a3.tar.gz
urpmi-9bf2a395e40ada0ab2a798893fe270463429d1a3.tar.bz2
urpmi-9bf2a395e40ada0ab2a798893fe270463429d1a3.tar.xz
urpmi-9bf2a395e40ada0ab2a798893fe270463429d1a3.zip
create _parse_media() out of configure()
-rw-r--r--urpm.pm109
1 files changed, 56 insertions, 53 deletions
diff --git a/urpm.pm b/urpm.pm
index 753dccd2..903380a4 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -670,59 +670,7 @@ sub configure {
my @remaining = difference2($urpm->{media}, \@sorted_media);
$urpm->{media} = [ @sorted_media, @remaining ];
}
- unless ($options{nodepslist}) {
- my $second_pass;
- do {
- foreach (grep { !$_->{ignore} && (!$options{update} || $_->{update}) } @{$urpm->{media} || []}) {
- our $currentmedia = $_; #- hack for urpmf
- delete @$_{qw(start end)};
- if ($_->{virtual}) {
- if (file_from_file_url($_->{url})) {
- if ($_->{synthesis}) {
- _parse_synthesis($urpm, $_,
- hdlist_or_synthesis_for_virtual_medium($_), $options{callback});
- } else {
- #- we'll need a second pass
- defined $second_pass or $second_pass = 1;
- _parse_hdlist($urpm, $_,
- hdlist_or_synthesis_for_virtual_medium($_),
- $second_pass ? undef : $options{callback},
- );
- }
- } else {
- $urpm->{error}(N("virtual medium \"%s\" is not local, medium ignored", $_->{name}));
- $_->{ignore} = 1;
- }
- } else {
- if ($options{need_hdlist} && file_size(statedir_hdlist($urpm, $_)) > 32) {
- _parse_hdlist($urpm, $_, statedir_hdlist($urpm, $_), $options{callback});
- } else {
- if (!_parse_synthesis($urpm, $_,
- statedir_synthesis($urpm, $_),
- $options{callback})) {
- _parse_hdlist($urpm, $_, statedir_hdlist($urpm, $_), $options{callback});
- }
- }
- }
- unless ($_->{ignore}) {
- _check_after_reading_hdlist_or_synthesis($urpm, $_);
- }
- unless ($_->{ignore}) {
- if ($_->{searchmedia}) {
- ($urpm->{searchmedia}{start}, $urpm->{searchmedia}{end}) = ($_->{start}, $_->{end});
- $urpm->{log}(N("Search start: %s end: %s",
- $urpm->{searchmedia}{start}, $urpm->{searchmedia}{end}));
- delete $_->{searchmedia};
- }
- }
- }
- } while $second_pass && do {
- require URPM::Build;
- $urpm->{log}(N("performing second pass to compute dependencies\n"));
- $urpm->unresolved_provides_clean;
- $second_pass--;
- };
- }
+ _parse_media($urpm, 0, \%options) if !$options{nodepslist};
}
#- determine package to withdraw (from skip.list file) only if something should be withdrawn.
if (!$options{nodepslist}) {
@@ -731,6 +679,61 @@ sub configure {
}
}
+sub _parse_media {
+ my ($urpm, $second_pass, $options) = @_;
+
+ foreach (grep { !$_->{ignore} && (!$options->{update} || $_->{update}) } @{$urpm->{media} || []}) {
+ our $currentmedia = $_; #- hack for urpmf
+ delete @$_{qw(start end)};
+ if ($_->{virtual}) {
+ if (file_from_file_url($_->{url})) {
+ if ($_->{synthesis}) {
+ _parse_synthesis($urpm, $_,
+ hdlist_or_synthesis_for_virtual_medium($_), $options->{callback});
+ } else {
+ #- we'll need a second pass
+ $second_pass++;
+ _parse_hdlist($urpm, $_,
+ hdlist_or_synthesis_for_virtual_medium($_),
+ $second_pass > 1 ? undef : $options->{callback},
+ );
+ }
+ } else {
+ $urpm->{error}(N("virtual medium \"%s\" is not local, medium ignored", $_->{name}));
+ $_->{ignore} = 1;
+ }
+ } else {
+ if ($options->{need_hdlist} && file_size(statedir_hdlist($urpm, $_)) > 32) {
+ _parse_hdlist($urpm, $_, statedir_hdlist($urpm, $_), $options->{callback});
+ } else {
+ if (!_parse_synthesis($urpm, $_,
+ statedir_synthesis($urpm, $_),
+ $options->{callback})) {
+ _parse_hdlist($urpm, $_, statedir_hdlist($urpm, $_), $options->{callback});
+ }
+ }
+ }
+ unless ($_->{ignore}) {
+ _check_after_reading_hdlist_or_synthesis($urpm, $_);
+ }
+ unless ($_->{ignore}) {
+ if ($_->{searchmedia}) {
+ ($urpm->{searchmedia}{start}, $urpm->{searchmedia}{end}) = ($_->{start}, $_->{end});
+ $urpm->{log}(N("Search start: %s end: %s",
+ $urpm->{searchmedia}{start}, $urpm->{searchmedia}{end}));
+ delete $_->{searchmedia};
+ }
+ }
+ }
+
+ if ($second_pass == 1) {
+ require URPM::Build;
+ $urpm->{log}(N("performing second pass to compute dependencies\n"));
+ $urpm->unresolved_provides_clean;
+ _parse_media($urpm, 1, $options);
+ }
+}
+
sub _compute_flags_for_skiplist {
my ($urpm, $cmdline_skiplist) = @_;
my %uniq;