[pacman-dev] [PATCH v2 2/6] pacsearch: indexing by 'name version' instead of 'name'
Pierre Neidhardt
ambrevar at gmail.com
Wed Feb 5 10:15:08 EST 2014
On 14-02-05 09:15:28, Andrew Gregory wrote:
> On 02/04/14 at 12:16am, Pierre Neidhardt wrote:
> > Signed-off-by: Pierre Neidhardt <ambrevar at gmail.com>
> > ---
> > contrib/pacsearch.in | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
>
> What is the gain here? The pacman output already includes the local
> version in the sync results if it's different from the sync version.
Not sure I understood your comment correctly. In the old pacsearch pkgname
and pkgver were stored in the same cell. When I changed that later on, I
inadvertently introduced a regression... This fixes it.
> > diff --git a/contrib/pacsearch.in b/contrib/pacsearch.in
> > index 71e0107..d3d461f 100644
> > --- a/contrib/pacsearch.in
> > +++ b/contrib/pacsearch.in
> > @@ -124,7 +124,7 @@ foreach $_ (@syncpkgs) {
> > # add a last field that indicates original order
> > push (@pkgfields, $cnt++);
> > # add each sync pkg by name/ver to a hash table for quick lookup
> > - $allpkgs{$pkgfields[1]} = [ @pkgfields ];
> > + $allpkgs{$pkgfields[1] . $pkgfields[2]} = [ @pkgfields ];
> > }
> >
> > my $queryout = `pacman -Qs '@ARGV'`;
> > @@ -141,14 +141,14 @@ foreach $_ (@querypkgs) {
> > # skip any non-matching line
> > next if not defined $pkgfields[1];
> > # check if the package was listed in the sync out
> > - if (not exists $allpkgs{$pkgfields[1]}) {
> > + if (not exists $allpkgs{$pkgfields[1] . $pkgfields[2]}) {
> > # since 'group' is optional, we should fill it in if necessary
> > $pkgfields[3] = "" if not defined $pkgfields[3];
> > $pkgfields[4] = "[$LC_INSTALLED]";
> > # add a last field that indicates original order (after sync)
> > push (@pkgfields, $cnt++);
> > # add our local-only package to the hash
> > - $allpkgs{$pkgfields[1]} = [ @pkgfields ];
> > + $allpkgs{$pkgfields[1] . $pkgfields[2]} = [ @pkgfields ];
> > }
> > }
> >
> > --
> > 1.8.5.3
>
--
Pierre Neidhardt
Q: Why did the astrophysicist order three hamburgers?
A: Because he was hungry.
More information about the pacman-dev
mailing list