5

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?

Braiam
  • 35,991
  • 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 00:59
  • @casey that works for now, but there isn't something to do an exact match? – Braiam Mar 10 '14 at 01:06
  • @Braiam - you've seen this list of search term patterns before? http://algebraicthunk.net/~dburrows/projects/aptitude/doc/en/ch02s03s05.html#tableSearchTermQuickGuide – slm Mar 10 '14 at 01:10
  • ?narrow(filter, pattern)? – slm Mar 10 '14 at 01:11
  • @slm yeah, no, it uses ?narrow(?name(vim), ?depends(?name(vim))) – Braiam Mar 10 '14 at 01:12

1 Answers1

6

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))'
  • The full list of search terms: http://algebraicthunk.net/~dburrows/projects/aptitude/doc/en/ch02s03s05.html#tableSearchTermQuickGuide – slm Mar 10 '14 at 01:13