Debian: dsc_depend: set parameter "rootdir" in function apt.Cache()

Parameter "rootdir" of function apt.Cache() is an alternative root
directory. Without setting it, it is said to use "/" as root
directory. But actually, if this function is spawned before with
a different root directory, later we call it again without parameter
"rootdir", it will still use the previous setting instead of "/".

So, even in case using "/" as rootdir, we still set parameter
"rootdir" clearly.

Test Plan:
Pass: Call apt.Cache() with an alternate rootdir, then call it again
      with rootdir="/", we can get cache data of the host.

Story: 2008862
Task: 46342

Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com>
Change-Id: If5740a78960d469d8a590c7cbccf41279536637e
This commit is contained in:
Zhang Xiao 2022-09-20 09:15:28 +08:00
parent 9bfca3bcf6
commit 593b9a62c7

View File

@ -47,7 +47,7 @@ def get_aptcache(rootdir):
`apt update` for specified Debian repositories.
'''
if USE_HOST_RESOURCE:
apt_cache = apt.Cache()
apt_cache = apt.Cache(rootdir='/')
return apt_cache
try:
if os.path.exists(rootdir):