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

Bug#629624: python-apt: acquire.run() should fail when the lists/partial directory is missing



On Wed, Jun 08, 2011 at 10:12:39AM +0200, Raphaël Hertzog wrote:
> Package: python-apt
> Version: 0.8.0
> Severity: normal
> 
> Consider the following code:
> import sys
> import apt_pkg
> 
> apt_pkg.init_config()
> apt_pkg.config["Dir::Etc"] = "/home/rhertzog/deb/core/rolling/sat-britney/apt-etc"
> apt_pkg.config["Dir::State"] = "/home/rhertzog/deb/core/rolling/sat-britney/apt-state"
> apt_pkg.config["Dir::Cache"] = "/home/rhertzog/deb/core/rolling/sat-britney/apt-cache"
> apt_pkg.init_system()
> 
> acquire = apt_pkg.Acquire()
> srclist = apt_pkg.SourceList()
> if not srclist.read_main_list():
>     sys.stdout.write("Failed to read sources.list")
> if srclist.get_indexes(acquire, True):
>     sys.stdout.write("Update OK\n")
> else:
>     sys.stdout.write("Update failed\n")
> res = acquire.run()
> if res == apt_pkg.Acquire.RESULT_CONTINUE:
>     sys.stdout.write("Download OK\n")
> else:
>     sys.stdout.write("Download failed\n")
> 
> I have a created a simple sources.list in Dir::Etc (listing an http:// URL) but
> I'm missing a partial directory in Dir::State::lists. The code will execute
> without errors but no files will be downloaded.
> 
> Either it should auto-create the "partial" sub-dir or it should fail
> with a proper error/exception. The current behavior is sub-optimal.

Fixed in revision 609.

Traceback (most recent call last):
  File "a.py", line 11, in <module>
    acquire = apt_pkg.Acquire()
SystemError: E:List directory /home/rhertzog/deb/core/rolling/sat-britney/apt-state/lists/partial is missing. - Acquire (2: No such file or directory)

-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

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



Reply to: