[pacman-dev] Feature request: Show exact matches first
Dave Reisner
d at falconindy.com
Wed Oct 19 15:55:47 EDT 2011
On Wed, Oct 19, 2011 at 09:37:22PM +0200, Markus Jochim wrote:
> Dear developers,
>
> I'd like to request a feature. When I search for some package, let's
> say openconnect:
>
> $ pacman -Ss openconnect (or -Qs)
>
> it takes quite a while until I get any results on my netbook (Atom
> N450 cpu). Maybe this could be sped up by showing exact matches
> right away. I've had this situation quite some times now and it can
> be a real pain in the ass to wait for 10 seconds (this may vary of
> course) when I simply want to know whether I have a particular
> package installed.
>
> Kindly,
>
> Markus
>
Hi,
The overhead here is disk I/O, not CPU. Looking for exact matches first
will not save you any time. Additionally, once your local DB is paged
into RAM, results should come much more quickly.
To humor you, and assuming your DBPath is /var/lib/pacman, you can use
something like the following bash function to get exact matches:
# assumes extglob is enabled
findexact() {
res=(/var/lib/pacman/local/$1-+([!-])-+([0-9]))
[[ -d $res ]]
}
The function returns 0 (found) or 1 (not found).
I make no guarantees that this continues to work in the future as it's
dependent on our DB format.
dave
More information about the pacman-dev
mailing list