Package: python-apt Version: 0.9.1 Severity: normal Dear Maintainer,
I tried to use python-apt to get all available package versions. I used the 'rootdir' parameter for apt.Cache to have a seperate root dir and seperated config files. In my /etc/apt/apt.conf , I have the following line: APT::Default-Release "sid"; In my root-dir, I create an empty 'rootdir/etc/apt/apt.conf' and when I try to init the apt.Cache, I get the following error: Traceback (most recent call last): File "./python-apt-repro-test", line 31, in <module> cache = apt.Cache(rootdir=root_dir, memonly=False) File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 105, in __init__ self.open(progress) File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 150, in open self._cache = apt_pkg.Cache(progress) SystemError: E:The value 'sid' is invalid for APT::Default-Release as such a release is not available in the sources Attached is a test program which results in this error (but you have add the "APT::Default-Release" line to your /etc/apt/apt.conf). Cheers, Tom -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.10-3-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages python-apt depends on: ii libapt-inst1.5 0.9.12.1 ii libapt-pkg4.12 0.9.12.1 ii libc6 2.17-93 ii libgcc1 1:4.8.2-1 ii libstdc++6 4.8.2-1 ii python 2.7.5-5 ii python-apt-common 0.9.1 Versions of packages python-apt recommends: ii iso-codes 3.47-1 ii lsb-release 4.1+Debian12 ii xz-utils 5.1.1alpha+20120614-2 Versions of packages python-apt suggests: pn python-apt-dbg <none> ii python-apt-doc 0.9.1 ii python-gtk2 2.24.0-3+b1 ii python-vte 1:0.28.2-5 -- no debconf information
#!/usr/bin/python # Author: Thomas Bechtold <thomasbecht...@jpberlin.de> import apt import apt_pkg import os import tempfile apt_pkg.init() SOURCES_LIST = """ deb [arch=amd64,i386] http://ftp.debian.org/debian/ sid main """ try: #create a tempdir for the sources.list root_dir = tempfile.mkdtemp(prefix='python-apt-repos-test_') print "rootdir is: '%s'" % (root_dir) #create sources.list os.makedirs(os.path.abspath(root_dir + "/etc/apt")) with open(os.path.abspath(root_dir + "/etc/apt/sources.list"), "w") as s: s.write(SOURCES_LIST) #create empty apt.conf and apt.conf.d os.makedirs(os.path.abspath(root_dir + "/etc/apt/apt.conf.d")) with open(os.path.abspath(root_dir + "/etc/apt/apt.conf"), "w") as s: s.write("") #Here, the file /etc/apt/apt.conf is used to get "APT::Default-Release" # but expected is that rootdir + etc/apt/apt.conf is used cache = apt.Cache(rootdir=root_dir, memonly=False) finally: pass #import shutil #shutil.rmtree(root_dir)