Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Fast portage search script

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
Genone
Retired Dev
Retired Dev
User avatar
Posts: 9656
Joined: Fri Mar 14, 2003 6:02 pm
Location: beyond the rim

Fast portage search script

  • Quote

Post by Genone » Sat Jul 12, 2003 12:25 am

Ok, that might be interesting for other people as well, so I'll post it: Because it takes ages to do emerge -s or especially emerge -S on my server (that serves the tree to the rest of my boxes) I've written a small script to create a search index and use that for searching. And because I was bored I integrated it into emerge 8). The script can be found at http://gentoo.devel-net.org/download/fastsearch, the patch (against portage-2.0.48-r1) at http://gentoo.devel-net.org/download/emerge.patch (both can also be found in this thread in the german forum, but I don't recommend copy+paste from there because of tab/space conversions)

A few hints for installation:
  • the script can be used standalone without the patch
  • don't try the patch if you don't know how to patch
  • the patch can't be used without the script
  • the patch needs fastsearch in /usr/lib/portage/bin/
  • the patch enables the following functionality in emerge:
    • if you set "fastsearch" in FEATURES the search file will be recreated on every emerge sync, mostly useful for cronjobs
    • you can now use "emerge --fastsearch -s" and "emerge --fastsearch -S" to use the script instead of emerge's normal search method (long options work too)
  • the default behavior of emerge is NOT changed
  • the output format is completely different from normal emerge search output
  • it might find fewer packages because only the latest ebuild of a package is indexed
The script is very fast as it uses grep on a single text file, it does not even take a second on my server to get a result for a descripitionsearch :), but beware that this is a private script that needs testing.

If I get some positive feedback I'll improve it and put it in bugzilla.
Top
neuron
Advocate
Advocate
User avatar
Posts: 2371
Joined: Tue May 28, 2002 7:43 pm

  • Quote

Post by neuron » Sat Jul 12, 2003 1:15 am

great, gonna check this out first thing tomorrow :) (need some sleep first ;) )
Top
Pythonhead
Developer
Developer
User avatar
Posts: 1801
Joined: Mon Dec 16, 2002 6:30 pm
Location: Redondo Beach, Republic of Calif.
Contact:
Contact Pythonhead
Website

  • Quote

Post by Pythonhead » Sat Jul 12, 2003 1:49 am

Very cool.

A couple minor quirks. The -u option in the standalone version only finds things in PORTDIR_OVERLAY unless I cd to PORTDIR. Also, the help shows an -a option, but I think its actually -s?
Top
Genone
Retired Dev
Retired Dev
User avatar
Posts: 9656
Joined: Fri Mar 14, 2003 6:02 pm
Location: beyond the rim

  • Quote

Post by Genone » Sat Jul 12, 2003 1:05 pm

Ok, seems that I forgot to rename the -s to -a (--all seems more logical to me). The problem with $PORTDIR is, that I don't have a default value for it if you don't set it in make.conf, I've fixed this now (same for $PORTDIR_OVERLAY). The new script is online under the same name as the old one.

Thanks for testing.
Top
sessionID
Apprentice
Apprentice
User avatar
Posts: 266
Joined: Mon Nov 11, 2002 2:15 am
Location: hungary

Re: Fast portage search script

  • Quote

Post by sessionID » Sat Jul 12, 2003 2:34 pm

Genone wrote:... The script is very fast ...
WOW That's speed :D
Really nice, thanks!
((( WeFunk )))
Top
Genone
Retired Dev
Retired Dev
User avatar
Posts: 9656
Joined: Fri Mar 14, 2003 6:02 pm
Location: beyond the rim

  • Quote

Post by Genone » Sat Jul 19, 2003 10:35 pm

Okay, I'm taking the discussion here:
Pythonhead wrote: I have been using both fastsearch and esearch extensively while coding ebuilds and they both work great and fill a slightly different need. Variety is good.

One feature I'd like to see for developers is a switch to allow just PORTDIR_OVERLAY get searched. I guess this would take two separate databases; I haven't looked at the code for either. I only emerge sync once a week or so but I'm constantly doing work in PORTDIR_OVERLAY. Not a big deal, but it would be nice if it wouldn't take a lot of effort to add it.

It would also be very sweet to have a switch to show what etcat -v shows. Of course this would get out of date very quickly as you emerge packages, so could be misleading to rely on. Maybe not so good an idea, unless you emerge sync every day.

Another feature would be to show the time you last updated the database and the last time you did emerge sync every time it displays the search results.
I've added a new --info option to fastsearch (shows dates and db size), it is exclusive to update or search modes, but an alias should get you the behavior you wanted. Version information is not possible with fastsearch as it knows nothing about versions.
For the overlay separation: it would be simple to integrate it into the update/search procedure, but my option parsing is too stupid at the moment to recognize more than one option before the pattern. I might implement it at a later time.
Top
Petyr
Guru
Guru
User avatar
Posts: 471
Joined: Wed Jan 08, 2003 9:00 am
Location: San Diego, CA, USA

  • Quote

Post by Petyr » Sun Jul 20, 2003 1:40 am

Please get this incorperated into the distributed version of portage ^^
I have to do emerge -s a LOT because I'm stupid and can't remember stuff for more than like ohh.... 30 seconds at best ^_~
Anyhow, can you submit this one to bugtraq please

Petyr
Top
Genone
Retired Dev
Retired Dev
User avatar
Posts: 9656
Joined: Fri Mar 14, 2003 6:02 pm
Location: beyond the rim

  • Quote

Post by Genone » Sun Jul 20, 2003 2:38 am

Already done, bug 24756. But as carpaski has about 400 open bugs I'm not very optimistic that it will be added soon.
Top
Post Reply

8 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy