common: Set ~/.local/share/xdg-app/system-cache as cache dir for system repo

This means we can use a summary cache for system wide stuff which causes
loads to be faster.
tingping/wmclass
Alexander Larsson 2016-04-21 18:54:15 +02:00
parent 351c2d5bd2
commit 21dd53d1ff
1 changed files with 24 additions and 3 deletions

View File

@ -628,9 +628,30 @@ xdg_app_dir_ensure_repo (XdgAppDir *self,
if (self->user)
repo = ostree_repo_new (repodir);
else
repo = g_object_new (OSTREE_TYPE_REPO, "path", repodir,
"remotes-config-dir", XDG_APP_CONFIGDIR "/remotes.d",
NULL);
{
g_autoptr(GFile) base_dir = NULL;
g_autoptr(GFile) cache_dir = NULL;
g_autofree char *cache_path = NULL;
repo = g_object_new (OSTREE_TYPE_REPO, "path", repodir,
"remotes-config-dir", XDG_APP_CONFIGDIR "/remotes.d",
NULL);
base_dir = xdg_app_get_user_base_dir_location ();
cache_dir = g_file_get_child (base_dir, "system-cache");
cache_path = g_file_get_path (cache_dir);
if (g_mkdir_with_parents (cache_path, 0755) != 0)
{
glnx_set_error_from_errno (error);
goto out;
}
if (!ostree_repo_set_cache_dir (repo,
AT_FDCWD, cache_path,
cancellable, error))
goto out;
}
if (!g_file_query_exists (repodir, cancellable))
{