Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   dpkg/apt voodoo to ask "what version of is installed, if any?" (http://www.linux-archive.org/debian-user/703305-dpkg-apt-voodoo-ask-what-version-pkg-installed-if-any.html)

Andrei POPESCU 09-12-2012 08:54 PM

dpkg/apt voodoo to ask "what version of is installed, if any?"
 
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?

Kind regards,
Andrei
--
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic

Neal Murphy 09-12-2012 09:16 PM

dpkg/apt voodoo to ask "what version of is installed, if any?"
 
On Wednesday, September 12, 2012 04:54:27 PM Andrei POPESCU 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?

Try 'dpkg-query -s name' and 'dpkg-query -S name'.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 201209121716.17249.neal.p.murphy@alum.wpi.edu">htt p://lists.debian.org/201209121716.17249.neal.p.murphy@alum.wpi.edu

Tom H 09-12-2012 09:43 PM

dpkg/apt voodoo to ask "what version of is installed, if any?"
 
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 ..."


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/CAOdo=Szd+jQNZF6XB5JPwcnUqc4AR-KTqSAnRDuNGNkr8QRRpA@mail.gmail.com

Andrei POPESCU 09-13-2012 07:43 AM

dpkg/apt voodoo to ask "what version of is installed, if any?"
 
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.

Kind regards,
Andrei
--
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic

Dmitriy Matrosov 09-13-2012 09:32 AM

dpkg/apt voodoo to ask "what version of is installed, if any?"
 
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} ${version}
' -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'
' sh -euf -c '
dpkg-query --showformat
"${package} ${status} ${version}
" -W "$@" 2>/dev/null

| grep -v "not-installed"
' sh


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 5051A84A.6090701@gmail.com">http://lists.debian.org/5051A84A.6090701@gmail.com

Tom H 09-13-2012 10:05 AM

dpkg/apt voodoo to ask "what version of 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} ${version}
' -W awk
$unknown ok not-installed $
[root:~]# dpkg-query --showformat '${status} ${version}
' -W gawk
$install ok installed $1:3.1.8+dfsg-0.1ubuntu1
[root:~]# dpkg-query --showformat '${status} ${version}
' -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:~]#


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/CAOdo=SwSGBCTb0Stw=OhoCuniONVCtLyD0K6zVr8dbg=okpnt g@mail.gmail.com

Andrei POPESCU 09-13-2012 04:59 PM

dpkg/apt voodoo to ask "what version of is installed, if any?"
 
On Jo, 13 sep 12, 06:05:51, Tom H wrote:
>
> [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:~]#

Why grep (and root)?

$ aptitude search '?installed(awk)'
i A gawk - GNU awk, a pattern scanning and processing
i A mawk - a pattern scanning and text processing lan

For the OP: have a look at aptitude's search patterns, you might be able
to find something useful there ;)

Kind regards,
Andrei
--
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic

Tom H 09-13-2012 05:45 PM

dpkg/apt voodoo to ask "what version of is installed, if any?"
 
On Thu, Sep 13, 2012 at 12:59 PM, Andrei POPESCU
<andreimpopescu@gmail.com> wrote:
> On Jo, 13 sep 12, 06:05:51, Tom H wrote:
>>
>> [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:~]#
>
> Why grep (and root)?
>
> $ aptitude search '?installed(awk)'
> i A gawk - GNU awk, a pattern scanning and processing
> i A mawk - a pattern scanning and text processing lan

root because I happened to be logged in as root; sorry.

grep because I don't think that the search would work for other
virtual packages that don't share 3 of 4 letters with the real
packages that provide it. Do they?


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: http://lists.debian.org/CAOdo=SwEjeAbCa1QWBsnUQD=51WyxkrEV7gQDwA_hKjNUUVXW g@mail.gmail.com

Andrei POPESCU 09-14-2012 06:08 AM

dpkg/apt voodoo to ask "what version of is installed, if any?"
 
On Jo, 13 sep 12, 13:45:58, Tom H wrote:
>
> grep because I don't think that the search would work for other
> virtual packages that don't share 3 of 4 letters with the real
> packages that provide it. Do they?

Not sure what you mean, but (using short syntax for variety):

$ aptitude search ~vawk
v awk -
$ aptitude search ~vmail-transport-agent
v mail-transport-agent -

Kind regards,
Andrei
--
Offtopic discussions among Debian users and developers:
http://lists.alioth.debian.org/mailman/listinfo/d-community-offtopic


All times are GMT. The time now is 09:34 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.