Re: dpkg/apt voodoo to ask what version of pkg is installed, if any?

2012-09-14 Thread Andrei POPESCU
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


signature.asc
Description: Digital signature


Re: dpkg/apt voodoo to ask what version of pkg is installed, if any?

2012-09-13 Thread Andrei POPESCU
On Mi, 12 sep 12, 17:43:26, Tom H wrote:
 On Wed, Sep 12, 2012 at 4:54 PM, Andrei POPESCU
 andreimpope...@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


signature.asc
Description: Digital signature


Re: dpkg/apt voodoo to ask what version of pkg is installed, if any?

2012-09-13 Thread Dmitriy Matrosov

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



Re: dpkg/apt voodoo to ask what version of pkg is installed, if any?

2012-09-13 Thread Tom H
On Thu, Sep 13, 2012 at 3:43 AM, Andrei POPESCU
andreimpope...@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
 andreimpope...@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
gawkinstall
mawkinstall
[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-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAOdo=SwSGBCTb0Stw=OhoCuniONVCtLyD0K6zVr8dbg=okp...@mail.gmail.com



Re: dpkg/apt voodoo to ask what version of pkg is installed, if any?

2012-09-13 Thread Andrei POPESCU
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


signature.asc
Description: Digital signature


Re: dpkg/apt voodoo to ask what version of pkg is installed, if any?

2012-09-13 Thread Tom H
On Thu, Sep 13, 2012 at 12:59 PM, Andrei POPESCU
andreimpope...@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-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAOdo=SwEjeAbCa1QWBsnUQD=51wyxkrev7gqdwa_hkjnuuv...@mail.gmail.com



dpkg/apt voodoo to ask what version of pkg is installed, if any?

2012-09-12 Thread Kris Deugau
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


-- 
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/5050e63b.8020...@vianet.ca



Re: dpkg/apt voodoo to ask what version of pkg is installed, if any?

2012-09-12 Thread Andrei POPESCU
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


signature.asc
Description: Digital signature


Re: dpkg/apt voodoo to ask what version of pkg is installed, if any?

2012-09-12 Thread Neal Murphy
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-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/201209121716.17249.neal.p.mur...@alum.wpi.edu



Re: dpkg/apt voodoo to ask what version of pkg is installed, if any?

2012-09-12 Thread Tom H
On Wed, Sep 12, 2012 at 4:54 PM, Andrei POPESCU
andreimpope...@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-requ...@lists.debian.org 
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAOdo=szd+jqnzf6xb5jpwcnuqc4ar-ktqsanrdungnkr8qr...@mail.gmail.com