Subject: Bug#760549: python-apt: apt_pkg.init_config() should apt_pkg.config.clean()

From: Raphael Hertzog <[email-masked]>
Date: Fri, 5 Sep 2014 11:33:12 +0200

On Fri, 05 Sep 2014, Julian Andres Klode wrote:
> On Fri, Sep 5, 2014 at 10:21 AM, Julian Andres Klode <[email-masked]> wrote:
> > On Fri, Sep 05, 2014 at 09:56:26AM +0200, Raphaël Hertzog wrote:
> >> Furthermore it would be nice if the configuration was loaded in a lazy
> >> way in all the apt.* modules. That would probably solve #728274.
> >
> > It would not, AFAICT. The thing with #728274 is that is a use case that
> > directly conflicts with another use case. One group of users like in the
> > bug report want to specify configuration files in the chroot, and others
> > are setting them outside the chroot (especially APT::Architecture for
> > foreign chroots).
> 
> Sorry, yes it actually would solve it in case you only create a single
> Cache(). Unfortunately, our configuration is a global thing, and thus
> the entries from the different root directory would remain even after
> the cache was closed; for example, when creating a new one.
> 
> It might make sense to provide the ability to switch apt_pkg.config
> between different Configuration instances (setting _config on the C++
> level), but I'm not sure if that would provide a consistent behaviour.
> 
> In short, global state sucks a lot, and there's not much we can do to fix it.

Well, you could at least avoid to initialize it before the user had a
chance to initialize it the way he want...

Hence the suggestion of lazy loading. It would not fix the case where
people want to use multiple configurations, but it would fix my use case
where I want a single configuration that is not polluted by the
system-wide configuration.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Discover the Debian Administrator's Handbook:
→ http://debian-handbook.info/get/