repo: Add add-remotes-config-dir option
This option allows a repo to explicitly opt out of adding new remotes in a remotes configuration directory. This currently defaults to true for system repos and false for non-system repos to maintain legacy behavior that non-system repos don't add remotes in a configuration directory. That would be problematic for flatpak, which specifies a remotes config dir but adds remotes in ways that are incompatible with it. So, what this really does is allow system repos to control whether they want to add remotes in the config dir or not. That's important if your flatpak repo is the system repo like at Endless. Closes: #1134 Closes: #1155 Approved by: cgwalters
This commit is contained in:
1 parent
ccbbf77c71
commit
adac42b6ef
5 files changed
+63
-6
No files matched your search
@@ -154,6 +154,7 @@ struct OstreeRepo {
|
||||
gboolean generate_sizes;
|
||||
guint64 tmp_expiry_seconds;
|
||||
gchar *collection_id;
|
||||
gboolean add_remotes_config_dir; /* Add new remotes in remotes.d dir */
|
||||
|
||||
OstreeRepo *parent_repo;
|
||||
};
|
||||
|
||||
@@ -1010,11 +1010,12 @@ impl_repo_remote_add (OstreeRepo *self,
|
||||
|
||||
remote = ostree_remote_new (name);
|
||||
|
||||
/* Only add repos in remotes.d for system repos since that was the
|
||||
* legacy behavior and non-system repos would not expect it.
|
||||
/* Only add repos in remotes.d if the repo option
|
||||
* add-remotes-config-dir is true. This is the default for system
|
||||
* repos.
|
||||
*/
|
||||
g_autoptr(GFile) etc_ostree_remotes_d = get_remotes_d_dir (self, sysroot);
|
||||
if (etc_ostree_remotes_d && ostree_repo_is_system (self))
|
||||
if (etc_ostree_remotes_d && self->add_remotes_config_dir)
|
||||
{
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
|
||||
@@ -2231,6 +2232,17 @@ reload_core_config (OstreeRepo *self,
|
||||
}
|
||||
}
|
||||
|
||||
/* By default, only add remotes in a remotes config directory for
|
||||
* system repos. This is to preserve legacy behavior for non-system
|
||||
* repos that specify a remotes config dir (flatpak).
|
||||
*/
|
||||
{ gboolean is_system = ostree_repo_is_system (self);
|
||||
|
||||
if (!ot_keyfile_get_boolean_with_default (self->config, "core", "add-remotes-config-dir",
|
||||
is_system, &self->add_remotes_config_dir, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user