From 7e54d47105159894a617398dd2ca4faa782fe587 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 27 Sep 2007 16:23:16 +0000 Subject: - urpm::media::update_media: o ensure a second pass is done even if media has not been modified (useful for the %trigger trick done in urpmi to rebuild synthesis with suggests) without it, file provides are not computed properly --- NEWS | 4 ++++ urpm/media.pm | 22 +++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 9a74e0e6..3f269b1a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +- urpm::media::update_media: + o ensure a second pass is done even if media has not been modified + (useful for the %trigger trick done in urpmi to rebuild synthesis with + suggests) - urpmf o fix -a and -o diff --git a/urpm/media.pm b/urpm/media.pm index 265ff667..3ff146f1 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -1587,12 +1587,15 @@ sub _update_medium_first_pass { file_size(statedir_synthesis($urpm, $medium)) >= 20 or $medium->{must_build_synthesis} = 1; + my @unresolved_before = grep { ! defined $urpm->{provides}{$_} } keys %{$urpm->{provides} || {}}; + unless ($medium->{modified}) { #- the medium is not modified, but to compute dependencies, #- we still need to read it and all synthesis will be written if #- an unresolved provides is found. #- to speed up the process, we only read the synthesis at the beginning. _parse_hdlist_or_synthesis__when_not_modified($urpm, $medium); + compute_need_second_pass($urpm, $medium, \@unresolved_before); return 1; } @@ -1606,8 +1609,6 @@ sub _update_medium_first_pass { may_reconfig_urpmi($urpm, $medium); } - my @unresolved_before = grep { ! defined $urpm->{provides}{$_} } keys %{$urpm->{provides} || {}}; - { my $rc = file_from_local_url($medium->{url}) @@ -1686,17 +1687,20 @@ sub _update_medium_first_pass { $medium->{must_build_synthesis} = !_synthesis_or_not($medium, 's'); } - { - my @unresolved_after = grep { ! defined $urpm->{provides}{$_} } keys %{$urpm->{provides} || {}}; - if (@unresolved_before != @unresolved_after) { + compute_need_second_pass($urpm, $medium, \@unresolved_before); + 1; +} + +sub compute_need_second_pass { + my ($urpm, $medium, $unresolved_before) = @_; + + my @unresolved_after = grep { ! defined $urpm->{provides}{$_} } keys %{$urpm->{provides} || {}}; + if (@$unresolved_before != @unresolved_after) { $medium->{need_second_pass} = 1; $urpm->{debug} and $urpm->{debug}(sprintf qq(medium "%s" has unresolved dependencies: %s), $medium->{name}, - join(' ', difference2(\@unresolved_after, \@unresolved_before))); - } + join(' ', difference2(\@unresolved_after, $unresolved_before))); } - - 1; } sub _update_medium_first_pass_failed { -- cgit v1.2.1