summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--urpm/media.pm21
-rwxr-xr-xurpmq23
3 files changed, 46 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 99c4000e..ec9569cb 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@
o use hal to wait-for/mount cdroms:
you can now use more than one cdrom drive
o fix download progression using wget
+ 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)
- gurpmi:
o exit immediately on success in automatic mode
o fix --auto-select option
@@ -23,6 +25,8 @@
o do not copy rpms from cdrom if only one cdrom is used (#28083)
- urpmf:
o fix searching for more than one pattern (#38286)
+- urpmq:
+ o --list: speed it up (2.5x faster, and 6x faster with names.<medium>)
Version 5.6 - 26 February 2008, by Pascal "Pixel" Rigaux
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});
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);