When installing to the system dir, don't consider --user dependencies

It makes no sense to allow you to install an application systemwide
if it only works for your user. However, its generally fine if to
install a per-user app that relies on a system-installed runtime.

In particular, this fixes installing system-wide extra-data apps where
we need the runtime to be system-installed to run the unpack script.
tingping/wmclass
Alexander Larsson 2016-10-26 20:39:03 +02:00
parent 6062987162
commit 47906593b8
1 changed files with 22 additions and 5 deletions

View File

@ -51,12 +51,29 @@ struct FlatpakTransaction {
};
/* Check if the ref is in the dir, or in the system dir, in case its a
* user-dir. We want to avoid depending on user-installed things when
* installing to the system dir.
*/
static gboolean
ref_is_installed (const char *ref)
ref_is_installed (FlatpakDir *dir, const char *ref)
{
g_autoptr(FlatpakDeploy) deploy = NULL;
deploy = flatpak_find_deploy_for_ref (ref, NULL, NULL);
return deploy != NULL;
g_autoptr(GFile) deploy_dir = NULL;
deploy_dir = flatpak_dir_get_if_deployed (dir, ref, NULL, NULL);
if (deploy_dir != NULL)
return TRUE;
if (flatpak_dir_is_user (dir))
{
g_autoptr(FlatpakDir) system_dir = flatpak_dir_get_system ();
deploy_dir = flatpak_dir_get_if_deployed (dir, ref, NULL, NULL);
if (deploy_dir != NULL)
return TRUE;
}
return FALSE;
}
static gboolean
@ -331,7 +348,7 @@ add_deps (FlatpakTransaction *self,
if (!flatpak_transaction_contains_ref (self, full_runtime_ref))
{
if (!ref_is_installed (full_runtime_ref))
if (!ref_is_installed (self->dir, full_runtime_ref))
{
g_auto(GStrv) remotes = NULL;