Re: Obtaining a list of installed files using libapt-pkg
On Thu, Nov 19, 2015 at 09:44:01PM +0100, David Kalnischkies wrote:
> Hi,
>
> On Wed, Nov 18, 2015 at 05:57:14PM +1000, Troy Heron wrote:
> > Is it possible to obtain a list of installed files using the libapt-pkg API?
>
> No, you can't as apt doesn't concern itself with such lowlevel details,
> we have dpkg to worry about such stuff. ;)
>
> See "dpkg-query --listfiles" and "dpkg-query --search" for a commandline
> API. dpkg maintainers are also working on a libdpkg (currently a static
> library only) which might expose this info. There is also libdpkg-perl
> (from the same team) which likely has an API for this.
Oh, python-apt has an API for it:
for package in apt.Cache():
if package.is_installed:
for file in package.installed_files:
print file
--
Julian Andres Klode - Debian Developer, Ubuntu Member
See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
When replying, only quote what is necessary, and write each reply
directly below the part(s) it pertains to (`inline'). Thank you.
Reply to: