diff --git a/app/flatpak-builtins-build-update-repo.c b/app/flatpak-builtins-build-update-repo.c index e20b179a..f106436d 100644 --- a/app/flatpak-builtins-build-update-repo.c +++ b/app/flatpak-builtins-build-update-repo.c @@ -34,6 +34,10 @@ #include "flatpak-builtins-utils.h" static char *opt_title; +static char *opt_comment; +static char *opt_description; +static char *opt_homepage; +static char *opt_icon; static char *opt_redirect_url; static char *opt_default_branch; static char *opt_collection_id = NULL; @@ -55,6 +59,10 @@ static char **opt_static_delta_ignore_refs; static GOptionEntry options[] = { { "redirect-url", 0, 0, G_OPTION_ARG_STRING, &opt_redirect_url, N_("Redirect this repo to a new URL"), N_("URL") }, { "title", 0, 0, G_OPTION_ARG_STRING, &opt_title, N_("A nice name to use for this repository"), N_("TITLE") }, + { "comment", 0, 0, G_OPTION_ARG_STRING, &opt_comment, N_("A one-line comment for this repository"), N_("COMMENT") }, + { "description", 0, 0, G_OPTION_ARG_STRING, &opt_description, N_("A full-paragraph description for this repository"), N_("DESCRIPTION") }, + { "homepage", 0, 0, G_OPTION_ARG_STRING, &opt_homepage, N_("URL for a website for this repository"), N_("URL") }, + { "icon", 0, 0, G_OPTION_ARG_STRING, &opt_icon, N_("URL for an icon for this repository"), N_("URL") }, { "default-branch", 0, 0, G_OPTION_ARG_STRING, &opt_default_branch, N_("Default branch to use for this repository"), N_("BRANCH") }, { "collection-id", 0, 0, G_OPTION_ARG_STRING, &opt_collection_id, N_("Collection ID"), N_("COLLECTION-ID") }, { "deploy-collection-id", 0, 0, G_OPTION_ARG_NONE, &opt_deploy_collection_id, N_("Permanently deploy collection ID to client remote configurations"), NULL }, @@ -496,6 +504,22 @@ flatpak_builtin_build_update_repo (int argc, char **argv, !flatpak_repo_set_title (repo, opt_title[0] ? opt_title : NULL, error)) return FALSE; + if (opt_comment && + !flatpak_repo_set_comment (repo, opt_comment[0] ? opt_comment : NULL, error)) + return FALSE; + + if (opt_description && + !flatpak_repo_set_description (repo, opt_description[0] ? opt_description : NULL, error)) + return FALSE; + + if (opt_homepage && + !flatpak_repo_set_homepage (repo, opt_homepage[0] ? opt_homepage : NULL, error)) + return FALSE; + + if (opt_icon && + !flatpak_repo_set_icon (repo, opt_icon[0] ? opt_icon : NULL, error)) + return FALSE; + if (opt_redirect_url && !flatpak_repo_set_redirect_url (repo, opt_redirect_url[0] ? opt_redirect_url : NULL, error)) return FALSE; diff --git a/common/flatpak-utils-private.h b/common/flatpak-utils-private.h index 37f5c75c..5960aed8 100644 --- a/common/flatpak-utils-private.h +++ b/common/flatpak-utils-private.h @@ -379,6 +379,18 @@ gboolean flatpak_switch_symlink_and_remove (const char *symlink_path, gboolean flatpak_repo_set_title (OstreeRepo *repo, const char *title, GError **error); +gboolean flatpak_repo_set_comment (OstreeRepo *repo, + const char *comment, + GError **error); +gboolean flatpak_repo_set_description (OstreeRepo *repo, + const char *description, + GError **error); +gboolean flatpak_repo_set_icon (OstreeRepo *repo, + const char *icon, + GError **error); +gboolean flatpak_repo_set_homepage (OstreeRepo *repo, + const char *homepage, + GError **error); gboolean flatpak_repo_set_redirect_url (OstreeRepo *repo, const char *redirect_url, GError **error); diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index 71442ac7..79eb6f73 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -2600,6 +2600,87 @@ flatpak_repo_set_title (OstreeRepo *repo, return TRUE; } +gboolean +flatpak_repo_set_comment (OstreeRepo *repo, + const char *comment, + GError **error) +{ + g_autoptr(GKeyFile) config = NULL; + + config = ostree_repo_copy_config (repo); + + if (comment) + g_key_file_set_string (config, "flatpak", "comment", comment); + else + g_key_file_remove_key (config, "flatpak", "comment", NULL); + + if (!ostree_repo_write_config (repo, config, error)) + return FALSE; + + return TRUE; +} + +gboolean +flatpak_repo_set_description (OstreeRepo *repo, + const char *description, + GError **error) +{ + g_autoptr(GKeyFile) config = NULL; + + config = ostree_repo_copy_config (repo); + + if (description) + g_key_file_set_string (config, "flatpak", "description", description); + else + g_key_file_remove_key (config, "flatpak", "description", NULL); + + if (!ostree_repo_write_config (repo, config, error)) + return FALSE; + + return TRUE; +} + + +gboolean +flatpak_repo_set_icon (OstreeRepo *repo, + const char *icon, + GError **error) +{ + g_autoptr(GKeyFile) config = NULL; + + config = ostree_repo_copy_config (repo); + + if (icon) + g_key_file_set_string (config, "flatpak", "icon", icon); + else + g_key_file_remove_key (config, "flatpak", "icon", NULL); + + if (!ostree_repo_write_config (repo, config, error)) + return FALSE; + + return TRUE; +} + +gboolean +flatpak_repo_set_homepage (OstreeRepo *repo, + const char *homepage, + GError **error) +{ + g_autoptr(GKeyFile) config = NULL; + + config = ostree_repo_copy_config (repo); + + if (homepage) + g_key_file_set_string (config, "flatpak", "homepage", homepage); + else + g_key_file_remove_key (config, "flatpak", "homepage", NULL); + + if (!ostree_repo_write_config (repo, config, error)) + return FALSE; + + return TRUE; +} + gboolean flatpak_repo_set_redirect_url (OstreeRepo *repo, const char *redirect_url, diff --git a/doc/flatpak-build-update-repo.xml b/doc/flatpak-build-update-repo.xml index 9aec253b..743d9b34 100644 --- a/doc/flatpak-build-update-repo.xml +++ b/doc/flatpak-build-update-repo.xml @@ -85,6 +85,42 @@ + + + + + A single-line comment for the remote, e.g. for display in a UI. + The comment is stored in the repository summary. + + + + + + + + A full-paragraph description for the remote, e.g. for display in a UI. + The description is stored in the repository summary. + + + + + + + + URL for a website for the remote, e.g. for display in a UI. + The url is stored in the repository summary. + + + + + + + + URL for an icon for the remote, e.g. for display in a UI. + The url is stored in the repository summary. + + +