mirror of
https://github.com/flatpak/flatpak.git
synced 2026-06-26 09:17:00 -04:00
tests: Fix FL_CACHE_DIR when system helper is compiled out
The tests assumed that a system installation always uses the XDG cache location unless running as root. However, Flatpak only uses that cache location when the system helper is available at both compile and run time. [1] Builds configured with -Dsystem_helper=disabled instead use the repo-local cache directory [2], causing the tests to look for cached summaries in the wrong location and fail. [1]:96ad6825f3/common/flatpak-dir.c (L4853-L4862)[2]:96ad6825f3/common/flatpak-dir.c (L4942-L4943)
This commit is contained in:
@@ -136,13 +136,16 @@ if [ x${USE_SYSTEMDIR-} == xyes ] ; then
|
||||
export FL_DIR=${SYSTEMDIR}
|
||||
export U=
|
||||
export INVERT_U=--user
|
||||
if [ x${UID} == x0 ] ; then
|
||||
# If running as root (which happens on some build machines), the
|
||||
# system-helper will not be used, and hence the fallback cache dir will
|
||||
# be used in _flatpak_dir_ensure_repo().
|
||||
export FL_CACHE_DIR=$FL_DIR/repo/tmp/cache
|
||||
else
|
||||
if [ x${HAVE_SYSTEM_HELPER-} == x1 ] && [ x${UID} != x0 ] ; then
|
||||
# If system helper is compiled during build and will actually be
|
||||
# used at runtime eg. UID != 0, Flatpak stores summary caches
|
||||
# in the user's XDG cache directory
|
||||
export FL_CACHE_DIR=${XDG_CACHE_HOME}/flatpak/system-cache
|
||||
else
|
||||
# If the system helper is unavailable at build time, or it
|
||||
# cannot be used eg. UID == 0 Flatpak uses the repo-local cache
|
||||
# directory.
|
||||
export FL_CACHE_DIR=$FL_DIR/repo/tmp/cache
|
||||
fi
|
||||
else
|
||||
export FL_DIR=${USERDIR}
|
||||
|
||||
@@ -31,6 +31,7 @@ tests_environment = {
|
||||
'FLATPAK_BWRAP' : env_flatpak_bwrap,
|
||||
'FLATPAK_DBUSPROXY' : env_flatpak_dbusproxy,
|
||||
'HAVE_SECCOMP' : libseccomp_dep.found() ? '1' : '0',
|
||||
'HAVE_SYSTEM_HELPER' : build_system_helper ? '1' : '0',
|
||||
}
|
||||
|
||||
tests_environment_prepend = {
|
||||
|
||||
Reference in New Issue
Block a user