mirror of
https://github.com/flatpak/flatpak.git
synced 2026-04-08 09:01:02 -04:00
build-update-repo: Support setting comment/description/homepage/icon
This just sets the option in the "flatpak" group, similar to how the title works. Nothing uses this yet. Closes: #2814 Approved by: alexlarsson
This commit is contained in:
committed by
Atomic Bot
parent
69e869c9d2
commit
889e3b862a
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -85,6 +85,42 @@
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--comment=COMMENT</option></term>
|
||||
|
||||
<listitem><para>
|
||||
A single-line comment for the remote, e.g. for display in a UI.
|
||||
The comment is stored in the repository summary.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--description=DESCRIPTION</option></term>
|
||||
|
||||
<listitem><para>
|
||||
A full-paragraph description for the remote, e.g. for display in a UI.
|
||||
The description is stored in the repository summary.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--homepage=URL</option></term>
|
||||
|
||||
<listitem><para>
|
||||
URL for a website for the remote, e.g. for display in a UI.
|
||||
The url is stored in the repository summary.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--icon=URL</option></term>
|
||||
|
||||
<listitem><para>
|
||||
URL for an icon for the remote, e.g. for display in a UI.
|
||||
The url is stored in the repository summary.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--default-branch=BRANCH</option></term>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user