Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
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 at 0:59
    
@casey that works for now, but there isn't something to do an exact match? –  Braiam Mar 10 at 1:06
    
@Braiam - you've seen this list of search term patterns before? algebraicthunk.net/~dburrows/projects/aptitude/doc/en/… –  slm Mar 10 at 1:10
    
?narrow(filter, pattern)? –  slm Mar 10 at 1:11
    
@slm yeah, no, it uses ?narrow(?name(vim), ?depends(?name(vim))) –  Braiam Mar 10 at 1:12
add comment

1 Answer 1

up vote 4 down vote accepted

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))'
share|improve this answer
    
The full list of search terms: algebraicthunk.net/~dburrows/projects/aptitude/doc/en/… –  slm Mar 10 at 1:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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