diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-11-21 12:53:40 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-11-21 12:53:40 +0000 |
commit | 1df0d930db2c69f55819d96f88a4d08943351802 (patch) | |
tree | f418a5d42c3f0959076196569d88f9b71be87920 /urpm.pm | |
parent | ca1469673bdf227a09bf4b0592ed4d914632cedd (diff) | |
download | urpmi-1df0d930db2c69f55819d96f88a4d08943351802.tar urpmi-1df0d930db2c69f55819d96f88a4d08943351802.tar.gz urpmi-1df0d930db2c69f55819d96f88a4d08943351802.tar.bz2 urpmi-1df0d930db2c69f55819d96f88a4d08943351802.tar.xz urpmi-1df0d930db2c69f55819d96f88a4d08943351802.zip |
only do generate_medium_names() on really_modified (ie updated) media
Diffstat (limited to 'urpm.pm')
-rw-r--r-- | urpm.pm | 29 |
1 files changed, 12 insertions, 17 deletions
@@ -1117,25 +1117,21 @@ sub _parse_hdlist_or_synthesis__virtual { } #- names.<media_name> is used by external progs (namely for bash-completion) -sub generate_media_names { - my ($urpm) = @_; +sub generate_medium_names { + my ($urpm, $medium) = @_; - #- make sure names files are regenerated. - foreach (@{$urpm->{media}}) { - unlink statedir_names($urpm, $_); - if (is_valid_medium($_)) { - if (my $fh = $urpm->open_safe(">", statedir_names($urpm, $_))) { - foreach ($_->{start} .. $_->{end}) { - if (defined $urpm->{depslist}[$_]) { - print $fh $urpm->{depslist}[$_]->name . "\n"; - } else { - $urpm->{error}(N("Error generating names file: dependency %d not found", $_)); - } - } + unlink statedir_names($urpm, $medium); + + if (my $fh = $urpm->open_safe(">", statedir_names($urpm, $medium))) { + foreach ($medium->{start} .. $medium->{end}) { + if (defined $urpm->{depslist}[$_]) { + print $fh $urpm->{depslist}[$_]->name . "\n"; } else { - $urpm->{error}(N("Error generating names file: Can't write to file (%s)", $!)); + $urpm->{error}(N("Error generating names file: dependency %d not found", $_)); } } + } else { + $urpm->{error}(N("Error generating names file: Can't write to file (%s)", $!)); } } @@ -1951,6 +1947,7 @@ sub update_media { if ($medium->{really_modified}) { _get_pubkey_and_descriptions($urpm, $medium, $options{nopubkey}); _read_cachedir_pubkey($urpm, $medium); + generate_medium_names($urpm, $medium); } } @@ -1968,8 +1965,6 @@ sub update_media { write_MD5SUM($urpm); } - generate_media_names($urpm); - $options{nolock} or $urpm->unlock_urpmi_db; $options{nopubkey} or $urpm->unlock_rpm_db; } |