summaryrefslogtreecommitdiffstats
path: root/urpmq
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 /urpmq
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 'urpmq')
-rwxr-xr-xurpmq23
1 files changed, 21 insertions, 2 deletions
diff --git a/urpmq b/urpmq
index 0656fcba..d4998bd6 100755
--- a/urpmq
+++ b/urpmq
@@ -126,11 +126,14 @@ my $urpm = urpm->new_parse_cmdline or exit(1);
$urpm->{info} = sub { print STDERR "$_[0]\n" };
$urpm->{log} = sub { print STDERR "$_[0]\n" } if $options{verbose} > 0;
+my $only_list_name = $options{list} && !($options{version} && $options{release} && $options{arch});
+
#- improve speed if using any list_... options.
$options{nodepslist} = $options{list_aliases}
|| $options{list_nodes}
|| $options{list_media}
|| $options{dump_config}
+ || $only_list_name # urpmq will parse synthesis only if names.* are not already there
|| $options{list_url};
$options{nolock} = 1 if $options{nodepslist};
@@ -204,8 +207,24 @@ if ($options{list_aliases}) {
exit 0;
} elsif ($options{list}) {
!@names && !@src_names or $urpm->{fatal}(1, N("use -l to list files"));
- # --list lists all available packages: select them all
- @{$state->{selected}}{0 .. $#{$urpm->{depslist}}} = ();
+
+ if ($only_list_name) {
+ # special code, much faster
+ my @media = urpm::media::non_ignored_media($urpm, $options{update});
+ my @names_files = grep { -e $_ } map { urpm::media::statedir_names($urpm, $_) } @media;
+
+ if (@media == @names_files) {
+ $urpm->{log}("using " . join(' ', @names_files));
+ print sort map { cat_($_) } @names_files;
+ } else {
+ urpm::media::parse_media($urpm, \%options);
+ print sort map { $_->name . "\n" } @{$urpm->{depslist}};
+ }
+ # we're done now, but we don't exit here so locks are correctly released if needed
+ } else {
+ # use the generic code
+ @{$state->{selected}}{0 .. $#{$urpm->{depslist}}} = ();
+ }
} else {
%requested = $urpm->register_rpms(@files);