mirror of
https://github.com/flatpak/flatpak.git
synced 2026-05-24 08:51:27 -04:00
Allow configuring the subset
This adds support to remote-add, remote-modify and the flatpakrepo file parser.
This commit is contained in:
committed by
Alexander Larsson
parent
5496c4e4ef
commit
754e1fb5d4
@@ -48,6 +48,7 @@ static char *opt_comment;
|
||||
static char *opt_description;
|
||||
static char *opt_homepage;
|
||||
static char *opt_icon;
|
||||
static char *opt_subset;
|
||||
static char *opt_default_branch;
|
||||
static char *opt_url;
|
||||
static char *opt_collection_id = NULL;
|
||||
@@ -69,6 +70,7 @@ static GOptionEntry common_options[] = {
|
||||
{ "no-enumerate", 0, 0, G_OPTION_ARG_NONE, &opt_no_enumerate, N_("Mark the remote as don't enumerate"), NULL },
|
||||
{ "no-use-for-deps", 0, 0, G_OPTION_ARG_NONE, &opt_no_deps, N_("Mark the remote as don't use for deps"), NULL },
|
||||
{ "prio", 0, 0, G_OPTION_ARG_INT, &opt_prio, N_("Set priority (default 1, higher is more prioritized)"), N_("PRIORITY") },
|
||||
{ "subset", 0, 0, G_OPTION_ARG_STRING, &opt_subset, N_("The named subset to use for this remote"), N_("SUBSET") },
|
||||
{ "title", 0, 0, G_OPTION_ARG_STRING, &opt_title, N_("A nice name to use for this remote"), N_("TITLE") },
|
||||
{ "comment", 0, 0, G_OPTION_ARG_STRING, &opt_comment, N_("A one-line comment for this remote"), N_("COMMENT") },
|
||||
{ "description", 0, 0, G_OPTION_ARG_STRING, &opt_description, N_("A full-paragraph description for this remote"), N_("DESCRIPTION") },
|
||||
@@ -119,6 +121,12 @@ get_config_from_opts (GKeyFile *config,
|
||||
if (opt_collection_id)
|
||||
g_key_file_set_string (config, group, "collection-id", opt_collection_id);
|
||||
|
||||
if (opt_subset)
|
||||
{
|
||||
g_key_file_set_string (config, group, "xa.subset", opt_subset);
|
||||
g_key_file_set_boolean (config, group, "xa.subset-is-set", TRUE);
|
||||
}
|
||||
|
||||
if (opt_title)
|
||||
{
|
||||
g_key_file_set_string (config, group, "xa.title", opt_title);
|
||||
|
||||
@@ -52,6 +52,7 @@ static char *opt_comment;
|
||||
static char *opt_description;
|
||||
static char *opt_homepage;
|
||||
static char *opt_icon;
|
||||
static char *opt_subset;
|
||||
static char *opt_default_branch;
|
||||
static char *opt_url;
|
||||
static char *opt_collection_id = NULL;
|
||||
@@ -66,6 +67,7 @@ static GOptionEntry modify_options[] = {
|
||||
{ "enumerate", 0, 0, G_OPTION_ARG_NONE, &opt_do_enumerate, N_("Mark the remote as enumerate"), NULL },
|
||||
{ "use-for-deps", 0, 0, G_OPTION_ARG_NONE, &opt_do_deps, N_("Mark the remote as used for dependencies"), NULL },
|
||||
{ "url", 0, 0, G_OPTION_ARG_STRING, &opt_url, N_("Set a new url"), N_("URL") },
|
||||
{ "subset", 0, 0, G_OPTION_ARG_STRING, &opt_subset, N_("Set a new subset to use"), N_("SUBSET") },
|
||||
{ "enable", 0, 0, G_OPTION_ARG_NONE, &opt_enable, N_("Enable the remote"), NULL },
|
||||
{ "update-metadata", 0, 0, G_OPTION_ARG_NONE, &opt_update_metadata, N_("Update extra metadata from the summary file"), NULL },
|
||||
{ NULL }
|
||||
@@ -141,6 +143,13 @@ get_config_from_opts (FlatpakDir *dir, const char *remote_name, gboolean *change
|
||||
*changed = TRUE;
|
||||
}
|
||||
|
||||
if (opt_subset)
|
||||
{
|
||||
g_key_file_set_string (config, group, "xa.subset", opt_subset);
|
||||
g_key_file_set_boolean (config, group, "xa.subset-is-set", TRUE);
|
||||
*changed = TRUE;
|
||||
}
|
||||
|
||||
if (opt_title)
|
||||
{
|
||||
g_key_file_set_string (config, group, "xa.title", opt_title);
|
||||
|
||||
@@ -72,6 +72,7 @@ GType flatpak_deploy_get_type (void);
|
||||
#define FLATPAK_REPO_GROUP "Flatpak Repo"
|
||||
#define FLATPAK_REPO_VERSION_KEY "Version"
|
||||
#define FLATPAK_REPO_URL_KEY "Url"
|
||||
#define FLATPAK_REPO_SUBSET_KEY "Subset"
|
||||
#define FLATPAK_REPO_TITLE_KEY "Title"
|
||||
#define FLATPAK_REPO_DEFAULT_BRANCH_KEY "DefaultBranch"
|
||||
#define FLATPAK_REPO_GPGKEY_KEY "GPGKey"
|
||||
|
||||
@@ -2192,6 +2192,7 @@ flatpak_parse_repofile (const char *remote_name,
|
||||
g_autofree char *icon = NULL;
|
||||
g_autofree char *homepage = NULL;
|
||||
g_autofree char *filter = NULL;
|
||||
g_autofree char *subset = NULL;
|
||||
g_autofree char *authenticator_name = NULL;
|
||||
gboolean nodeps;
|
||||
const char *source_group;
|
||||
@@ -2232,6 +2233,11 @@ flatpak_parse_repofile (const char *remote_name,
|
||||
|
||||
g_key_file_set_string (config, group, "url", uri);
|
||||
|
||||
subset = g_key_file_get_locale_string (keyfile, source_group,
|
||||
FLATPAK_REPO_SUBSET_KEY, NULL, NULL);
|
||||
if (subset != NULL)
|
||||
g_key_file_set_string (config, group, "xa.subset", subset);
|
||||
|
||||
title = g_key_file_get_locale_string (keyfile, source_group,
|
||||
FLATPAK_REPO_TITLE_KEY, NULL, NULL);
|
||||
if (title != NULL)
|
||||
|
||||
Reference in New Issue
Block a user