flatpak-dir.c (flatpak-1.15.2.tar.xz) | : | flatpak-dir.c (flatpak-1.15.3.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 2793 | skipping to change at line 2793 | |||
if (self->extra_data != NULL) | if (self->extra_data != NULL) | |||
return self->extra_data->storage_type; | return self->extra_data->storage_type; | |||
return FLATPAK_DIR_STORAGE_TYPE_DEFAULT; | return FLATPAK_DIR_STORAGE_TYPE_DEFAULT; | |||
} | } | |||
char * | char * | |||
flatpak_dir_load_override (FlatpakDir *self, | flatpak_dir_load_override (FlatpakDir *self, | |||
const char *app_id, | const char *app_id, | |||
gsize *length, | gsize *length, | |||
GFile **file_out, | ||||
GError **error) | GError **error) | |||
{ | { | |||
g_autoptr(GFile) override_dir = NULL; | g_autoptr(GFile) override_dir = NULL; | |||
g_autoptr(GFile) file = NULL; | g_autoptr(GFile) file = NULL; | |||
char *metadata_contents; | char *metadata_contents; | |||
override_dir = g_file_get_child (self->basedir, "overrides"); | override_dir = g_file_get_child (self->basedir, "overrides"); | |||
if (app_id) | if (app_id) | |||
file = g_file_get_child (override_dir, app_id); | file = g_file_get_child (override_dir, app_id); | |||
skipping to change at line 2814 | skipping to change at line 2815 | |||
file = g_file_get_child (override_dir, "global"); | file = g_file_get_child (override_dir, "global"); | |||
if (!g_file_load_contents (file, NULL, | if (!g_file_load_contents (file, NULL, | |||
&metadata_contents, length, NULL, NULL)) | &metadata_contents, length, NULL, NULL)) | |||
{ | { | |||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, | g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, | |||
_("No overrides found for %s"), app_id); | _("No overrides found for %s"), app_id); | |||
return NULL; | return NULL; | |||
} | } | |||
if (file_out != NULL) | ||||
*file_out = g_object_ref (file); | ||||
return metadata_contents; | return metadata_contents; | |||
} | } | |||
GKeyFile * | GKeyFile * | |||
flatpak_load_override_keyfile (const char *app_id, gboolean user, GError **error ) | flatpak_load_override_keyfile (const char *app_id, gboolean user, GError **error ) | |||
{ | { | |||
g_autofree char *metadata_contents = NULL; | g_autofree char *metadata_contents = NULL; | |||
gsize metadata_size; | gsize metadata_size; | |||
g_autoptr(GFile) file = NULL; | ||||
g_autoptr(GKeyFile) metakey = g_key_file_new (); | g_autoptr(GKeyFile) metakey = g_key_file_new (); | |||
g_autoptr(FlatpakDir) dir = NULL; | g_autoptr(FlatpakDir) dir = NULL; | |||
dir = user ? flatpak_dir_get_user () : flatpak_dir_get_system_default (); | dir = user ? flatpak_dir_get_user () : flatpak_dir_get_system_default (); | |||
metadata_contents = flatpak_dir_load_override (dir, app_id, &metadata_size, er ror); | metadata_contents = flatpak_dir_load_override (dir, app_id, &metadata_size, &f ile, error); | |||
if (metadata_contents == NULL) | if (metadata_contents == NULL) | |||
return NULL; | return NULL; | |||
if (!g_key_file_load_from_data (metakey, | if (!g_key_file_load_from_data (metakey, | |||
metadata_contents, | metadata_contents, | |||
metadata_size, | metadata_size, | |||
0, error)) | 0, error)) | |||
return NULL; | return glnx_prefix_error_null (error, "%s", flatpak_file_get_path_cached (fi le)); | |||
return g_steal_pointer (&metakey); | return g_steal_pointer (&metakey); | |||
} | } | |||
FlatpakContext * | FlatpakContext * | |||
flatpak_load_override_file (const char *app_id, gboolean user, GError **error) | flatpak_load_override_file (const char *app_id, gboolean user, GError **error) | |||
{ | { | |||
g_autoptr(FlatpakContext) overrides = flatpak_context_new (); | g_autoptr(FlatpakContext) overrides = flatpak_context_new (); | |||
g_autoptr(GKeyFile) metakey = NULL; | g_autoptr(GKeyFile) metakey = NULL; | |||
g_autoptr(GError) my_error = NULL; | g_autoptr(GError) my_error = NULL; | |||
skipping to change at line 2972 | skipping to change at line 2977 | |||
if (!flatpak_dir_ensure_repo (self, cancellable, error)) | if (!flatpak_dir_ensure_repo (self, cancellable, error)) | |||
return NULL; | return NULL; | |||
metadata = g_file_get_child (deploy_dir, "metadata"); | metadata = g_file_get_child (deploy_dir, "metadata"); | |||
if (!g_file_load_contents (metadata, cancellable, &metadata_contents, &metadat a_size, NULL, error)) | if (!g_file_load_contents (metadata, cancellable, &metadata_contents, &metadat a_size, NULL, error)) | |||
return NULL; | return NULL; | |||
metakey = g_key_file_new (); | metakey = g_key_file_new (); | |||
if (!g_key_file_load_from_data (metakey, metadata_contents, metadata_size, 0, error)) | if (!g_key_file_load_from_data (metakey, metadata_contents, metadata_size, 0, error)) | |||
return NULL; | return glnx_prefix_error_null (error, "%s", flatpak_file_get_path_cached (me tadata)); | |||
deploy = flatpak_deploy_new (deploy_dir, ref, metakey, self->repo); | deploy = flatpak_deploy_new (deploy_dir, ref, metakey, self->repo); | |||
/* Only load system global overrides for system installed apps */ | /* Only load system global overrides for system installed apps */ | |||
if (!self->user) | if (!self->user) | |||
{ | { | |||
deploy->system_overrides = flatpak_load_override_file (NULL, FALSE, error) ; | deploy->system_overrides = flatpak_load_override_file (NULL, FALSE, error) ; | |||
if (deploy->system_overrides == NULL) | if (deploy->system_overrides == NULL) | |||
return NULL; | return NULL; | |||
} | } | |||
skipping to change at line 3620 | skipping to change at line 3625 | |||
commit_metadata = g_variant_get_child_value (commit_data, 0); | commit_metadata = g_variant_get_child_value (commit_data, 0); | |||
add_commit_metadata_to_deploy_data (&metadata_dict, commit_metadata); | add_commit_metadata_to_deploy_data (&metadata_dict, commit_metadata); | |||
/* Add fields from metadata file to deploy */ | /* Add fields from metadata file to deploy */ | |||
keyfile = g_key_file_new (); | keyfile = g_key_file_new (); | |||
metadata_file = g_file_resolve_relative_path (deploy_dir, "metadata"); | metadata_file = g_file_resolve_relative_path (deploy_dir, "metadata"); | |||
if (!g_file_load_contents (metadata_file, cancellable, | if (!g_file_load_contents (metadata_file, cancellable, | |||
&metadata_contents, &metadata_size, NULL, error )) | &metadata_contents, &metadata_size, NULL, error )) | |||
return NULL; | return NULL; | |||
if (!g_key_file_load_from_data (keyfile, metadata_contents, metadata_size, 0, error)) | if (!g_key_file_load_from_data (keyfile, metadata_contents, metadata_size, 0, error)) | |||
return NULL; | return glnx_prefix_error_null (error, "%s", flatpak_file_get_path_cached (metadata_file)); | |||
add_metadata_to_deploy_data (&metadata_dict, keyfile); | add_metadata_to_deploy_data (&metadata_dict, keyfile); | |||
/* Add fields from appdata to deploy, since appdata-content-rating wasn't | /* Add fields from appdata to deploy, since appdata-content-rating wasn't | |||
* added when upgrading from version 2 as it should have been | * added when upgrading from version 2 as it should have been | |||
*/ | */ | |||
if (old_version >= 1) | if (old_version >= 1) | |||
add_appdata_to_deploy_data (&metadata_dict, deploy_dir, id); | add_appdata_to_deploy_data (&metadata_dict, deploy_dir, id); | |||
} | } | |||
subpaths = flatpak_deploy_data_get_subpaths (deploy_data); | subpaths = flatpak_deploy_data_get_subpaths (deploy_data); | |||
skipping to change at line 16539 | skipping to change at line 16544 | |||
return TRUE; | return TRUE; | |||
} | } | |||
static gboolean | static gboolean | |||
maybe_get_metakey (FlatpakDir *dir, | maybe_get_metakey (FlatpakDir *dir, | |||
FlatpakDir *shadowing_dir, | FlatpakDir *shadowing_dir, | |||
FlatpakDecomposed *ref, | FlatpakDecomposed *ref, | |||
GHashTable *metadata_injection, | GHashTable *metadata_injection, | |||
GKeyFile **out_metakey, | GKeyFile **out_metakey, | |||
gboolean *out_ref_is_shadowed) | gboolean *out_ref_is_shadowed, | |||
char **out_dir_name) | ||||
{ | { | |||
if (shadowing_dir && | if (shadowing_dir && | |||
dir_get_metadata (shadowing_dir, ref, out_metakey)) | dir_get_metadata (shadowing_dir, ref, out_metakey)) | |||
{ | { | |||
*out_ref_is_shadowed = TRUE; | *out_ref_is_shadowed = TRUE; | |||
*out_dir_name = g_strdup_printf (" (%s)", flatpak_dir_get_name_cached (sha dowing_dir)); | ||||
return TRUE; | return TRUE; | |||
} | } | |||
if (metadata_injection != NULL) | if (metadata_injection != NULL) | |||
{ | { | |||
GKeyFile *injected_metakey = g_hash_table_lookup (metadata_injection, flat pak_decomposed_get_ref (ref)); | GKeyFile *injected_metakey = g_hash_table_lookup (metadata_injection, flat pak_decomposed_get_ref (ref)); | |||
if (injected_metakey != NULL) | if (injected_metakey != NULL) | |||
{ | { | |||
*out_ref_is_shadowed = FALSE; | *out_ref_is_shadowed = FALSE; | |||
*out_metakey = g_key_file_ref (injected_metakey); | *out_metakey = g_key_file_ref (injected_metakey); | |||
*out_dir_name = g_strdup (""); | ||||
return TRUE; | return TRUE; | |||
} | } | |||
} | } | |||
if (dir_get_metadata (dir, ref, out_metakey)) | if (dir_get_metadata (dir, ref, out_metakey)) | |||
{ | { | |||
*out_ref_is_shadowed = FALSE; | *out_ref_is_shadowed = FALSE; | |||
*out_dir_name = g_strdup_printf (" (%s)", flatpak_dir_get_name_cached (dir )); | ||||
return TRUE; | return TRUE; | |||
} | } | |||
return FALSE; | return FALSE; | |||
} | } | |||
static void | static void | |||
queue_ref_for_analysis (FlatpakDecomposed *ref, | queue_ref_for_analysis (FlatpakDecomposed *ref, | |||
const char *arch, | const char *arch, | |||
GHashTable *analyzed_refs, | GHashTable *analyzed_refs, | |||
skipping to change at line 16643 | skipping to change at line 16652 | |||
return NULL; | return NULL; | |||
for (int i = 0; i < root_runtime_refs->len; i++) | for (int i = 0; i < root_runtime_refs->len; i++) | |||
{ | { | |||
FlatpakDecomposed *root_runtime_ref = g_ptr_array_index (root_runtime_refs , i); | FlatpakDecomposed *root_runtime_ref = g_ptr_array_index (root_runtime_refs , i); | |||
/* Consider all shadow dir runtimes as roots because we don't really do fu ll analysis for shadowing_dir. | /* Consider all shadow dir runtimes as roots because we don't really do fu ll analysis for shadowing_dir. | |||
* For example a system installed app could end up using the user version of a runtime, which in turn | * For example a system installed app could end up using the user version of a runtime, which in turn | |||
* uses a system gl extension. | * uses a system gl extension. | |||
* | * | |||
* However, for non-shadowed runtime refs, only pinned ones are roots */ | * However, for non-shadowed runtime refs, only pinned ones are roots */ | |||
if (root_ref_dir == shadowing_dir || | if (root_ref_dir == shadowing_dir) | |||
flatpak_dir_ref_is_pinned (root_ref_dir, flatpak_decomposed_get_ref (r | { | |||
oot_runtime_ref))) | queue_ref_for_analysis (root_runtime_ref, arch, analyzed_refs, refs_to | |||
queue_ref_for_analysis (root_runtime_ref, arch, analyzed_refs, refs_to_a | _analyze); | |||
nalyze); | } | |||
else if (flatpak_dir_ref_is_pinned (root_ref_dir, flatpak_decomposed_get_r | ||||
ef (root_runtime_ref))) | ||||
{ | ||||
g_debug ("%s: Treating %s as used since it's pinned", | ||||
G_STRFUNC, flatpak_decomposed_get_ref (root_runtime_ref)); | ||||
queue_ref_for_analysis (root_runtime_ref, arch, analyzed_refs, refs_to | ||||
_analyze); | ||||
} | ||||
} | } | |||
/* Any injected refs are considered used, because this is used by transaction | /* Any injected refs are considered used, because this is used by transaction | |||
* to emulate installing a new ref, and we never want the new ref:s dependenci es | * to emulate installing a new ref, and we never want the new ref:s dependenci es | |||
* seem ununsed. */ | * seem ununsed. */ | |||
if (metadata_injection) | if (metadata_injection) | |||
{ | { | |||
GLNX_HASH_TABLE_FOREACH (metadata_injection, const char *, injected_ref) | GLNX_HASH_TABLE_FOREACH (metadata_injection, const char *, injected_ref) | |||
{ | { | |||
g_autoptr(FlatpakDecomposed) injected = flatpak_decomposed_new_from_re f (injected_ref, NULL); | g_autoptr(FlatpakDecomposed) injected = flatpak_decomposed_new_from_re f (injected_ref, NULL); | |||
if (injected) | if (injected) | |||
queue_ref_for_analysis (injected, arch, analyzed_refs, refs_to_analy | { | |||
ze); | g_debug ("%s: Treating %s as used during unused refs analysis", | |||
G_STRFUNC, flatpak_decomposed_get_ref (injected)); | ||||
queue_ref_for_analysis (injected, arch, analyzed_refs, refs_to_ana | ||||
lyze); | ||||
} | ||||
} | } | |||
} | } | |||
while ((ref_to_analyze = g_queue_pop_head (refs_to_analyze)) != NULL) | while ((ref_to_analyze = g_queue_pop_head (refs_to_analyze)) != NULL) | |||
{ | { | |||
g_autoptr(GKeyFile) metakey = NULL; | g_autoptr(GKeyFile) metakey = NULL; | |||
gboolean ref_is_shadowed; | gboolean ref_is_shadowed; | |||
gboolean is_app; | gboolean is_app; | |||
g_autoptr(GPtrArray) related = NULL; | g_autoptr(GPtrArray) related = NULL; | |||
g_autofree char *sdk = NULL; | g_autofree char *sdk = NULL; | |||
g_autofree char *dir_name = NULL; | ||||
if (!maybe_get_metakey (self, shadowing_dir, ref_to_analyze, metadata_inje ction, | if (!maybe_get_metakey (self, shadowing_dir, ref_to_analyze, metadata_inje ction, | |||
&metakey, &ref_is_shadowed)) | &metakey, &ref_is_shadowed, &dir_name)) | |||
continue; /* Something used something we could not find, that is fine an d happens for instance with sdk dependencies */ | continue; /* Something used something we could not find, that is fine an d happens for instance with sdk dependencies */ | |||
if (!ref_is_shadowed) | if (!ref_is_shadowed) | |||
{ | { | |||
/* Mark the analyzed ref used as it wasn't shadowed */ | /* Mark the analyzed ref used as it wasn't shadowed */ | |||
if (!g_hash_table_contains (used_refs, ref_to_analyze)) | if (!g_hash_table_contains (used_refs, ref_to_analyze)) | |||
g_hash_table_add (used_refs, flatpak_decomposed_ref (ref_to_analyze) ); | g_hash_table_add (used_refs, flatpak_decomposed_ref (ref_to_analyze) ); | |||
/* For excluded refs we mark them as used (above) so that they don't g et listed as | /* For excluded refs we mark them as used (above) so that they don't g et listed as | |||
* unused, but we don't analyze them for any dependencies. Note that r efs_to_exclude only | * unused, but we don't analyze them for any dependencies. Note that r efs_to_exclude only | |||
* affects the base dir, so does not affect shadowed refs */ | * affects the base dir, so does not affect shadowed refs */ | |||
if (refs_to_exclude != NULL && g_hash_table_contains (refs_to_exclude, ref_to_analyze)) | if (refs_to_exclude != NULL && g_hash_table_contains (refs_to_exclude, ref_to_analyze)) | |||
continue; | { | |||
g_debug ("%s: Treating %s as uninstalled during unused refs analys | ||||
is", | ||||
G_STRFUNC, flatpak_decomposed_get_ref (ref_to_analyze)); | ||||
continue; | ||||
} | ||||
} | } | |||
/************************************************ | /************************************************ | |||
* Find all dependencies and queue for analysis * | * Find all dependencies and queue for analysis * | |||
***********************************************/ | ***********************************************/ | |||
is_app = flatpak_decomposed_is_app (ref_to_analyze); | is_app = flatpak_decomposed_is_app (ref_to_analyze); | |||
/* App directly depends on its runtime */ | /* App directly depends on its runtime */ | |||
if (is_app) | if (is_app) | |||
{ | { | |||
g_autofree char *runtime = g_key_file_get_string (metakey, "Applicatio n", "runtime", NULL); | g_autofree char *runtime = g_key_file_get_string (metakey, "Applicatio n", "runtime", NULL); | |||
if (runtime) | if (runtime) | |||
{ | { | |||
g_autoptr(FlatpakDecomposed) runtime_ref = flatpak_decomposed_new_ from_pref (FLATPAK_KINDS_RUNTIME, runtime, NULL); | g_autoptr(FlatpakDecomposed) runtime_ref = flatpak_decomposed_new_ from_pref (FLATPAK_KINDS_RUNTIME, runtime, NULL); | |||
if (runtime_ref && !flatpak_decomposed_equal (runtime_ref, ref_to_ analyze)) | if (runtime_ref && !flatpak_decomposed_equal (runtime_ref, ref_to_ analyze)) | |||
queue_ref_for_analysis (runtime_ref, arch, analyzed_refs, refs_t | { | |||
o_analyze); | g_debug ("%s: Considering runtime %s used by app %s%s", | |||
G_STRFUNC, flatpak_decomposed_get_ref (runtime_ref), | ||||
flatpak_decomposed_get_ref (ref_to_analyze), dir_name | ||||
); | ||||
queue_ref_for_analysis (runtime_ref, arch, analyzed_refs, refs | ||||
_to_analyze); | ||||
} | ||||
} | } | |||
} | } | |||
/* Both apps and runtims directly depends on its sdk, to avoid suddenly un | /* Both apps and runtimes directly depends on its sdk, to avoid suddenly | |||
installing something you use to develop the app */ | * uninstalling something you use to develop the app */ | |||
sdk = g_key_file_get_string (metakey, is_app ? "Application" : "Runtime", "sdk", NULL); | sdk = g_key_file_get_string (metakey, is_app ? "Application" : "Runtime", "sdk", NULL); | |||
if (sdk) | if (sdk) | |||
{ | { | |||
g_autoptr(FlatpakDecomposed) sdk_ref = flatpak_decomposed_new_from_pre f (FLATPAK_KINDS_RUNTIME, sdk, NULL); | g_autoptr(FlatpakDecomposed) sdk_ref = flatpak_decomposed_new_from_pre f (FLATPAK_KINDS_RUNTIME, sdk, NULL); | |||
if (sdk_ref && !flatpak_decomposed_equal (sdk_ref, ref_to_analyze)) | if (sdk_ref && !flatpak_decomposed_equal (sdk_ref, ref_to_analyze)) | |||
queue_ref_for_analysis (sdk_ref, arch, analyzed_refs, refs_to_analyz | { | |||
e); | g_debug ("%s: Considering sdk %s used by %s%s", | |||
G_STRFUNC, flatpak_decomposed_get_ref (sdk_ref), | ||||
flatpak_decomposed_get_ref (ref_to_analyze), dir_name); | ||||
queue_ref_for_analysis (sdk_ref, arch, analyzed_refs, refs_to_anal | ||||
yze); | ||||
} | ||||
} | } | |||
/* Extensions with extra data, that are not specially marked NoRuntime nee ds the runtime at install. | /* Extensions with extra data, that are not specially marked NoRuntime nee ds the runtime at install. | |||
* Lets keep it around to not re-download it next update */ | * Lets keep it around to not re-download it next update */ | |||
if (!is_app && | if (!is_app && | |||
g_key_file_has_group (metakey, "Extra Data") && | g_key_file_has_group (metakey, "Extra Data") && | |||
!g_key_file_get_boolean (metakey, "Extra Data", "NoRuntime", NULL)) | !g_key_file_get_boolean (metakey, "Extra Data", "NoRuntime", NULL)) | |||
{ | { | |||
g_autofree char *extension_runtime_ref = g_key_file_get_string (metake y, "ExtensionOf", "runtime", NULL); | g_autofree char *extension_runtime_ref = g_key_file_get_string (metake y, "ExtensionOf", "runtime", NULL); | |||
if (extension_runtime_ref != NULL) | if (extension_runtime_ref != NULL) | |||
{ | { | |||
g_autoptr(FlatpakDecomposed) d = flatpak_decomposed_new_from_ref ( extension_runtime_ref, NULL); | g_autoptr(FlatpakDecomposed) d = flatpak_decomposed_new_from_ref ( extension_runtime_ref, NULL); | |||
if (d) | if (d) | |||
queue_ref_for_analysis (d, arch, analyzed_refs, refs_to_analyze) | { | |||
; | g_debug ("%s: Considering runtime %s used by extra-data %s%s", | |||
G_STRFUNC, flatpak_decomposed_get_ref (d), | ||||
flatpak_decomposed_get_ref (ref_to_analyze), dir_name | ||||
); | ||||
queue_ref_for_analysis (d, arch, analyzed_refs, refs_to_analyz | ||||
e); | ||||
} | ||||
} | } | |||
} | } | |||
/* We pass NULL for remote-name here, because we want to consider related refs from all remotes */ | /* We pass NULL for remote-name here, because we want to consider related refs from all remotes */ | |||
related = flatpak_dir_find_local_related_for_metadata (self, ref_to_analyz e, | related = flatpak_dir_find_local_related_for_metadata (self, ref_to_analyz e, | |||
NULL, metakey, NULL , NULL); | NULL, metakey, NULL , NULL); | |||
for (int i = 0; related != NULL && i < related->len; i++) | for (int i = 0; related != NULL && i < related->len; i++) | |||
{ | { | |||
FlatpakRelated *rel = g_ptr_array_index (related, i); | FlatpakRelated *rel = g_ptr_array_index (related, i); | |||
if (!rel->auto_prune) | if (!rel->auto_prune) | |||
{ | { | |||
g_debug ("%s: Considering related ref %s used by %s%s", | ||||
G_STRFUNC, flatpak_decomposed_get_ref (rel->ref), | ||||
flatpak_decomposed_get_ref (ref_to_analyze), dir_name); | ||||
queue_ref_for_analysis (rel->ref, arch, analyzed_refs, refs_to_ana lyze); | queue_ref_for_analysis (rel->ref, arch, analyzed_refs, refs_to_ana lyze); | |||
} | } | |||
} | } | |||
} | } | |||
return g_steal_pointer (&used_refs); | return g_steal_pointer (&used_refs); | |||
} | } | |||
/* See the documentation for | /* See the documentation for | |||
* flatpak_installation_list_unused_refs_with_options(). | * flatpak_installation_list_unused_refs_with_options(). | |||
skipping to change at line 16778 | skipping to change at line 16822 | |||
{ | { | |||
const char *ref_to_exclude = refs_to_exclude[i]; | const char *ref_to_exclude = refs_to_exclude[i]; | |||
g_autoptr(FlatpakDecomposed) d = flatpak_decomposed_new_from_ref (ref_ to_exclude, NULL); | g_autoptr(FlatpakDecomposed) d = flatpak_decomposed_new_from_ref (ref_ to_exclude, NULL); | |||
if (d) | if (d) | |||
g_hash_table_add (excluded_refs_ht, flatpak_decomposed_ref (d)); | g_hash_table_add (excluded_refs_ht, flatpak_decomposed_ref (d)); | |||
} | } | |||
} | } | |||
used_refs = g_hash_table_new_full ((GHashFunc)flatpak_decomposed_hash, (GEqual Func)flatpak_decomposed_equal, (GDestroyNotify)flatpak_decomposed_unref, NULL); | used_refs = g_hash_table_new_full ((GHashFunc)flatpak_decomposed_hash, (GEqual Func)flatpak_decomposed_equal, (GDestroyNotify)flatpak_decomposed_unref, NULL); | |||
g_info ("Checking installation ‘%s’ %s", | ||||
flatpak_dir_get_name_cached (self), | ||||
filter_by_eol ? "for EOL unused refs" : "for unused refs"); | ||||
if (!find_used_refs (self, NULL, arch, metadata_injection, excluded_refs_ht, | if (!find_used_refs (self, NULL, arch, metadata_injection, excluded_refs_ht, | |||
used_refs, cancellable, error)) | used_refs, cancellable, error)) | |||
return NULL; | return NULL; | |||
/* If @self is a system installation, also check the per-user installation | /* If @self is a system installation, also check the per-user installation | |||
* for any apps there using runtimes in the system installation or runtimes | * for any apps there using runtimes in the system installation or runtimes | |||
* there with sdks or extensions in the system installation. Only do so if | * there with sdks or extensions in the system installation. Only do so if | |||
* the per-user installation exists; it wouldn't make sense to create it here | * the per-user installation exists; it wouldn't make sense to create it here | |||
* if not. | * if not. | |||
*/ | */ | |||
if (!flatpak_dir_is_user (self)) | if (!flatpak_dir_is_user (self)) | |||
{ | { | |||
g_autoptr(FlatpakDir) user_dir = flatpak_dir_get_user (); | g_autoptr(FlatpakDir) user_dir = flatpak_dir_get_user (); | |||
g_autoptr(GError) local_error = NULL; | g_autoptr(GError) local_error = NULL; | |||
g_info ("Checking installation ‘%s’ by checking for dependent refs in ‘%s’ | ||||
", | ||||
flatpak_dir_get_name_cached (self), flatpak_dir_get_name_cached (u | ||||
ser_dir)); | ||||
if (!find_used_refs (self, user_dir, arch, metadata_injection, excluded_re fs_ht, | if (!find_used_refs (self, user_dir, arch, metadata_injection, excluded_re fs_ht, | |||
used_refs, cancellable, &local_error)) | used_refs, cancellable, &local_error)) | |||
{ | { | |||
/* We may get permission denied if the process is sandboxed with | /* We may get permission denied if the process is sandboxed with | |||
* systemd's ProtectHome= | * systemd's ProtectHome= | |||
*/ | */ | |||
if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) & & | if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND) & & | |||
!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_PERMISSION_D ENIED)) | !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_PERMISSION_D ENIED)) | |||
{ | { | |||
g_propagate_error (error, g_steal_pointer (&local_error)); | g_propagate_error (error, g_steal_pointer (&local_error)); | |||
skipping to change at line 16845 | skipping to change at line 16894 | |||
/* deploy v4 guarantees eol/eolr info */ | /* deploy v4 guarantees eol/eolr info */ | |||
deploy_data = flatpak_dir_get_deploy_data (self, ref, 4, | deploy_data = flatpak_dir_get_deploy_data (self, ref, 4, | |||
cancellable, NULL); | cancellable, NULL); | |||
is_eol = deploy_data != NULL && | is_eol = deploy_data != NULL && | |||
(flatpak_deploy_data_get_eol (deploy_data) != NULL || | (flatpak_deploy_data_get_eol (deploy_data) != NULL || | |||
flatpak_deploy_data_get_eol_rebase (deploy_data)); | flatpak_deploy_data_get_eol_rebase (deploy_data)); | |||
} | } | |||
if (!is_eol) | if (!is_eol) | |||
continue; | { | |||
g_debug ("%s: Ref %s (%s) not end-of-life, so excluding from EOL u | ||||
nused refs", | ||||
G_STRFUNC, flatpak_decomposed_get_ref (ref), | ||||
flatpak_dir_get_name_cached (self)); | ||||
continue; | ||||
} | ||||
} | } | |||
g_info ("%s: Ref %s (%s) is %s", | ||||
G_STRFUNC, flatpak_decomposed_get_ref (ref), | ||||
flatpak_dir_get_name_cached (self), | ||||
filter_by_eol ? "EOL and unused" : "unused"); | ||||
g_ptr_array_add (refs, flatpak_decomposed_dup_ref (ref)); | g_ptr_array_add (refs, flatpak_decomposed_dup_ref (ref)); | |||
} | } | |||
g_ptr_array_add (refs, NULL); | g_ptr_array_add (refs, NULL); | |||
return (char **)g_ptr_array_free (g_steal_pointer (&refs), FALSE); | return (char **)g_ptr_array_free (g_steal_pointer (&refs), FALSE); | |||
} | } | |||
End of changes. 25 change blocks. | ||||
23 lines changed or deleted | 87 lines changed or added |