On 9/6/2015 12:55 PM, Seeker wrote:
I sounds like aptitude *is* the tool that you want.

I don't use aptitude so I am taking it on faith that the given example is a working
example and you just need adjust it to fit your needs.

If you want a list of software in 'debian testing main' the repository is the origin,
testing is the archive '~A', main is the section.

aptitude search term information is available here.

https://wiki.debian.org/Aptitude#Advanced_search_patterns
https://www.debian.org/doc/manuals/aptitude/ch02s04s05.en.html

the second link shows this...

--------------------------|
?section(/|section|/)|, |~s/|section|/|

Matches packages whose section matches the regular expression /|section|/.
----------------------------

Adding that to the above example..

"aptitude search '(!~Atesting ~Aunstable ~smain ?origin(Debian))'"

So this particular example should then show all the available packages in the Debian repository that are in the main section of the unstable archive, results
from testing would be filtered out.

I had trouble getting it to work in my earlier attempts, but I think it was probably
because I was missing this part of the equation..

> Start by running "grep Origin: /var/lib/apt/lists/*Release" to see where
> your packages from from.

As opposed to guessing the correct origin base on the way Synaptic shows it to you.

Later, Seeker

Did some testing, with an odd result.

I have unstable and experimental in my sources.list with sections 'main contrib non-free' for both archives and deb-multimedia.org is there as an additional repository.

After finding that I need to use 'Unofficial Multimedia Packages' as the origin for
deb-multimedia.org I did:

aptitude search '(!~Aexperimental ~Aunstable ?origin(Unofficial Multimedia Packages))' | less

:that gave me the expected result. So then I did:

aptitude search '(!~Aexperimental ~Aunstable ~smain ?origin(Debian))' | less

:and got no results back, then tried these:

aptitude search '(!~Aexperimental ~Aunstable ~snon-free ?origin(Debian))' | less aptitude search '(!~Aexperimental ~Aunstable ~scontrib ?origin(Debian))' | less

:both look like expected results, and I see alien arena in the contrib list so did:

aptitude search '(!~Aexperimental ~Aunstable ?origin(Debian))' | less

:to confirm that it looked like the full list with all sections and alien arena was there so
it does look like it is the full list.

I this a bug or is there some other explanation?

To mudongliang

If I do:

aptitude search '(!~Aexperimental ~Aunstable !~scontrib !~snon-free ?origin(Debian))' | less

:to filter out the results from contrib and non-free, it does look like it leaves me with a list
that only includes the packages from main.

If I find myself stuck in a situation where I can't use Synaptic aptitude could start looking attractive for the search, but normally between apt-cache, 'apt list /something/'', and
'apt list --all-versions /something' /my needs are normally covered.

Sometimes I use aptsh, have not tried to search from within it. But if the 'apt list' and apt-cache stuff works within aptsh, then you have search, tab completion, and the use of wild cards when you specify the list of packages to install. I know at least some of the apt-cache options
work from within aptsh.

Later, Seeker

Reply via email to