10

In Debian or one of its derivatives, how can I list all packages which I have installed from lenny-backports?

The closest I've come up with is:

aptitude search ~i~Alenny-backports

However, that lists all installed packages for which there exists a version in backports even if the currently installed version is not the one from backports. I'd like to list only the packages for which the currently installed version is from backports (or, not lenny, if that's easier).

Cheers

thomasrutter
  • 2,437
  • 1
  • 25
  • 34

2 Answers2

15

Aptitude has a ?narrow search term for just this:

aptitude search '~S ~i ~Abackports'
aptitude search '?narrow(~i, ~Abackports)'
Tobu
  • 4,367
  • 1
  • 23
  • 31
  • So in other words, `~S` is like an operator which means "the next two conditions have to apply to the *exact same package and version*". – thomasrutter Nov 23 '12 at 03:33
  • @thomas, ~S is like a simple and. It's every other aptitude operator (intersection, etc) that erases the version before computation. – Tobu Nov 23 '12 at 19:03
0

You can use the grep-status command (provided via the 'dctrl-tools' package):

grep-status -sPackage,Version -F Status 'installed' -a -F Version 'bp'

Example of output:

Package: libsvn-perl
Version: 1.6.4dfsg-1~bpo50+1

Package: subversion-tools
Version: 1.6.4dfsg-1~bpo50+1

Package: subversion
Version: 1.6.4dfsg-1~bpo50+1

Package: libapache2-svn
Version: 1.6.4dfsg-1~bpo50+1

Package: libsvn1
Version: 1.6.4dfsg-1~bpo50+1

Package: libdb4.7
Version: 4.7.25-7~bpo50+1

Package: trac
Version: 0.11.6-1~bpo50+1

Package: python-subversion
Version: 1.6.4dfsg-1~bpo50+1

If you need a more compact output (more suitable for further script-based processing), use simply

grep-status -nsPackage -F Status 'installed' -a -F Version 'bp'
Flo
  • 85
  • 4