summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-11-14 07:48:57 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-11-14 07:48:57 +0000
commitdc335ec70cca81ade1a78bd5fe8aa23c0795010b (patch)
tree03e2eea89e196e1f69a746a06cbef085cf0afeba /urpm
parenta2639fe5c8dd4d114a1c3ffd55516bb06d437f98 (diff)
downloadurpmi-dc335ec70cca81ade1a78bd5fe8aa23c0795010b.tar
urpmi-dc335ec70cca81ade1a78bd5fe8aa23c0795010b.tar.gz
urpmi-dc335ec70cca81ade1a78bd5fe8aa23c0795010b.tar.bz2
urpmi-dc335ec70cca81ade1a78bd5fe8aa23c0795010b.tar.xz
urpmi-dc335ec70cca81ade1a78bd5fe8aa23c0795010b.zip
- inline _update_media__handle_some_flags()
- create all_media_to_update() and use it
Diffstat (limited to 'urpm')
-rw-r--r--urpm/media.pm31
1 files changed, 16 insertions, 15 deletions
diff --git a/urpm/media.pm b/urpm/media.pm
index 9bf6ef09..812ae7d3 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -652,6 +652,15 @@ sub non_ignored_media {
grep { !$_->{ignore} && (!$b_only_marked_update || $_->{update}) } @{$urpm->{media} || []};
}
+sub all_media_to_update {
+ my ($urpm, $b_only_marked_update) = @_;
+
+ grep { !$_->{ignore}
+ && !$_->{static} && !urpm::is_cdrom_url($_->{url}) && !$_->{iso}
+ && (!$b_only_marked_update || $_->{update})
+ } @{$urpm->{media} || []};
+}
+
sub parse_media {
my ($urpm, $options) = @_;
@@ -1643,20 +1652,6 @@ sub _update_medium {
$rc;
}
-sub _update_media__handle_some_flags {
- my ($urpm, $all) = @_;
-
- foreach my $medium (non_ignored_media($urpm)) {
- if ($medium->{static}) {
- #- don't ever update static media
- $medium->{modified} = 0;
- } elsif ($all) {
- #- if we're rebuilding all media, mark them as modified (except removable ones)
- $medium->{modified} ||= !urpm::is_cdrom_url($medium->{url}) && !$medium->{iso};
- }
- }
-}
-
#- Update the urpmi database w.r.t. the current configuration.
#- Takes care of modifications, and tries some tricks to bypass
#- the recomputation of base files.
@@ -1684,10 +1679,16 @@ sub update_media {
#- synthesis file, else build it from rpm files.
clean($urpm);
- _update_media__handle_some_flags($urpm, $options{all});
+ if ($options{all}) {
+ $_->{modified} ||= 1 foreach all_media_to_update($urpm);
+ }
my %updates_result;
foreach my $medium (grep { $_->{modified} } non_ignored_media($urpm)) {
+
+ #- don't ever update static media
+ $medium->{static} and next;
+
my $rc = _update_medium($urpm, $medium, %options);
$rc or return if !$options{allow_failures};
$updates_result{$rc || 'error'}++;