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

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



Control: tag -1 wontfix

On Fri, Sep 05, 2014 at 09:56:26AM +0200, Raphaël Hertzog wrote:
> Package: python-apt
> Version: 0.9.3.9
> Severity: normal
> 
> I have had symptoms very similar to http://bugs.debian.org/728274 but in
> a different context.
> 
> I want to use apt_pkg directly and want to call apt_pkg.init() after
> having set APT_CONFIG to point to my custom configuration. Unfortunately
> my code also "import apt" (because it needs apt.progress.base.AcquireProgress)
> and that import unhelpfully triggers apt_pkg.init().
> 
> Even though I'm calling that a second time, the configuration is not
> cleared and while the entries I have defined are overriden, the global
> entries (such as APT::Target-Release) are there to interfere with
> my logic.
> 
> Thus I believe that a call to apt_pkg.init_config() should really clear
> the apt_pkg.config object first. That's what I did in my code:

That would break other code unfortunately, especially code using different
root directories, as init_config() looks at Dir::Etc::main and stuff to
find the configuration files to look. 

If we cleared in init_config(), you could not specify a different root
directory or other settings for another root directory you are working
with.

We could whitelist some stuff we don't want to clear, but that would be a bit
inconsistent and we'd probably get the list wrong anyway.

> 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). 

Both cannot work together. And because the latter was existing behaviour,
it had to be reverted.

-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

Be friendly, do not top-post, and follow RFC 1855 "Netiquette".
    - If you don't I might ignore you.


Reply to: