[gnome-software] Add support for DefaultBranch key in .flatpakrepo files
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add support for DefaultBranch key in .flatpakrepo files
- Date: Thu, 6 Oct 2016 14:30:44 +0000 (UTC)
commit 6dfb9e264239aa874e5cf067f2f6f90b300f034a
Author: Mario Sanchez Prada <mario endlessm com>
Date: Thu Oct 6 13:28:38 2016 +0100
Add support for DefaultBranch key in .flatpakrepo files
Add a new property in GsApp, set it when reading from the .flatpakrepo
files and use it to create the remote using flatpak's public API.
data/tests/example.flatpakrepo | 1 +
src/plugins/gs-flatpak.c | 10 ++++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/data/tests/example.flatpakrepo b/data/tests/example.flatpakrepo
index f8f7f5e..2e2d0fa 100644
--- a/data/tests/example.flatpakrepo
+++ b/data/tests/example.flatpakrepo
@@ -2,6 +2,7 @@
Title=foo-bar
Comment=Longer one line comment
Description=Longer multiline comment that does into detail.
+DefaultBranch=stable
Url=http://foo.bar/apps
Homepage=http://foo.bar
GPGKey=LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tClZlcnNpb246IEdudVBHIHYyCgptUUVOQkZYWGFCQUJDQURTK0w3V2ZrZG5GTTlrNVNRSUhSd2pLYXY2c1dIQ2NDMGRLUjVxTklNQUF4ZmNLaVhPCkFMdlBjWkFNa2NhTnFmWGd1L2EwWU43cDhnTStvWjUxVzBtWnFnbytFTWtvbGMwQXlRQkNUdERqY1BBVmo0Sm8KYm91RjBub3pod1dJRHRHdVhsa3F1em1EdVBHUzEzaEoxdHpRaUI4ajAra000U3hXM0VXQTJOR0N5UU8xUXlFbApaTlNMRmo1RVNabDZZVmtiNlRxZmZqd29iVjM2SDZaN0ZCem8vK3pqMWhXcklqNG5CVXN4d1JXTVpGN0pUaTRzCkJwdTFTN3habTVNTy9MUHdrVERIdGJWSnZyMDVJc0F6Q2hTWHBQeFhvZ3hmdFowd3lvUHBSNFV3SjE5REFHRHoKclRweFZTQ2tIUmdIS3plNWR2NlBqWFFMQXk0dDdueUp3b210QUJFQkFBRzBQa3hwYm5WNElGWmxibVJ2Y2lCRwphWEp0ZDJGeVpTQlRaWEoyYVdObElDaFVaWE4wSUV0bGVTa2dQSE5wWjI0dGRHVnpkRUJtZDNWd1pDNXZjbWMrCmlRRTNCQk1CQ0FBaEJRSlYxMmdRQWhzREJRc0pDQWNDQmhVSUNRb0xBZ1FXQWdNQkFoNEJBaGVBQUFvSkVCS1YKYkJMV1Qxd2hidlFJQUllRWNyVTVOWVRxSnNza0loM1VHU2dhZ2RKbTY3RDNrUlpBblR4cmk1bVpUeitzOXBvagpFZzQvNWRrcTFhTjRVOFlHWlpXWldJdHlZcE1USThnd0lZRnlwTEJuK2JHN0xJOXFxc29kdEdUOVZTMnZWZlBTCk5vMFZPanlTM0QrR2ZyV3YxNWZ1d050b21Xb1IyMz
kwcjR2YmNIeEJxRllZc0RBWk15SlV6Y1JVa2haOWYrdUIKVnN2N1NKNnV4OElhN2ZWN3QvWS9BSEFkTktoUG9XaFRVMlpmb0I3TEdtTjM4K1U3RFlIYzdrcE9BcFB5WmVJZAppanl5SHg2MUtqM2E2eDJ4Tm9vWXVTUjZFUEgyZnpLWC9WdzJRMFA0NG1Pb0QxamNqZmZreStxbjRqS1dwZjRvCjlvRUFJRUIveU52aTlzRHpjdlVsQXBCcUM5MzNUVFhYTGNRPQo9MjA5dQotLS0tLUVORCBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCg==
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index f64fd19..b98b10b 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -831,6 +831,7 @@ gs_flatpak_app_install_source (GsFlatpak *self, GsApp *app,
GError **error)
{
const gchar *gpg_key;
+ const gchar *branch;
g_autoptr(FlatpakRemote) xremote = NULL;
/* only process this source if was created for this plugin */
@@ -872,6 +873,11 @@ gs_flatpak_app_install_source (GsFlatpak *self, GsApp *app,
flatpak_remote_set_gpg_verify (xremote, FALSE);
}
+ /* default branch */
+ branch = gs_app_get_branch (app);
+ if (branch != NULL)
+ flatpak_remote_set_default_branch (xremote, branch);
+
/* install it */
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
if (!flatpak_installation_modify_remote (self->installation,
@@ -2283,6 +2289,7 @@ gs_flatpak_file_to_app_repo (GsFlatpak *self,
g_autofree gchar *filename = NULL;
g_autofree gchar *repo_comment = NULL;
g_autofree gchar *repo_description = NULL;
+ g_autofree gchar *repo_default_branch = NULL;
g_autofree gchar *repo_gpgkey = NULL;
g_autofree gchar *repo_homepage = NULL;
g_autofree gchar *repo_icon = NULL;
@@ -2357,6 +2364,9 @@ gs_flatpak_file_to_app_repo (GsFlatpak *self,
repo_description = g_key_file_get_string (kf, "Flatpak Repo", "Description", NULL);
if (repo_description != NULL)
gs_app_set_description (app, GS_APP_QUALITY_NORMAL, repo_description);
+ repo_default_branch = g_key_file_get_string (kf, "Flatpak Repo", "DefaultBranch", NULL);
+ if (repo_default_branch != NULL)
+ gs_app_set_branch (app, repo_default_branch);
repo_icon = g_key_file_get_string (kf, "Flatpak Repo", "Icon", NULL);
if (repo_icon != NULL) {
g_autoptr(AsIcon) ic = as_icon_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]