[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: get software list of one software repository

Hash: SHA1

On Sun, Sep 06, 2015 at 07:35:49PM +0800, mudongliang wrote:
> On 09/04/2015 11:47 PM, Cindy-Sue Causey wrote:
> > On 9/3/15, David Wright <deblis@lionunicorn.co.uk> wrote:
> >> If you mean "what packages does someone have access to", then you need
> >> to look at the contents of their /var/lib/apt/lists/ which is
> >> maintained by apt-get update. You might also want to look at apt-cache.
> As you advised , I checked most of the options of apt-cache , but I
> can't find any option to answer me.
> >
> >
> > As an example of David's suggestion, mine based on my repository
> > *_CHOICE_* is located at:
> >
> > /var/lib/apt/lists/ftp.us.debian.org_debian_dists_sid_main_binary-amd64_Packages
> >
> > The word "Packages" was my hint that that should be what would be found inside.
> >
> This file may be my answer!
> cat
> /var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_main_binary-amd64_Packages
> | grep "Package" | awk -F ": " '{print $2}'
> I can use this shell command to get software list of google chrome
> software repository.
> I think apt-cache can add this request as an option, or it exists , but
> I don't know how to use.
> Thank you!

If I understand you correctly, what you are looking for is "dpkg -l" which
lists all packages matching a pattern and gives you info about their state. 

For example, when I type

 dpkg -l '*xml*'

I get

  | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
  |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
  ||/ Name                                   Version                  Architecture             Description
  un  libkxml2-java                          <none>                                            (no description available)
  un  liblouisxml-dev                        <none>                                            (no description available)
  un  librexml-ruby1.8                       <none>                                            (no description available)
  ii  librpc-xml-perl                        0.76-3                   all                      Perl implementation of the XML-RPC protocol
  ii  libxml-commons-external-java           1.4.01-2                 all                      XML Commons external code - DOM, SAX, and JAXP, etc
  ii  libxml-commons-resolver1.1-java        1.2-7                    all                      XML entity and URI resolver library
  un  libxml-commons-resolver1.1-java-doc    <none>                                            (no description available)
  ii  libxml-dom-perl                        1.44-1                   all                      Perl module for building DOM Level 1 compliant doc structures

(many more). 

The two characters at the start of the line say which status the
package is in (first letter whether it's scheduled for installation
and so on, the second letter whether it's actually installed).

Does this do what you need?

Apt-cache has a different kind of output, but as far as I know
you can filter there for installed packages only, if you wish.

- -- tomás
Version: GnuPG v1.4.12 (GNU/Linux)


Reply to: