Michal and I debugged this over IRC, and tracked it down. He had an /etc/apt/apt.conf with explicitly setting Architecture:, and creating an apt.Cache(rootdir="...") object still takes that global configuration into account.
The attached test script works on a default installation, downloads the armhf saucy main index, and creates /tmp/r/var/lib/apt/lists/ports.ubuntu.com_dists_saucy_main_binary-armhf_Packages.
But Michal has something like this config:
echo 'APT::Architectures:: "amd64";' | sudo tee /etc/apt/apt.conf.d/01explicit_arch
After doing that, running the test script shows the same failure:
Err http://ports.ubuntu.com saucy/main amd64 Packages
Get:4 http://ports.ubuntu.com saucy/main armhf Packages [1219 kB]
[...]
E:Some index files failed to download. They have been ignored, or old ones used instead.
So, it might certainly be that I'm using python-apt wrongly here, but I would certainly expect apt.Cache(rootdir=/path/to/my/sandbox) to not consider anything from /etc/apt/?
Michal and I debugged this over IRC, and tracked it down. He had an /etc/apt/apt.conf with explicitly setting Architecture:, and creating an apt.Cache( rootdir= "...") object still takes that global configuration into account.
The attached test script works on a default installation, downloads the armhf saucy main index, and creates /tmp/r/ var/lib/ apt/lists/ ports.ubuntu. com_dists_ saucy_main_ binary- armhf_Packages.
But Michal has something like this config:
echo 'APT::Architect ures:: "amd64";' | sudo tee /etc/apt/ apt.conf. d/01explicit_ arch
After doing that, running the test script shows the same failure:
Err http:// ports.ubuntu. com saucy/main amd64 Packages ports.ubuntu. com saucy/main armhf Packages [1219 kB]
Get:4 http://
[...]
E:Some index files failed to download. They have been ignored, or old ones used instead.
So, it might certainly be that I'm using python-apt wrongly here, but I would certainly expect apt.Cache( rootdir= /path/to/ my/sandbox) to not consider anything from /etc/apt/?