On 09/12/12 23:44, Kris Deugau wrote:
I already have this and it's been working well for quite a while:

   dpkg-query --showformat '\${status}\t\${version}\n' -W $pkg

Unfortunately I've just discovered it fails when $pkg is a virtual
package, and I have no way to tell ahead of time if this is the case or
not (nor does the caller care).

Is there a single command that can do this for both virtual and real
packages, a la "rpm -q --whatprovides"?

Some searching turned up references to apt-cache dumpavail, but that
isn't restricted to the currently installed packages.  The --installed
option seems to be ignored for dump and dumpavail.

(Please CC me on replies.)
-kgd


Hi.

May be something like: (example for mail-transport-agent)

$ apt-cache  showpkg mail-transport-agent \
    | sed -ne'/Reverse Provides/,$p' \
    | sed -ne '2,$s/ .*//p' \
    | xargs -d'\n'  sh -euf -c '
dpkg-query --showformat "\${package}\t\${status}\t\${version}\n" -W "$@" 2>/dev/null \
            | grep -v "not-installed"
        ' sh


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/5051a84a.6090...@gmail.com

Reply via email to