[gnome-software] Make flatpakref installation work
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Make flatpakref installation work
- Date: Tue, 6 Dec 2016 11:28:38 +0000 (UTC)
commit 715d24a97b1dd193e62905c98cc3b8bc24bd2e0f
Author: Kalev Lember <klember redhat com>
Date: Tue Dec 6 10:01:43 2016 +0100
Make flatpakref installation work
This commit adds a flatpak::file-type key and uses that to figure out
the correct installation method for different local file types:
.flatpak, .flatpakrepo and .flatpakref.
src/plugins/gs-flatpak.c | 17 ++++++++++++++---
src/plugins/gs-flatpak.h | 2 ++
2 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 5b74320..74eca85 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -2157,8 +2157,16 @@ gs_flatpak_app_install (GsFlatpak *self,
}
}
- /* use the source for local apps */
- if (gs_app_get_local_file (app) != NULL) {
+ if (g_strcmp0 (gs_app_get_flatpak_file_type (app), "flatpak") == 0) {
+ /* no local_file set */
+ if (gs_app_get_origin (app) == NULL) {
+ g_set_error (error,
+ GS_PLUGIN_ERROR,
+ GS_PLUGIN_ERROR_NOT_SUPPORTED,
+ "no local_file set for %s",
+ gs_app_get_unique_id (app));
+ return FALSE;
+ }
g_debug ("installing bundle %s", gs_app_get_unique_id (app));
xref = flatpak_installation_install_bundle (self->installation,
gs_app_get_local_file (app),
@@ -2166,7 +2174,7 @@ gs_flatpak_app_install (GsFlatpak *self,
app,
cancellable, error);
} else {
- /* no origin */
+ /* no origin set */
if (gs_app_get_origin (app) == NULL) {
g_set_error (error,
GS_PLUGIN_ERROR,
@@ -2253,6 +2261,7 @@ gs_flatpak_file_to_app_bundle (GsFlatpak *self,
/* load metadata */
app = gs_plugin_create_app (self, FLATPAK_REF (xref_bundle));
+ gs_app_set_flatpak_file_type (app, "flatpak");
gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_app_set_state (app, AS_APP_STATE_AVAILABLE_LOCAL);
gs_app_set_size_installed (app, flatpak_bundle_ref_get_installed_size (xref_bundle));
@@ -2441,6 +2450,7 @@ gs_flatpak_file_to_app_repo (GsFlatpak *self,
/* create source */
app = gs_app_new (repo_id);
+ gs_app_set_flatpak_file_type (app, "flatpakrepo");
gs_app_set_kind (app, AS_APP_KIND_SOURCE);
gs_app_add_quirk (app, AS_APP_QUIRK_NOT_LAUNCHABLE);
gs_app_set_name (app, GS_APP_QUALITY_NORMAL, repo_title);
@@ -2535,6 +2545,7 @@ gs_flatpak_file_to_app_ref (GsFlatpak *self,
/* load metadata */
app = gs_plugin_create_app (self, FLATPAK_REF (xref));
+ gs_app_set_flatpak_file_type (app, "flatpakref");
gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_app_set_state (app, AS_APP_STATE_AVAILABLE_LOCAL);
gs_flatpak_set_metadata (self, app, FLATPAK_REF (xref));
diff --git a/src/plugins/gs-flatpak.h b/src/plugins/gs-flatpak.h
index f16fcfa..7a1cc25 100644
--- a/src/plugins/gs-flatpak.h
+++ b/src/plugins/gs-flatpak.h
@@ -37,10 +37,12 @@ G_DECLARE_FINAL_TYPE (GsFlatpak, gs_flatpak, GS, FLATPAK, GObject)
#define gs_app_get_flatpak_arch(app) gs_app_get_metadata_item(app,"flatpak::arch")
#define gs_app_get_flatpak_branch(app) gs_app_get_metadata_item(app,"flatpak::branch")
#define gs_app_get_flatpak_commit(app) gs_app_get_metadata_item(app,"flatpak::commit")
+#define gs_app_get_flatpak_file_type(app) gs_app_get_metadata_item(app,"flatpak::file-type")
#define gs_app_set_flatpak_name(app,val) gs_app_set_metadata(app,"flatpak::name",val)
#define gs_app_set_flatpak_arch(app,val) gs_app_set_metadata(app,"flatpak::arch",val)
#define gs_app_set_flatpak_branch(app,val) gs_app_set_metadata(app,"flatpak::branch",val)
#define gs_app_set_flatpak_commit(app,val) gs_app_set_metadata(app,"flatpak::commit",val)
+#define gs_app_set_flatpak_file_type(app,val) gs_app_set_metadata(app,"flatpak::file-type",val)
GsFlatpak *gs_flatpak_new (GsPlugin *plugin,
FlatpakInstallation *installation);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]