summaryrefslogtreecommitdiffstats
path: root/urpm/media.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-03-03 17:22:05 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-03-03 17:22:05 +0000
commit6ab6e4c33dbe826782ae71640af778f32793f610 (patch)
tree07a03a1db789424b901a26e005cbde43cd914a2a /urpm/media.pm
parentbd9dbe0f3987d63484582a939d7a4feb1000f829 (diff)
downloadurpmi-6ab6e4c33dbe826782ae71640af778f32793f610.tar
urpmi-6ab6e4c33dbe826782ae71640af778f32793f610.tar.gz
urpmi-6ab6e4c33dbe826782ae71640af778f32793f610.tar.bz2
urpmi-6ab6e4c33dbe826782ae71640af778f32793f610.tar.xz
urpmi-6ab6e4c33dbe826782ae71640af778f32793f610.zip
- urpmq:
o --list: speed it up (2.5x faster, and 6x faster with names.<medium>) - all tools: o restore generation of /var/lib/urpmi/names.<medium>, but it is now done in urpmq/urpmi/urpmf (and so only if used as root)
Diffstat (limited to 'urpm/media.pm')
-rw-r--r--urpm/media.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/urpm/media.pm b/urpm/media.pm
index 9533b4f7..7bee8551 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -617,6 +617,8 @@ sub parse_media {
$urpm->{searchmedia} = 1;
$urpm->{log}(N("Search start: %s end: %s", $_->{start}, $_->{end}));
}
+
+ $< == 0 and _generate_medium_names($urpm, $_);
}
}
@@ -1038,6 +1040,22 @@ sub reconfig_urpmi {
$reconfigured;
}
+#- names.<media_name> is used by external progs (namely for bash-completion)
+sub _generate_medium_names {
+ my ($urpm, $medium) = @_;
+
+ -e statedir_names($urpm, $medium) and return;
+
+ my $fh = urpm::sys::open_safe($urpm, ">", statedir_names($urpm, $medium)) or return;
+
+ foreach ($medium->{start} .. $medium->{end}) {
+ my $pkg = $urpm->{depslist}[$_] or
+ $urpm->{error}(N("Error generating names file: dependency %d not found", $_)), return;
+
+ print $fh $urpm->{depslist}[$_]->name . "\n";
+ }
+}
+
sub _guess_synthesis_suffix {
my ($url) = @_;
$url =~ m!\bmedia/(\w+)/*\Z! && $1;
@@ -1510,6 +1528,9 @@ sub _update_medium_ {
}
$medium->{modified} = 0;
+ # generated on first _parse_media()
+ unlink statedir_names($urpm, $medium);
+
_get_pubkey_and_descriptions($urpm, $medium, $options{nopubkey});
$medium->{'key-ids'} ||= _read_cachedir_pubkey($urpm, $medium, $options{wait_lock});