From 1cc53e5756df8c1e48e19e3d0103c53f9fe2bc80 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 24 Nov 2006 14:06:34 +0000 Subject: rename var $second_pass into $need_second_pass (more clear) --- urpm/media.pm | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/urpm/media.pm b/urpm/media.pm index 48687bfd..8fb08248 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -415,6 +415,7 @@ sub write_config { #- need_hdlist (for urpmf: to be able to have info not available in synthesis) #- nodepslist (for urpmq: we don't need the hdlist/synthesis) #- no_skiplist (urpmf) +#- no_second_pass (urpmf) #- #- synthesis (use this synthesis file, and only this synthesis file) #- @@ -506,8 +507,9 @@ sub configure { } sub _parse_media { - my ($urpm, $second_pass, $options) = @_; + my ($urpm, $is_second_pass, $options) = @_; + my $need_second_pass; foreach (grep { !$_->{ignore} && (!$options->{update} || $_->{update}) } @{$urpm->{media} || []}) { our $currentmedia = $_; #- hack for urpmf delete @$_{qw(start end)}; @@ -517,11 +519,10 @@ sub _parse_media { _parse_synthesis($urpm, $_, hdlist_or_synthesis_for_virtual_medium($_), $options->{callback}); } else { - #- we'll need a second pass - $second_pass++; + $need_second_pass = 1 if !$is_second_pass && !$options->{no_second_pass}; _parse_hdlist($urpm, $_, hdlist_or_synthesis_for_virtual_medium($_), - $second_pass > 1 ? undef : $options->{callback}, + $options->{callback}, ); } } else { @@ -552,7 +553,7 @@ sub _parse_media { } } - if ($second_pass == 1) { + if ($need_second_pass) { require URPM::Build; $urpm->{log}(N("performing second pass to compute dependencies\n")); $urpm->unresolved_provides_clean; @@ -1207,7 +1208,7 @@ sub get_hdlist_or_synthesis_and_check_md5sum__local { } sub _read_rpms_from_dir { - my ($urpm, $medium, $second_pass, $clean_cache) = @_; + my ($urpm, $medium, $need_second_pass, $clean_cache) = @_; my $dir = file_from_local_url($medium->{url}); @@ -1255,7 +1256,7 @@ sub _read_rpms_from_dir { my @unresolved = grep { ! defined $urpm->{provides}{$_}; } keys %{$urpm->{provides} || {}}; - @unresolved_before == @unresolved or $$second_pass = 1; + @unresolved_before == @unresolved or $$need_second_pass = 1; delete $medium->{synthesis}; #- when building hdlist by ourself, drop synthesis property. 1; @@ -1263,7 +1264,7 @@ sub _read_rpms_from_dir { #- options: callback, force, force_building_hdlist, nomd5sum, nopubkey, probe_with sub _update_medium__parse_if_unmodified__local { - my ($urpm, $medium, $second_pass, $clean_cache, $options) = @_; + my ($urpm, $medium, $need_second_pass, $clean_cache, $options) = @_; my $dir = file_from_local_url($medium->{url}); @@ -1349,7 +1350,7 @@ this could happen if you mounted manually the directory when creating the medium } if ($options->{force_building_hdlist}) { - _read_rpms_from_dir($urpm, $medium, $second_pass, $clean_cache) or return; + _read_rpms_from_dir($urpm, $medium, $need_second_pass, $clean_cache) or return; } } @@ -1512,7 +1513,7 @@ sub _write_rpm_list { #- options: callback, force, force_building_hdlist, nomd5sum, probe_with, quiet #- (from _update_medium__parse_if_unmodified__local and _update_medium__parse_if_unmodified__remote) sub _update_medium_first_pass { - my ($urpm, $medium, $second_pass, $clean_cache, %options) = @_; + my ($urpm, $medium, $need_second_pass, $clean_cache, %options) = @_; #- we should create the associated synthesis file if it does not already exist... file_size(statedir_synthesis($urpm, $medium)) >= 20 @@ -1540,7 +1541,7 @@ sub _update_medium_first_pass { { my $rc = file_from_local_url($medium->{url}) - ? _update_medium__parse_if_unmodified__local($urpm, $medium, $second_pass, $clean_cache, \%options) + ? _update_medium__parse_if_unmodified__local($urpm, $medium, $need_second_pass, $clean_cache, \%options) : _update_medium__parse_if_unmodified__remote($urpm, $medium, \%options); if (!$rc || $rc eq 'unmodified') { @@ -1587,7 +1588,7 @@ sub _update_medium_first_pass { { my @unresolved_after = grep { ! defined $urpm->{provides}{$_} } keys %{$urpm->{provides} || {}}; - @unresolved_before == @unresolved_after or $$second_pass = 1; + @unresolved_before == @unresolved_after or $$need_second_pass = 1; } } } @@ -1723,21 +1724,21 @@ sub update_media { _update_media__handle_some_flags($urpm, $options{forcekey}, $options{all}); my $clean_cache = !$options{noclean}; - my $second_pass; + my $need_second_pass; foreach my $medium (grep { !$_->{ignore} } @{$urpm->{media}}) { - _update_medium_first_pass($urpm, $medium, \$second_pass, \$clean_cache, %options) + _update_medium_first_pass($urpm, $medium, \$need_second_pass, \$clean_cache, %options) or _update_medium_first_pass_failed($urpm, $medium); } #- some unresolved provides may force to rebuild all synthesis, #- a second pass will be necessary. - if ($second_pass) { + if ($need_second_pass) { $urpm->{log}(N("performing second pass to compute dependencies\n")); $urpm->unresolved_provides_clean; } foreach my $medium (grep { !$_->{ignore} } @{$urpm->{media}}) { - if ($second_pass) { + if ($need_second_pass) { #- second pass consists in reading again synthesis or hdlists. _update_medium_second_pass($urpm, $medium, $options{callback}); } -- cgit v1.2.1