Bug#629624: python-apt: acquire.run() should fail when the lists/partial directory is missing
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.
Cheers,
-- System Information:
Debian Release: wheezy/sid
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (150, 'experimental')
Architecture: i386 (x86_64)
Kernel: Linux 2.6.38-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python-apt depends on:
ii apt [libapt-pkg4.10] 0.8.14.1 Advanced front-end for dpkg
ii apt-utils [libapt-inst1.2] 0.8.14.1 APT utility programs
ii libc6 2.13-5 Embedded GNU C Library: Shared lib
ii libgcc1 1:4.6.0-11 GCC support library
ii libstdc++6 4.6.0-11 The GNU Standard C++ Library v3
ii python 2.6.6-14 interactive high-level object-orie
ii python-apt-common 0.8.0 Python interface to libapt-pkg (lo
ii python2.6 2.6.6-10 An interactive high-level object-o
ii python2.7 2.7.2~rc1-2 An interactive high-level object-o
Versions of packages python-apt recommends:
ii iso-codes 3.26-1 ISO language, territory, currency,
ii lsb-release 3.2-27 Linux Standard Base version report
ii python2.6 2.6.6-10 An interactive high-level object-o
Versions of packages python-apt suggests:
pn python-apt-dbg <none> (no description available)
ii python-apt-doc 0.8.0 Python interface to libapt-pkg (AP
ii python-gtk2 2.24.0-2 Python bindings for the GTK+ widge
ii python-vte 1:0.28.0-2 Python bindings for the VTE widget
-- no debconf information
Reply to: