4

I'm experimenting a bit with aptitude search terms and finally discovered how to do search on dependencies, which is:

aptitude search '?depends("searchterm")'

The only problem that I've found is... that the "searchterm" uses expansions. If I use aptitude search '?depends("vim")' it will look for any packages that depends on a package that contains the word vim in the start, middle or end. Is there a way that I can match the exact package called vim and no other expansion?

  • 1
    In the case of vim, aptitude search '?depends("^vim$")' returns a smaller list than just searching for vim, but I haven't confirmed its doing exactly what you are asking. – casey Mar 10 '14 at 0:59
  • @casey that works for now, but there isn't something to do an exact match? – Braiam Mar 10 '14 at 1:06
  • @Braiam - you've seen this list of search term patterns before? algebraicthunk.net/~dburrows/projects/aptitude/doc/en/… – slm Mar 10 '14 at 1:10
  • ?narrow(filter, pattern)? – slm Mar 10 '14 at 1:11
  • @slm yeah, no, it uses ?narrow(?name(vim), ?depends(?name(vim))) – Braiam Mar 10 '14 at 1:12
5

The argument of ?depends, like any other directive, is a search pattern. The pattern "vim" is a regular expression that the package name must contain. To search for an exact package name, you need to anchor the regex: "^vim$".

aptitude search '?depends("^vim$")'
aptitude search '?depends(^vim$)'
aptitude search '~D^vim$'

You can also use the ?exact-name directive, but for some reason, at least with aptitude 0.6.6, it's slower.

aptitude search '?depends(?exact-name(vim))'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.