Re: dpkg/apt voodoo to ask "what version of <pkg> is installed, if any?"
On Thu, Sep 13, 2012 at 3:43 AM, Andrei POPESCU
<andreimpopescu@gmail.com> wrote:
> On Mi, 12 sep 12, 17:43:26, Tom H wrote:
>> On Wed, Sep 12, 2012 at 4:54 PM, Andrei POPESCU
>> <andreimpopescu@gmail.com> wrote:
>>> On Mi, 12 sep 12, 15:44:59, Kris Deugau wrote:
>>>>
>>>> Is there a single command that can do this for both virtual and real
>>>> packages, a la "rpm -q --whatprovides"?
>>>
>>> I have no idea what that command does, can you provide an example?
>>
>> Similar to "dpkg-query --search ..." and "apt-file search ..."
>
> I'm guessing that if it were that similar the OP wouldn't be (still)
> looking. It would help if the OP would state more precisely what
> information he needs and what not.
"rpm -q --whatprovides /sbin/ifconfig" is the same as "dpkg-query
--search ifconfig".
Looking at the archive, the OP's problem seems to be that he's
querying many/all packages and virtual packages return "$unknown". On
an Ubuntu 12.04 box:
[root:~]# apt-cache show awk
N: Can't select versions from package 'awk' as it is purely virtual
N: No packages found
[root:~]# dpkg-query --showformat '\${status}\t\${version}\n' -W awk
$unknown ok not-installed $
[root:~]# dpkg-query --showformat '\${status}\t\${version}\n' -W gawk
$install ok installed $1:3.1.8+dfsg-0.1ubuntu1
[root:~]# dpkg-query --showformat '\${status}\t\${version}\n' -W mawk
$install ok installed $1.3.3-17
[root:~]#
The OP could filter out virtual packages with "dpkg
--get-selections"/"aptitude search '?virtual'"/"aptitude search
'?installed'".
[root:~]# dpkg --get-selections | grep awk
gawk install
mawk install
[root:~]# aptitude search '?virtual' | grep awk
v awk -
v awk:i386 -
[root:~]# aptitude search '?installed' | grep awk
i A gawk - GNU awk, a pattern scanning and processing
i mawk - a pattern scanning and text processing lan
[root:~]#
Reply to: