Comment 6 for bug 885895

Revision history for this message
Guilherme Salgado (salgado) wrote : Re: linaro-image-tools: automated unit tests are failing (5 out of 599) on 64 bit Oneiric

One thing I didn't realize until now is that this failing test that I'm debugging should not be affected by multi-arch because it uses a separate cache configured for armel, which AIUI, should not have multi-arch. After realizing this and digging a bit more, I've came up with the test-case below, where apt_pkg.Cache.is_multi_arch is set to True even though we set the architecture to armel. This seems to be because the rootdir passed to apt.cache.Cache is not passed down to apt_pkg.Cache, so the latter is reading the configs from the system.

import os, tempfile
from apt.cache import Cache

tempdir = tempfile.mkdtemp(prefix="hwpack-apt-cache-")
os.makedirs(os.path.join(tempdir, "etc", "apt"))
apt_conf = os.path.join(tempdir, "etc", "apt", "apt.conf")
with open(apt_conf, 'w') as f:
    f.write(
        'Apt {\nArchitecture armel;\n'
        'Install-Recommends "true";\n}\n')

c = Cache(rootdir=tempdir, memonly=True)
print "Cache._have_multi_arch: ", c._have_multi_arch
print "Cache._cache.is_multi_arch: ", c._cache.is_multi_arch