Make p2p build non-optional

Closes: #1800
Approved by: alexlarsson
This commit is contained in:
Alexander Larsson
2018-06-19 18:27:52 +02:00
committed by Atomic Bot
parent 0801f0cb13
commit 491d174879
22 changed files with 2 additions and 247 deletions

View File

@@ -76,9 +76,7 @@ static GOptionEntry common_options[] = {
{ "prio", 0, 0, G_OPTION_ARG_INT, &opt_prio, N_("Set priority (default 1, higher is more prioritized)"), N_("PRIORITY") },
{ "title", 0, 0, G_OPTION_ARG_STRING, &opt_title, N_("A nice name to use for this remote"), N_("TITLE") },
{ "default-branch", 0, 0, G_OPTION_ARG_STRING, &opt_default_branch, N_("Default branch to use for this remote"), N_("BRANCH") },
#ifdef FLATPAK_ENABLE_P2P
{ "collection-id", 0, 0, G_OPTION_ARG_STRING, &opt_collection_id, N_("Collection ID"), N_("COLLECTION-ID") },
#endif /* FLATPAK_ENABLE_P2P */
{ "gpg-import", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_gpg_import, N_("Import GPG key from FILE (- for stdin)"), N_("FILE") },
{ "disable", 0, 0, G_OPTION_ARG_NONE, &opt_disable, N_("Disable the remote"), NULL },
{ "oci", 0, 0, G_OPTION_ARG_NONE, &opt_oci, N_("Add OCI registry"), NULL },
@@ -255,11 +253,9 @@ load_options (const char *filename,
if (str != NULL)
opt_url = str;
#ifdef FLATPAK_ENABLE_P2P
str = g_key_file_get_string (keyfile, FLATPAK_REPO_GROUP, FLATPAK_REPO_COLLECTION_ID_KEY, NULL);
if (str != NULL)
opt_collection_id = str;
#endif /* FLATPAK_ENABLE_P2P */
str = g_key_file_get_locale_string (keyfile, FLATPAK_REPO_GROUP,
FLATPAK_REPO_TITLE_KEY, NULL, NULL);
@@ -338,7 +334,6 @@ flatpak_builtin_add_remote (int argc, char **argv,
if (argc > 3)
return usage_error (context, _("Too many arguments"), error);
#ifdef FLATPAK_ENABLE_P2P
if (opt_collection_id != NULL &&
!ostree_validate_collection_id (opt_collection_id, &local_error))
return flatpak_fail (error, _("%s is not a valid collection ID: %s"), opt_collection_id, local_error->message);
@@ -346,7 +341,6 @@ flatpak_builtin_add_remote (int argc, char **argv,
if (opt_collection_id != NULL &&
(opt_no_gpg_verify || opt_gpg_import == NULL || opt_gpg_import[0] == NULL))
return flatpak_fail (error, _("GPG verification is required if collections are enabled"));
#endif /* FLATPAK_ENABLE_P2P */
remote_name = argv[1];
location = argv[2];

View File

@@ -234,11 +234,7 @@ build_bundle (OstreeRepo *repo, GFile *file,
if (opt_runtime_repo)
g_variant_builder_add (&metadata_builder, "{sv}", "runtime-repo", g_variant_new_string (opt_runtime_repo));
#ifdef FLATPAK_ENABLE_P2P
collection_id = ostree_repo_get_collection_id (repo);
#else /* if !FLATPAK_ENABLE_P2P */
collection_id = NULL;
#endif /* !FLATPAK_ENABLE_P2P */
g_variant_builder_add (&metadata_builder, "{sv}", "collection-id",
g_variant_new_string (collection_id ? collection_id : ""));

View File

@@ -439,16 +439,12 @@ flatpak_builtin_build_commit_from (int argc, char **argv, GCancellable *cancella
if (opt_body)
body = (const char *)opt_body;
#ifdef FLATPAK_ENABLE_P2P
dst_collection_id = ostree_repo_get_collection_id (dst_repo);
#endif /* FLATPAK_ENABLE_P2P */
/* Copy old metadata */
g_variant_builder_init (&metadata_builder, G_VARIANT_TYPE ("a{sv}"));
/* Bindings. xa.ref is deprecated but added anyway for backwards compatibility.
* Add the bindings even if we are not built with P2P support, since other
* flatpak builds might be. */
/* Bindings. xa.ref is deprecated but added anyway for backwards compatibility. */
g_variant_builder_add (&metadata_builder, "{sv}", "ostree.collection-binding",
g_variant_new_string (dst_collection_id ? dst_collection_id : ""));
g_variant_builder_add (&metadata_builder, "{sv}", "ostree.ref-binding",
@@ -526,14 +522,12 @@ flatpak_builtin_build_commit_from (int argc, char **argv, GCancellable *cancella
}
}
#ifdef FLATPAK_ENABLE_P2P
if (dst_collection_id != NULL)
{
OstreeCollectionRef ref = { (char *) dst_collection_id, (char *) dst_ref };
ostree_repo_transaction_set_collection_ref (dst_repo, &ref, commit_checksum);
}
else
#endif /* FLATPAK_ENABLE_P2P */
{
ostree_repo_transaction_set_ref (dst_repo, NULL, dst_ref, commit_checksum);
}

View File

@@ -47,9 +47,7 @@ static char *opt_files;
static char *opt_metadata;
static char *opt_timestamp = NULL;
static char *opt_endoflife;
#ifdef FLATPAK_ENABLE_P2P
static char *opt_collection_id = NULL;
#endif /* FLATPAK_ENABLE_P2P */
static GOptionEntry options[] = {
{ "subject", 's', 0, G_OPTION_ARG_STRING, &opt_subject, N_("One line subject"), N_("SUBJECT") },
@@ -66,9 +64,7 @@ static GOptionEntry options[] = {
{ "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, N_("GPG Homedir to use when looking for keyrings"), N_("HOMEDIR") },
{ "end-of-life", 0, 0, G_OPTION_ARG_STRING, &opt_endoflife, N_("Mark build as end-of-life"), N_("REASON") },
{ "timestamp", 0, 0, G_OPTION_ARG_STRING, &opt_timestamp, N_("Override the timestamp of the commit"), N_("TIMESTAMP") },
#ifdef FLATPAK_ENABLE_P2P
{ "collection-id", 0, 0, G_OPTION_ARG_STRING, &opt_collection_id, N_("Collection ID"), "COLLECTION-ID" },
#endif /* FLATPAK_ENABLE_P2P */
{ NULL }
};
@@ -688,14 +684,12 @@ flatpak_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
else
branch = "master";
#ifdef FLATPAK_ENABLE_P2P
if (opt_collection_id != NULL &&
!ostree_validate_collection_id (opt_collection_id, &my_error))
{
flatpak_fail (error, _("%s is not a valid collection ID: %s"), opt_collection_id, my_error->message);
goto out;
}
#endif /* FLATPAK_ENABLE_P2P */
if (!flatpak_is_valid_branch (branch, &my_error))
{
@@ -792,7 +786,6 @@ flatpak_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
if (!ostree_repo_resolve_rev (repo, full_branch, TRUE, &parent, error))
goto out;
#ifdef FLATPAK_ENABLE_P2P
if (opt_collection_id != NULL &&
g_strcmp0 (ostree_repo_get_collection_id (repo), opt_collection_id) != 0)
{
@@ -800,15 +793,12 @@ flatpak_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
opt_collection_id, ostree_repo_get_collection_id (repo));
goto out;
}
#endif /* FLATPAK_ENABLE_P2P */
}
else
{
#ifdef FLATPAK_ENABLE_P2P
if (opt_collection_id != NULL &&
!ostree_repo_set_collection_id (repo, opt_collection_id, error))
goto out;
#endif /* FLATPAK_ENABLE_P2P */
if (!ostree_repo_create (repo, OSTREE_REPO_MODE_ARCHIVE_Z2, cancellable, error))
goto out;
}
@@ -816,11 +806,7 @@ flatpak_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
/* Get the canonical collection ID which well use for the commit. This might
* be %NULL if the existing repo doesnt have one and none was specified on
* the command line. */
#ifdef FLATPAK_ENABLE_P2P
collection_id = ostree_repo_get_collection_id (repo);
#else /* if !FLATPAK_ENABLE_P2P */
collection_id = NULL;
#endif /* !FLATPAK_ENABLE_P2P */
if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
goto out;
@@ -886,8 +872,7 @@ flatpak_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
goto out;
/* Binding information. xa.ref is deprecated in favour of the OSTree keys, but
* keep it around for backwards compatibility. Write the bindings even if
* were compiled without P2P support, since other flatpak builds might be. */
* keep it around for backwards compatibility. */
g_variant_dict_insert_value (&metadata_dict, "ostree.collection-binding",
g_variant_new_string ((collection_id != NULL) ? collection_id : ""));
g_variant_dict_insert_value (&metadata_dict, "ostree.ref-binding",
@@ -946,14 +931,12 @@ flatpak_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
}
}
#ifdef FLATPAK_ENABLE_P2P
if (collection_id != NULL)
{
OstreeCollectionRef ref = { (char *) collection_id, full_branch };
ostree_repo_transaction_set_collection_ref (repo, &ref, commit_checksum);
}
else
#endif /* FLATPAK_ENABLE_P2P */
{
ostree_repo_transaction_set_ref (repo, NULL, full_branch, commit_checksum);
}

View File

@@ -188,9 +188,7 @@ flatpak_builtin_info_remote (int argc, char **argv, GCancellable *cancellable, G
return FALSE;
}
#ifdef FLATPAK_ENABLE_P2P
g_variant_lookup (commit_metadata, "ostree.collection-binding", "&s", &collection_id);
#endif
if (g_variant_lookup (commit_metadata, "xa.installed-size", "t", &installed_size))
installed_size = GUINT64_FROM_BE (installed_size);

View File

@@ -212,9 +212,7 @@ flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError *
if (xa_metadata == NULL)
g_printerr (_("Warning: Commit has no flatpak metadata\n"));
#ifdef FLATPAK_ENABLE_P2P
g_variant_lookup (commit_metadata, "ostree.collection-binding", "&s", &collection_id);
#endif
}
g_print ("%s%s%s %s\n", on, _("Ref:"), off, ref);

View File

@@ -201,9 +201,7 @@ handle_runtime_repo_deps (FlatpakDir *dir, const char *dep_url, GError **error)
group = g_strdup_printf ("remote \"%s\"", new_remote);
runtime_url = g_key_file_get_string (config, group, "url", NULL);
g_assert (runtime_url != NULL);
#ifdef FLATPAK_ENABLE_P2P
runtime_collection_id = g_key_file_get_string (config, group, "collection-id", NULL);
#endif /* FLATPAK_ENABLE_P2P */
if (remote_is_already_configured (dir, runtime_url, runtime_collection_id))
return TRUE;
@@ -331,9 +329,7 @@ handle_suggested_remote_name (FlatpakDir *dir, GBytes *data, GError **error)
if (url == NULL)
return TRUE;
#ifdef FLATPAK_ENABLE_P2P
collection_id = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP, FLATPAK_REF_COLLECTION_ID_KEY, NULL);
#endif /* FLATPAK_ENABLE_P2P */
if (remote_is_already_configured (dir, url, collection_id))
return TRUE;

View File

@@ -68,9 +68,7 @@ flatpak_builtin_list_remotes (int argc, char **argv, GCancellable *cancellable,
{
flatpak_table_printer_set_column_title (printer, j++, _("Title"));
flatpak_table_printer_set_column_title (printer, j++, _("URL"));
#ifdef FLATPAK_ENABLE_P2P
flatpak_table_printer_set_column_title (printer, j++, _("Collection ID"));
#endif
flatpak_table_printer_set_column_title (printer, j++, _("Priority"));
}
flatpak_table_printer_set_column_title (printer, j++, _("Options"));
@@ -90,9 +88,7 @@ flatpak_builtin_list_remotes (int argc, char **argv, GCancellable *cancellable,
gboolean disabled;
g_autofree char *remote_url = NULL;
g_autofree char *title = NULL;
#ifdef FLATPAK_ENABLE_P2P
g_autofree char *collection_id = NULL;
#endif
int prio;
g_autofree char *prio_as_string = NULL;
gboolean gpg_verify = TRUE;
@@ -116,13 +112,11 @@ flatpak_builtin_list_remotes (int argc, char **argv, GCancellable *cancellable,
else
flatpak_table_printer_add_column (printer, "-");
#ifdef FLATPAK_ENABLE_P2P
collection_id = flatpak_dir_get_remote_collection_id (dir, remote_name);
if (collection_id != NULL)
flatpak_table_printer_add_column (printer, collection_id);
else
flatpak_table_printer_add_column (printer, "-");
#endif
prio = flatpak_dir_get_remote_prio (dir, remote_name);
prio_as_string = g_strdup_printf ("%d", prio);

View File

@@ -52,10 +52,8 @@ 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") },
{ "default-branch", 0, 0, G_OPTION_ARG_STRING, &opt_default_branch, N_("Default branch to use for this repository"), N_("BRANCH") },
#ifdef FLATPAK_ENABLE_P2P
{ "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 },
#endif /* FLATPAK_ENABLE_P2P */
{ "gpg-import", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &opt_gpg_import, N_("Import new default GPG public key from FILE"), N_("FILE") },
{ "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_gpg_key_ids, N_("GPG Key ID to sign the summary with"), N_("KEY-ID") },
{ "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, N_("GPG Homedir to use when looking for keyrings"), N_("HOMEDIR") },
@@ -455,11 +453,7 @@ flatpak_builtin_build_update_repo (int argc, char **argv,
* Changing the collection ID between two different non-empty values is too
* dangerous: it will break all clients who have previously pulled from the repository.
* Require the user to recreate the repository from scratch in that case. */
#ifdef FLATPAK_ENABLE_P2P
const char *old_collection_id = ostree_repo_get_collection_id (repo);
#else /* if !FLATPAK_ENABLE_P2P */
const char *old_collection_id = NULL;
#endif /* !FLATPAK_ENABLE_P2P */
const char *new_collection_id = opt_collection_id[0] ? opt_collection_id : NULL;
if (old_collection_id != NULL &&

View File

@@ -198,14 +198,12 @@ flatpak_builtin_repo (int argc, char **argv,
if (!ostree_repo_open (repo, cancellable, error))
return FALSE;
#ifdef FLATPAK_ENABLE_P2P
/* Try loading the metadata from the ostree-metadata branch first. If that
* fails, fall back to the summary file. */
ostree_metadata_ref = OSTREE_REPO_METADATA_REF;
if (!ostree_repo_resolve_rev (repo, ostree_metadata_ref,
TRUE, &ostree_metadata_checksum, error))
return FALSE;
#endif /* FLATPAK_ENABLE_P2P */
if (ostree_metadata_checksum != NULL)
{

View File

@@ -307,9 +307,7 @@ flatpak_bundle_ref_new (GFile *file,
"branch", parts[3],
"commit", commit,
"file", file,
#ifdef FLATPAK_ENABLE_P2P
"collection-id", collection_id,
#endif /* FLATPAK_ENABLE_P2P */
NULL);
priv = flatpak_bundle_ref_get_instance_private (ref);

View File

@@ -48,10 +48,7 @@ GType flatpak_deploy_get_type (void);
#define FLATPAK_REF_IS_RUNTIME_KEY "IsRuntime"
#define FLATPAK_REF_NAME_KEY "Name"
#define FLATPAK_REF_BRANCH_KEY "Branch"
#ifdef FLATPAK_ENABLE_P2P
#define FLATPAK_REF_COLLECTION_ID_KEY "CollectionID"
#endif /* FLATPAK_ENABLE_P2P */
#define FLATPAK_REPO_GROUP "Flatpak Repo"
#define FLATPAK_REPO_VERSION_KEY "Version"
@@ -61,9 +58,7 @@ GType flatpak_deploy_get_type (void);
#define FLATPAK_REPO_GPGKEY_KEY "GPGKey"
#define FLATPAK_REPO_NODEPS_KEY "NoDeps"
#ifdef FLATPAK_ENABLE_P2P
#define FLATPAK_REPO_COLLECTION_ID_KEY "CollectionID"
#endif /* FLATPAK_ENABLE_P2P */
#define FLATPAK_DEFAULT_UPDATE_FREQUENCY 100
#define FLATPAK_CLI_UPDATE_FREQUENCY 300
@@ -200,19 +195,6 @@ typedef enum {
GQuark flatpak_dir_error_quark (void);
#ifndef FLATPAK_ENABLE_P2P
/* Rather than putting #ifdefs around all the function arguments for result sets,
* define away OstreeRepoFinderResult if were compiling without P2P support.
* The surrounding code should always pass in NULL if P2P support is disabled. */
typedef void OstreeRepoFinderResult;
typedef void** OstreeRepoFinderResultv;
static inline void no_op (gpointer data) {}
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepoFinderResult, no_op)
G_DEFINE_AUTO_CLEANUP_FREE_FUNC (OstreeRepoFinderResultv, no_op, NULL)
#endif /* !FLATPAK_ENABLE_P2P */
/**
* FLATPAK_DEPLOY_DATA_GVARIANT_FORMAT:
*

View File

@@ -89,12 +89,10 @@ static GVariant * flatpak_create_deploy_data_from_old (GFile *deploy_dir,
GCancellable *cancellable,
GError **error);
#ifdef FLATPAK_ENABLE_P2P
static gboolean _flatpak_dir_fetch_remote_state_metadata_branch (FlatpakDir *self,
FlatpakRemoteState *state,
GCancellable *cancellable,
GError **error);
#endif
typedef struct
{
@@ -2284,7 +2282,6 @@ repo_get_remote_collection_id (OstreeRepo *repo,
char **collection_id_out,
GError **error);
#ifdef FLATPAK_ENABLE_P2P
static void
async_result_cb (GObject *obj,
GAsyncResult *result,
@@ -2293,7 +2290,6 @@ async_result_cb (GObject *obj,
GAsyncResult **result_out = user_data;
*result_out = g_object_ref (result);
}
#endif /* FLATPAK_ENABLE_P2P */
gboolean
flatpak_dir_find_latest_rev (FlatpakDir *self,
@@ -2311,7 +2307,6 @@ flatpak_dir_find_latest_rev (FlatpakDir *self,
if (state->collection_id != NULL)
{
#ifdef FLATPAK_ENABLE_P2P
/* Find the latest rev from the remote and its available mirrors, including
* LAN and USB sources. */
g_auto(GVariantBuilder) find_builder = FLATPAK_VARIANT_BUILDER_INITIALIZER;
@@ -2365,10 +2360,6 @@ flatpak_dir_find_latest_rev (FlatpakDir *self,
if (out_rev != NULL)
*out_rev = g_steal_pointer (&latest_rev);
#else /* if !FLATPAK_ENABLE_P2P */
g_assert_not_reached ();
#endif /* !FLATPAK_ENABLE_P2P */
}
else
{
@@ -2645,7 +2636,6 @@ repo_get_remote_collection_id (OstreeRepo *repo,
char **collection_id_out,
GError **error)
{
#ifdef FLATPAK_ENABLE_P2P
if (collection_id_out != NULL)
{
if (!ostree_repo_get_remote_option (repo, remote_name, "collection-id",
@@ -2654,10 +2644,6 @@ repo_get_remote_collection_id (OstreeRepo *repo,
if (*collection_id_out != NULL && **collection_id_out == '\0')
g_clear_pointer (collection_id_out, g_free);
}
#else /* if !FLATPAK_ENABLE_P2P */
if (collection_id_out != NULL)
*collection_id_out = NULL;
#endif /* !FLATPAK_ENABLE_P2P */
return TRUE;
}
@@ -2754,7 +2740,6 @@ repo_pull (OstreeRepo *self,
if (!repo_get_remote_collection_id (self, remote_name, &collection_id, NULL))
g_clear_pointer (&collection_id, g_free);
#ifdef FLATPAK_ENABLE_P2P
if (collection_id != NULL)
{
GVariantBuilder find_builder, pull_builder;
@@ -2843,7 +2828,6 @@ repo_pull (OstreeRepo *self,
g_debug ("Failed to pull using find-remotes; falling back to normal pull: %s", (*error)->message);
g_clear_error (error);
}
#endif /* FLATPAK_ENABLE_P2P */
if (!res)
{
@@ -3486,9 +3470,7 @@ flatpak_dir_pull (FlatpakDir *self,
g_auto(GLnxConsoleRef) console = { 0, };
g_autoptr(OstreeAsyncProgress) console_progress = NULL;
g_autoptr(GPtrArray) subdirs_arg = NULL;
#ifdef FLATPAK_ENABLE_P2P
g_auto(OstreeRepoFinderResultv) allocated_results = NULL;
#endif
const OstreeRepoFinderResult * const *results;
g_auto(GLnxLockFile) lock = { 0, };
@@ -3541,7 +3523,6 @@ flatpak_dir_pull (FlatpakDir *self,
}
else
{
#ifdef FLATPAK_ENABLE_P2P
if (state->collection_id)
{
GVariantBuilder find_builder;
@@ -3602,7 +3583,6 @@ flatpak_dir_pull (FlatpakDir *self,
collection_ref.collection_id, collection_ref.ref_name, state->remote_name);
}
else
#endif /* FLATPAK_ENABLE_P2P */
{
flatpak_remote_state_lookup_ref (state, ref, &rev, NULL, error);
if (rev == NULL && error != NULL && *error == NULL)
@@ -3916,7 +3896,6 @@ flatpak_dir_pull_untrusted_local (FlatpakDir *self,
if (!ostree_repo_load_commit (src_repo, checksum, &new_commit, NULL, error))
return FALSE;
#ifdef FLATPAK_ENABLE_P2P
if (gpg_verify)
{
/* Verify the commits binding to the ref and to the repo. See
@@ -3965,7 +3944,6 @@ flatpak_dir_pull_untrusted_local (FlatpakDir *self,
commit_collection_id, collection_id);
}
}
#endif /* FLATPAK_ENABLE_P2P */
if (old_commit)
{
@@ -6669,7 +6647,6 @@ flatpak_dir_install (FlatpakDir *self,
progress, cancellable, error))
return FALSE;
#ifdef FLATPAK_ENABLE_P2P
if (state->collection_id != NULL &&
!flatpak_dir_pull (self, state, OSTREE_REPO_METADATA_REF, NULL, NULL, NULL,
child_repo,
@@ -6677,7 +6654,6 @@ flatpak_dir_install (FlatpakDir *self,
OSTREE_REPO_PULL_FLAGS_MIRROR,
progress, cancellable, error))
return FALSE;
#endif /* FLATPAK_ENABLE_P2P */
if (!child_repo_ensure_summary (child_repo, state, cancellable, error))
return FALSE;
@@ -7289,14 +7265,12 @@ flatpak_dir_update (FlatpakDir *self,
flatpak_flags, OSTREE_REPO_PULL_FLAGS_MIRROR,
progress, cancellable, error))
return FALSE;
#ifdef FLATPAK_ENABLE_P2P
if (state->collection_id != NULL &&
!flatpak_dir_pull (self, state, OSTREE_REPO_METADATA_REF, NULL, NULL, NULL,
child_repo,
flatpak_flags, OSTREE_REPO_PULL_FLAGS_MIRROR,
progress, cancellable, error))
return FALSE;
#endif /* FLATPAK_ENABLE_P2P */
if (!child_repo_ensure_summary (child_repo, state, cancellable, error))
return FALSE;
@@ -8473,7 +8447,6 @@ _flatpak_dir_get_remote_state (FlatpakDir *self,
}
else
{
#ifdef FLATPAK_ENABLE_P2P
g_autofree char *latest_rev = NULL;
g_autoptr(GVariant) commit_v = NULL;
g_autoptr(GError) local_error = NULL;
@@ -8507,9 +8480,6 @@ _flatpak_dir_get_remote_state (FlatpakDir *self,
state->metadata = g_variant_get_child_value (commit_v, 0);
}
#else /* if !FLATPAK_ENABLE_P2P */
g_assert_not_reached ();
#endif /* !FLATPAK_ENABLE_P2P */
}
return g_steal_pointer (&state);
@@ -9732,10 +9702,8 @@ create_origin_remote_config (OstreeRepo *repo,
if (main_ref)
g_key_file_set_string (*new_config, group, "xa.main-ref", main_ref);
#ifdef FLATPAK_ENABLE_P2P
if (collection_id)
g_key_file_set_string (*new_config, group, "collection-id", collection_id);
#endif /* FLATPAK_ENABLE_P2P */
return g_steal_pointer (&remote);
}
@@ -9854,12 +9822,8 @@ flatpak_dir_parse_repofile (FlatpakDir *self,
g_key_file_set_boolean (config, group, "gpg-verify", TRUE);
}
#ifdef FLATPAK_ENABLE_P2P
collection_id = g_key_file_get_string (keyfile, source_group,
FLATPAK_REPO_COLLECTION_ID_KEY, NULL);
#else /* if !FLATPAK_ENABLE_P2P */
collection_id = NULL;
#endif /* !FLATPAK_ENABLE_P2P */
if (collection_id != NULL)
{
if (gpg_key == NULL)
@@ -9958,12 +9922,8 @@ parse_ref_file (GBytes *data,
gpg_data = g_bytes_new_take (decoded, decoded_len);
}
#ifdef FLATPAK_ENABLE_P2P
collection_id = g_key_file_get_string (keyfile, FLATPAK_REF_GROUP,
FLATPAK_REF_COLLECTION_ID_KEY, NULL);
#else /* if !FLATPAK_ENABLE_P2P */
collection_id = NULL;
#endif /* !FLATPAK_ENABLE_P2P */
if (collection_id != NULL && gpg_data == NULL)
return flatpak_fail (error, "Collection ID requires GPG key to be provided");
@@ -10044,12 +10004,6 @@ flatpak_dir_find_remote_by_uri (FlatpakDir *self,
if (!flatpak_dir_ensure_repo (self, NULL, NULL))
return NULL;
#ifndef FLATPAK_ENABLE_P2P
/* If we dont have P2P support enabled, we always want to ignore collection IDs
* in comparisons. */
collection_id = NULL;
#endif /* !FLATPAK_ENABLE_P2P */
remotes = flatpak_dir_list_enumerated_remotes (self, NULL, NULL);
if (remotes)
{
@@ -10482,7 +10436,6 @@ flatpak_dir_list_remote_refs (FlatpakDir *self,
return TRUE;
}
#ifdef FLATPAK_ENABLE_P2P
gboolean
_flatpak_dir_fetch_remote_state_metadata_branch (FlatpakDir *self,
FlatpakRemoteState *state, /* This state does not have metadata filled out yet */
@@ -10627,7 +10580,6 @@ _flatpak_dir_fetch_remote_state_metadata_branch (FlatpakDir *self,
return TRUE;
}
#endif /* FLATPAK_ENABLE_P2P */
gboolean
flatpak_dir_update_remote_configuration_for_state (FlatpakDir *self,
@@ -11133,10 +11085,8 @@ flatpak_dir_find_remote_related_for_metadata (FlatpakDir *self,
branches = default_branches;
}
#ifdef FLATPAK_ENABLE_P2P
extension_collection_id = g_key_file_get_string (metakey, groups[i],
FLATPAK_METADATA_KEY_COLLECTION_ID, NULL);
#endif /* FLATPAK_ENABLE_P2P */
/* For the moment, none of the related ref machinery handles
* collection IDs which dont match the original ref. */
@@ -11331,10 +11281,8 @@ flatpak_dir_find_local_related_for_metadata (FlatpakDir *self,
else
branch = parts[3];
#ifdef FLATPAK_ENABLE_P2P
extension_collection_id = g_key_file_get_string (metakey, groups[i],
FLATPAK_METADATA_KEY_COLLECTION_ID, NULL);
#endif /* FLATPAK_ENABLE_P2P */
/* As were looking locally, we cant support extension
* collection IDs which dont match the current remote (since the

View File

@@ -22,10 +22,8 @@
#include <string.h>
#ifdef FLATPAK_ENABLE_P2P
#include <ostree.h>
#include <ostree-repo-finder-avahi.h>
#endif /* FLATPAK_ENABLE_P2P */
#include "flatpak-installation-private.h"
#include "flatpak-utils-private.h"
@@ -885,7 +883,6 @@ flatpak_installation_list_installed_refs_by_kind (FlatpakInstallation *self,
return g_steal_pointer (&refs);
}
#ifdef FLATPAK_ENABLE_P2P
static void
async_result_cb (GObject *obj,
GAsyncResult *result,
@@ -894,7 +891,6 @@ async_result_cb (GObject *obj,
GAsyncResult **result_out = user_data;
*result_out = g_object_ref (result);
}
#endif /* FLATPAK_ENABLE_P2P */
/**
* flatpak_installation_list_installed_refs_for_update:
@@ -920,12 +916,10 @@ flatpak_installation_list_installed_refs_for_update (FlatpakInstallation *self,
g_autoptr(GPtrArray) remotes = NULL; /* (element-type FlatpakRemote) */
g_autoptr(GHashTable) remote_commits = NULL; /* (element-type utf8 utf8) */
int i, j;
#ifdef FLATPAK_ENABLE_P2P
g_autoptr(FlatpakDir) dir = NULL;
g_auto(OstreeRepoFinderResultv) results = NULL;
g_autoptr(GAsyncResult) result = NULL;
g_autoptr(GPtrArray) collection_refs = NULL; /* (element-type OstreeCollectionRef) */
#endif /* FLATPAK_ENABLE_P2P */
remote_commits = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
@@ -993,7 +987,6 @@ flatpak_installation_list_installed_refs_for_update (FlatpakInstallation *self,
g_ptr_array_add (updates, g_object_ref (installed_ref));
}
#ifdef FLATPAK_ENABLE_P2P
dir = flatpak_installation_get_dir (self, error);
if (dir == NULL)
return NULL;
@@ -1103,7 +1096,6 @@ flatpak_installation_list_installed_refs_for_update (FlatpakInstallation *self,
break;
}
}
#endif /* FLATPAK_ENABLE_P2P */
return g_steal_pointer (&updates);
}
@@ -1123,7 +1115,6 @@ list_remotes_for_configured_remote (FlatpakInstallation *self,
GCancellable *cancellable,
GError **error)
{
#ifdef FLATPAK_ENABLE_P2P
g_autofree gchar *collection_id = NULL;
OstreeCollectionRef ref;
const OstreeCollectionRef *refs[2] = { NULL, };
@@ -1205,7 +1196,6 @@ list_remotes_for_configured_remote (FlatpakInstallation *self,
results[i]->finder,
dir));
}
#endif /* FLATPAK_ENABLE_P2P */
return TRUE;
}
@@ -2284,12 +2274,10 @@ flatpak_installation_fetch_remote_ref_sync (FlatpakInstallation *self,
return NULL;
/* FIXME: Rework to accept the collection ID as an input argument instead */
#ifdef FLATPAK_ENABLE_P2P
if (!ostree_repo_get_remote_option (flatpak_dir_get_repo (dir),
remote_name, "collection-id",
NULL, &collection_id, error))
return FALSE;
#endif /* FLATPAK_ENABLE_P2P */
if (kind == FLATPAK_REF_KIND_APP)
ref = flatpak_build_app_ref (name,
@@ -2303,7 +2291,6 @@ flatpak_installation_fetch_remote_ref_sync (FlatpakInstallation *self,
coll_ref = flatpak_collection_ref_new (collection_id, ref);
checksum = g_hash_table_lookup (ht, coll_ref);
#ifdef FLATPAK_ENABLE_P2P
/* If there was not a match, it may be because the collection ID is
* not set in the local configuration, or it is wrong, so we resort to
* trying to match just the ref name */
@@ -2323,7 +2310,6 @@ flatpak_installation_fetch_remote_ref_sync (FlatpakInstallation *self,
}
}
}
#endif /* FLATPAK_ENABLE_P2P */
if (checksum != NULL)
return flatpak_remote_ref_new (coll_ref, checksum, remote_name, state);

View File

@@ -286,9 +286,7 @@ flatpak_related_ref_new (const char *collection_id,
"subpaths", subpaths,
"should-download", download,
"should-delete", delete,
#ifdef FLATPAK_ENABLE_P2P
"collection-id", collection_id,
#endif /* FLATPAK_ENABLE_P2P */
NULL);
return ref;

View File

@@ -32,11 +32,9 @@
FlatpakRemote *flatpak_remote_new_with_dir (const char *name,
FlatpakDir *dir);
#ifdef FLATPAK_ENABLE_P2P
FlatpakRemote *flatpak_remote_new_from_ostree (OstreeRemote *remote,
OstreeRepoFinder *repo_finder,
FlatpakDir *dir);
#endif /* FLATPAK_ENABLE_P2P */
gboolean flatpak_remote_commit (FlatpakRemote *self,
FlatpakDir *dir,

View File

@@ -28,9 +28,7 @@
#include <string.h>
#include <ostree.h>
#ifdef FLATPAK_ENABLE_P2P
#include <ostree-repo-finder-avahi.h>
#endif /* FLATPAK_ENABLE_P2P */
/**
* SECTION:flatpak-remote
@@ -345,7 +343,6 @@ flatpak_remote_set_url (FlatpakRemote *self,
char *
flatpak_remote_get_collection_id (FlatpakRemote *self)
{
#ifdef FLATPAK_ENABLE_P2P
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
if (priv->local_collection_id_set)
@@ -353,7 +350,6 @@ flatpak_remote_get_collection_id (FlatpakRemote *self)
if (priv->dir)
return flatpak_dir_get_remote_collection_id (priv->dir, priv->name);
#endif /** FLATPAK_ENABLE_P2P */
return NULL;
}
@@ -373,7 +369,6 @@ void
flatpak_remote_set_collection_id (FlatpakRemote *self,
const char *collection_id)
{
#ifdef FLATPAK_ENABLE_P2P
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
if (collection_id != NULL && *collection_id == '\0')
@@ -382,7 +377,6 @@ flatpak_remote_set_collection_id (FlatpakRemote *self,
g_free (priv->local_collection_id);
priv->local_collection_id = g_strdup (collection_id);
priv->local_collection_id_set = TRUE;
#endif /* FLATPAK_ENABLE_P2P */
}
/**
@@ -734,7 +728,6 @@ flatpak_remote_new_with_dir (const char *name,
return self;
}
#ifdef FLATPAK_ENABLE_P2P
static FlatpakRemoteType
repo_finder_to_remote_type (OstreeRepoFinder *repo_finder)
{
@@ -768,7 +761,6 @@ flatpak_remote_new_from_ostree (OstreeRemote *remote,
return self;
}
#endif /* FLATPAK_ENABLE_P2P */
/**
* flatpak_remote_new:

View File

@@ -88,9 +88,7 @@ gboolean flatpak_run_in_transient_unit (const char *app_id,
#define FLATPAK_METADATA_KEY_VERSION "version"
#define FLATPAK_METADATA_KEY_VERSIONS "versions"
#ifdef FLATPAK_ENABLE_P2P
#define FLATPAK_METADATA_KEY_COLLECTION_ID "collection-id"
#endif /* FLATPAK_ENABLE_P2P */
#define FLATPAK_METADATA_GROUP_EXTRA_DATA "Extra Data"
#define FLATPAK_METADATA_KEY_EXTRA_DATA_CHECKSUM "checksum"

View File

@@ -2581,7 +2581,6 @@ flatpak_repo_set_collection_id (OstreeRepo *repo,
const char *collection_id,
GError **error)
{
#ifdef FLATPAK_ENABLE_P2P
g_autoptr(GKeyFile) config = NULL;
if (!ostree_repo_set_collection_id (repo, collection_id, error))
@@ -2590,7 +2589,6 @@ flatpak_repo_set_collection_id (OstreeRepo *repo,
config = ostree_repo_copy_config (repo);
if (!ostree_repo_write_config (repo, config, error))
return FALSE;
#endif /* FLATPAK_ENABLE_P2P */
return TRUE;
}
@@ -2853,12 +2851,8 @@ populate_commit_data_cache (GVariant *metadata,
gsize n, i;
const char *old_collection_id;
#if FLATPAK_ENABLE_P2P
if (!g_variant_lookup (metadata, "ostree.summary.collection-id", "&s", &old_collection_id))
old_collection_id = NULL;
#else /* if !FLATPAK_ENABLE_P2P */
old_collection_id = NULL;
#endif /* !FLATPAK_ENABLE_P2P */
cache_v = g_variant_lookup_value (metadata, "xa.cache", NULL);
@@ -2960,11 +2954,7 @@ flatpak_repo_update (OstreeRepo *repo,
deploy_collection_id = g_key_file_get_boolean (config, "flatpak", "deploy-collection-id", NULL);
}
#ifdef FLATPAK_ENABLE_P2P
collection_id = ostree_repo_get_collection_id (repo);
#else /* if !FLATPAK_ENABLE_P2P */
collection_id = NULL;
#endif /* FLATPAK_ENABLE_P2P */
if (title)
g_variant_builder_add (&builder, "{sv}", "xa.title",
@@ -3028,11 +3018,9 @@ flatpak_repo_update (OstreeRepo *repo,
old_summary = flatpak_repo_load_summary (repo, NULL);
#ifdef FLATPAK_ENABLE_P2P
if (!ostree_repo_resolve_rev (repo, OSTREE_REPO_METADATA_REF,
TRUE, &old_ostree_metadata_checksum, error))
return FALSE;
#endif /* FLATPAK_ENABLE_P2P */
if (old_summary != NULL &&
old_ostree_metadata_checksum != NULL &&
@@ -3155,7 +3143,6 @@ flatpak_repo_update (OstreeRepo *repo,
/* Write out a new metadata commit for the repository. */
if (collection_id != NULL)
{
#ifdef FLATPAK_ENABLE_P2P
OstreeCollectionRef collection_ref = { (gchar *) collection_id, (gchar *) OSTREE_REPO_METADATA_REF };
g_autofree gchar *new_ostree_metadata_checksum = NULL;
g_autoptr(OstreeMutableTree) mtree = NULL;
@@ -3210,10 +3197,6 @@ flatpak_repo_update (OstreeRepo *repo,
if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error))
goto out;
#else /* if !FLATPAK_ENABLE_P2P */
g_assert_not_reached ();
goto out;
#endif /* FLATPAK_ENABLE_P2P */
}
/* Regenerate and re-sign the summary file. */
@@ -3685,11 +3668,7 @@ flatpak_repo_generate_appstream (OstreeRepo *repo,
arches = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
#ifdef FLATPAK_ENABLE_P2P
collection_id = ostree_repo_get_collection_id (repo);
#else /* if !FLATPAK_ENABLE_P2P */
collection_id = NULL;
#endif /* !FLATPAK_ENABLE_P2P */
if (!ostree_repo_list_refs (repo,
NULL,
@@ -3932,14 +3911,12 @@ flatpak_repo_generate_appstream (OstreeRepo *repo,
}
}
#ifdef FLATPAK_ENABLE_P2P
if (collection_id != NULL)
{
const OstreeCollectionRef collection_ref = { (char *) collection_id, branch };
ostree_repo_transaction_set_collection_ref (repo, &collection_ref, commit_checksum);
}
else
#endif /* FLATPAK_ENABLE_P2P */
{
ostree_repo_transaction_set_ref (repo, NULL, branch, commit_checksum);
}
@@ -4641,12 +4618,8 @@ flatpak_bundle_load (GFile *file,
if (collection_id != NULL)
{
#ifdef FLATPAK_ENABLE_P2P
if (!g_variant_lookup (metadata, "collection-id", "s", collection_id))
*collection_id = NULL;
#else /* if !FLATPAK_ENABLE_P2P */
*collection_id = NULL;
#endif /* !FLATPAK_ENABLE_P2P */
}
if (app_metadata != NULL)
@@ -4705,11 +4678,9 @@ flatpak_pull_from_bundle (OstreeRepo *repo,
if (metadata == NULL)
return FALSE;
#ifdef FLATPAK_ENABLE_P2P
if (!ostree_repo_get_remote_option (repo, remote, "collection-id", NULL,
&remote_collection_id, NULL))
remote_collection_id = NULL;
#endif /* FLATPAK_ENABLE_P2P */
if (remote_collection_id != NULL && collection_id != NULL &&
strcmp (remote_collection_id, collection_id) != 0)

View File

@@ -359,9 +359,7 @@ main (int argc, char *argv[])
g_autoptr(GPtrArray) refs = NULL;
const char *collection_id = NULL;
#ifdef FLATPAK_ENABLE_P2P
collection_id = flatpak_remote_get_collection_id (remote);
#endif /* !FLATPAK_ENABLE_P2P */
g_print ("\nRemote: %s %u %d %s %s %s %s %d %d %s\n",
flatpak_remote_get_name (remote),

View File

@@ -32,7 +32,6 @@ AC_INIT([Flatpak],
GLIB_REQS=2.44
SYSTEM_BWRAP_REQS=0.2.1
OSTREE_REQS=2018.6
OSTREE_P2P_REQS=2018.2
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
@@ -265,29 +264,6 @@ AC_ARG_ENABLE(sudo,
[SUDO_BIN="sudo"], [SUDO_BIN=""])
AC_SUBST([SUDO_BIN])
# Decide whether to build with peer to peer support. This requires API in
# libostree which before 2018.6 was experimental.
#FIXME: Clean up when flatpak depends on 2018.6
enable_p2p=no
PKG_CHECK_MODULES(OSTREE_P2P_REQ, [ostree-1 >= $OSTREE_P2P_REQS],[
ostree_features=$($PKG_CONFIG --variable=features ostree-1)
AS_CASE(["$ostree_features"],
[*experimental*],[have_ostree_experimental=yes],
[*p2p*],[have_ostree_p2p=yes])
AS_IF([test "x$have_ostree_experimental" != "xyes" && test "x$have_ostree_p2p" != "xyes"],[
AC_MSG_WARN([Experimental/P2P API not found in ostree-1, so flatpak will be compiled without P2P support. OSTree < 2018.6 must be compiled with --enable-experimental-api.])
],[
enable_p2p=yes
AC_DEFINE([FLATPAK_ENABLE_P2P],[1],[Define if peer to peer support should be enabled])
AS_IF([test "x$have_ostree_experimental" == "xyes"],[
AC_DEFINE([OSTREE_ENABLE_EXPERIMENTAL_API],[1],[Define if libostree experimental API should be enabled])
])
])
], :)
AM_CONDITIONAL([ENABLE_P2P],[test x$enable_p2p = xyes])
AC_ARG_WITH(system-install-dir,
[AS_HELP_STRING([--with-system-install-dir=DIR],
[Location of system installation [LOCALSTATEDIR/lib/flatpak]])],
@@ -461,5 +437,4 @@ echo " Use sandboxed triggers: $enable_sandboxed_triggers"
echo " Use seccomp: $enable_seccomp"
echo " Privileged group: $PRIVILEGED_GROUP"
echo " Privilege mode: $with_priv_mode"
echo " Peer to peer support: $enable_p2p"
echo ""

View File

@@ -19,9 +19,7 @@ static char *flatpak_installationsdir;
static char *gpg_homedir;
static char *gpg_args;
static char *repo_url;
#ifdef FLATPAK_ENABLE_P2P
static char *repo_collection_id;
#endif /* FLATPAK_ENABLE_P2P */
int httpd_pid = -1;
static const char *gpg_id = "7B0961FD";
@@ -212,9 +210,7 @@ test_ref (void)
g_assert_cmpstr (flatpak_ref_get_name (ref), ==, "org.flatpak.Hello");
g_assert_cmpstr (flatpak_ref_get_arch (ref), ==, "x86_64");
g_assert_cmpstr (flatpak_ref_get_branch (ref), ==, "master");
#ifdef FLATPAK_ENABLE_P2P
g_assert_null (flatpak_ref_get_collection_id (ref));
#endif /* FLATPAK_ENABLE_P2P */
formatted = flatpak_ref_format_ref (ref);
g_assert_cmpstr (formatted, ==, valid);
@@ -290,9 +286,7 @@ test_remote_by_name (void)
g_assert_true (flatpak_remote_get_gpg_verify (remote));
g_assert_cmpint (flatpak_remote_get_prio (remote), ==, 1);
#ifdef FLATPAK_ENABLE_P2P
g_assert_cmpstr (flatpak_remote_get_collection_id (remote), ==, repo_collection_id);
#endif /* FLATPAK_ENABLE_P2P */
}
static void
@@ -301,12 +295,10 @@ test_remote (void)
g_autoptr(FlatpakInstallation) inst = NULL;
g_autoptr(GError) error = NULL;
g_autoptr(FlatpakRemote) remote = NULL;
#ifdef FLATPAK_ENABLE_P2P
g_autoptr(GFile) inst_file = NULL;
g_autoptr(GFile) repo_file = NULL;
g_autoptr(OstreeRepo) repo = NULL;
gboolean gpg_verify_summary;
#endif
gboolean res;
inst = flatpak_installation_new_user (NULL, &error);
@@ -315,7 +307,6 @@ test_remote (void)
remote = flatpak_installation_get_remote_by_name (inst, repo_name, NULL, &error);
g_assert_no_error (error);
#ifdef FLATPAK_ENABLE_P2P
g_assert_cmpstr (flatpak_remote_get_collection_id (remote), ==, repo_collection_id);
/* Flatpak doesn't provide access to gpg-verify-summary, so use ostree */
@@ -350,7 +341,6 @@ test_remote (void)
flatpak_remote_set_collection_id (remote, repo_collection_id);
g_assert_cmpstr (flatpak_remote_get_collection_id (remote), ==, repo_collection_id);
#endif /* FLATPAK_ENABLE_P2P */
g_assert_cmpstr (flatpak_remote_get_title (remote), ==, NULL);
flatpak_remote_set_title (remote, "Test Repo");
@@ -389,7 +379,6 @@ test_list_refs (void)
g_assert_cmpint (refs->len, ==, 0);
}
#ifdef FLATPAK_ENABLE_P2P
static void
create_multi_collection_id_repo (const char *repo_dir)
{
@@ -501,7 +490,6 @@ test_list_refs_in_remotes (void)
g_assert_nonnull (g_hash_table_lookup (ref_specs, ref_spec));
}
}
#endif /* FLATPAK_ENABLE_P2P */
static void
test_list_remote_refs (void)
@@ -665,9 +653,7 @@ test_install_launch_uninstall (void)
g_assert_cmpstr (flatpak_ref_get_arch (FLATPAK_REF (ref)), ==, flatpak_get_default_arch ());
g_assert_cmpstr (flatpak_ref_get_branch (FLATPAK_REF (ref)), ==, "master");
g_assert_cmpint (flatpak_ref_get_kind (FLATPAK_REF (ref)), ==, FLATPAK_REF_KIND_RUNTIME);
#ifdef FLATPAK_ENABLE_P2P
g_assert_null (flatpak_ref_get_collection_id (FLATPAK_REF (ref)));
#endif /* FLATPAK_ENABLE_P2P */
g_assert_cmpuint (flatpak_installed_ref_get_installed_size (ref), >, 0);
@@ -715,9 +701,7 @@ test_install_launch_uninstall (void)
g_assert_cmpstr (flatpak_ref_get_arch (FLATPAK_REF (ref)), ==, flatpak_get_default_arch ());
g_assert_cmpstr (flatpak_ref_get_branch (FLATPAK_REF (ref)), ==, "master");
g_assert_cmpint (flatpak_ref_get_kind (FLATPAK_REF (ref)), ==, FLATPAK_REF_KIND_APP);
#ifdef FLATPAK_ENABLE_P2P
g_assert_null (flatpak_ref_get_collection_id (FLATPAK_REF (ref)));
#endif /* FLATPAK_ENABLE_P2P */
g_assert_cmpuint (flatpak_installed_ref_get_installed_size (ref), >, 0);
g_assert_true (flatpak_installed_ref_get_is_current (ref));
@@ -935,9 +919,7 @@ make_test_runtime (void)
arg0 = g_test_build_filename (G_TEST_DIST, "make-test-runtime.sh", NULL);
argv[0] = arg0;
#ifdef FLATPAK_ENABLE_P2P
argv[3] = repo_collection_id;
#endif /* FLATPAK_ENABLE_P2P */
run_test_subprocess (argv, RUN_TEST_SUBPROCESS_DEFAULT);
}
@@ -950,9 +932,7 @@ make_test_app (void)
arg0 = g_test_build_filename (G_TEST_DIST, "make-test-app.sh", NULL);
argv[0] = arg0;
#ifdef FLATPAK_ENABLE_P2P
argv[3] = repo_collection_id;
#endif /* FLATPAK_ENABLE_P2P */
run_test_subprocess (argv, RUN_TEST_SUBPROCESS_DEFAULT);
}
@@ -965,9 +945,7 @@ update_test_app (void)
arg0 = g_test_build_filename (G_TEST_DIST, "make-test-app.sh", NULL);
argv[0] = arg0;
#ifdef FLATPAK_ENABLE_P2P
argv[3] = repo_collection_id;
#endif /* FLATPAK_ENABLE_P2P */
run_test_subprocess (argv, RUN_TEST_SUBPROCESS_DEFAULT);
}
@@ -1003,10 +981,8 @@ add_remote (void)
g_autofree char *gpgimport = NULL;
g_autofree char *port = NULL;
g_autofree char *pid = NULL;
#ifdef FLATPAK_ENABLE_P2P
g_autofree char *collection_id_arg = NULL;
g_autofree char *argv_str = NULL;
#endif /* FLATPAK_ENABLE_P2P */
launch_httpd ();
@@ -1024,16 +1000,10 @@ add_remote (void)
gpgimport = g_strdup_printf ("--gpg-import=%s/pubring.gpg", gpg_homedir);
repo_url = g_strdup_printf ("http://127.0.0.1:%s/test", port);
#ifdef FLATPAK_ENABLE_P2P
collection_id_arg = g_strdup_printf ("--collection-id=%s", repo_collection_id);
#endif /* FLATPAK_ENABLE_P2P */
argv[3] = gpgimport;
#ifdef FLATPAK_ENABLE_P2P
argv[4] = collection_id_arg;
#else
argv[4] = "--";
#endif /* FLATPAK_ENABLE_P2P */
argv[5] = (char *)repo_name;
argv[6] = repo_url;
run_test_subprocess (argv, RUN_TEST_SUBPROCESS_DEFAULT);
@@ -1092,9 +1062,7 @@ setup_multiple_installations (void)
static void
setup_repo (void)
{
#ifdef FLATPAK_ENABLE_P2P
repo_collection_id = "com.example.Test";
#endif /* FLATPAK_ENABLE_P2P */
make_test_runtime ();
make_test_app ();
@@ -1238,9 +1206,7 @@ main (int argc, char *argv[])
g_test_add_func ("/library/list-remote-refs", test_list_remote_refs);
g_test_add_func ("/library/list-refs", test_list_refs);
g_test_add_func ("/library/install-launch-uninstall", test_install_launch_uninstall);
#ifdef FLATPAK_ENABLE_P2P
g_test_add_func ("/library/list-refs-in-remote", test_list_refs_in_remotes);
#endif /* FLATPAK_ENABLE_P2P */
g_test_add_func ("/library/list-updates", test_list_updates);
global_setup ();