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

Re: Bug#622322: popularity-contest: popcon tries to access dpkg internal files and fails with multiarch: same packageso



Hi Bill,

On Tue, 12 Apr 2011, Bill Allombert wrote:
> > I get errors from cron because of popcon:
> > /etc/cron.daily/popularity-contest:
> > popcon: file /var/lib/dpkg/info/liblouis2.list is missing
> > 
> > That file doesn't exist, it's really /var/lib/dpkg/info/liblouis2:i386.list
> > due to the multiarch-enabled dpkg that I'm running.
> > 
> > You should not access those files, the proper interface is dpkg-query -L <pkg>.
> 
> Hello Raphaël,
> 
> This is not possible: forking dpkg for all installed packages would be way to slow and 
> resource intensive. We need a better option.

There's no better alternative. You can use dpkg-query --control-path to
get the path of other non-internal control files there:
$ dpkg-query --control-path liblouis2
/var/lib/dpkg/info/liblouis2:i386.md5sums
/var/lib/dpkg/info/liblouis2:i386.postrm
/var/lib/dpkg/info/liblouis2:i386.shlibs
/var/lib/dpkg/info/liblouis2:i386.postinst

We deliberately skip .list as we don't guarantee that we're always going
to use .list and there's no guaranty that the format of the file won't be
extended to store more information. You should not read those files
directly.

As a short term hack, you can try to infer the .list from the above but
it's definitely not going to work on the long term. If you don't get an
answer, because the package has no extra control files then you're left to
guess.

At some point in the future, you should be able to use libdpkg to write a
dedicated program and avoid the cost of multiple parsing of the status
database (the fork itself is not so costly I think, the parsing is) but
we're not really there yet.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
                      ▶ http://RaphaelHertzog.fr (Français)


Reply to: