Commit df5328ef authored by Christian Hergert's avatar Christian Hergert
Browse files

flatpak: remove old pipeline stages

These are handled before pipeline setup, so no need for them now.
parent 90561cab
......@@ -78,167 +78,6 @@ register_mkdirs_stage (GbpFlatpakPipelineAddin *self,
return TRUE;
}
static gboolean
register_remotes_stage (GbpFlatpakPipelineAddin *self,
IdeBuildPipeline *pipeline,
IdeContext *context,
GError **error)
{
g_autoptr(IdeBuildStage) stage = NULL;
g_autoptr(IdeSubprocessLauncher) launcher = NULL;
IdeConfiguration *config;
IdeRuntime *runtime;
const gchar *branch;
const gchar *platform;
const gchar *sdk;
const gchar *repo_name = NULL;
const gchar *repo_path = NULL;
guint stage_id;
g_assert (GBP_IS_FLATPAK_PIPELINE_ADDIN (self));
g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
g_assert (IDE_IS_CONTEXT (context));
config = ide_build_pipeline_get_configuration (pipeline);
runtime = ide_configuration_get_runtime (config);
if (!GBP_IS_FLATPAK_RUNTIME (runtime))
{
g_set_error (error,
GB_FLATPAK_PIPELINE_ERROR,
GB_FLATPAK_PIPELINE_ERROR_WRONG_RUNTIME,
"Configuration changed to a non-flatpak runtime during pipeline initialization");
return FALSE;
}
platform = gbp_flatpak_runtime_get_platform (GBP_FLATPAK_RUNTIME (runtime));
sdk = gbp_flatpak_runtime_get_sdk (GBP_FLATPAK_RUNTIME (runtime));
branch = gbp_flatpak_runtime_get_branch (GBP_FLATPAK_RUNTIME (runtime));
if (ide_str_equal0 (platform, "org.gnome.Platform") ||
ide_str_equal0 (platform, "org.gnome.Sdk") ||
ide_str_equal0 (sdk, "org.gnome.Platform") ||
ide_str_equal0 (sdk, "org.gnome.Sdk"))
{
if (ide_str_equal0 (branch, "master"))
{
repo_name = "gnome-nightly";
repo_path = "https://sdk.gnome.org/gnome-nightly.flatpakrepo";
}
else
{
repo_name = "gnome";
repo_path = "https://sdk.gnome.org/gnome.flatpakrepo";
}
}
if (repo_name == NULL || repo_path == NULL)
return TRUE;
launcher = create_subprocess_launcher ();
ide_subprocess_launcher_push_argv (launcher, "flatpak");
ide_subprocess_launcher_push_argv (launcher, "remote-add");
ide_subprocess_launcher_push_argv (launcher, "--user");
ide_subprocess_launcher_push_argv (launcher, "--if-not-exists");
ide_subprocess_launcher_push_argv (launcher, "--from");
ide_subprocess_launcher_push_argv (launcher, repo_name);
ide_subprocess_launcher_push_argv (launcher, repo_path);
stage = g_object_new (IDE_TYPE_BUILD_STAGE_LAUNCHER,
"launcher", launcher,
"context", context,
NULL);
stage_id = ide_build_pipeline_connect (pipeline, IDE_BUILD_PHASE_PREPARE, PREPARE_REMOTES, stage);
ide_build_pipeline_addin_track (IDE_BUILD_PIPELINE_ADDIN (self), stage_id);
return TRUE;
}
static void
check_if_installed (IdeBuildStageTransfer *stage,
IdeBuildPipeline *pipeline,
GCancellable *cancellable,
GbpFlatpakTransfer *transfer)
{
gboolean installed;
g_assert (IDE_IS_BUILD_STAGE_TRANSFER (stage));
g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
g_assert (GBP_IS_FLATPAK_TRANSFER (transfer));
installed = gbp_flatpak_transfer_is_installed (transfer, cancellable);
ide_build_stage_set_completed (IDE_BUILD_STAGE (stage), installed);
}
static gboolean
register_download_stage (GbpFlatpakPipelineAddin *self,
IdeBuildPipeline *pipeline,
IdeContext *context,
GError **error)
{
IdeConfiguration *config;
IdeRuntime *runtime;
const gchar *items[2] = { NULL };
const gchar *platform;
const gchar *sdk;
const gchar *branch;
guint stage_id;
g_assert (GBP_IS_FLATPAK_PIPELINE_ADDIN (self));
g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
config = ide_build_pipeline_get_configuration (pipeline);
runtime = ide_configuration_get_runtime (config);
if (!GBP_IS_FLATPAK_RUNTIME (runtime))
{
g_set_error (error,
GB_FLATPAK_PIPELINE_ERROR,
GB_FLATPAK_PIPELINE_ERROR_WRONG_RUNTIME,
"Configuration changed to a non-flatpak runtime during pipeline initialization");
return FALSE;
}
platform = gbp_flatpak_runtime_get_platform (GBP_FLATPAK_RUNTIME (runtime));
sdk = gbp_flatpak_runtime_get_sdk (GBP_FLATPAK_RUNTIME (runtime));
branch = gbp_flatpak_runtime_get_branch (GBP_FLATPAK_RUNTIME (runtime));
items[0] = platform;
items[1] = sdk;
for (guint i = 0; i < G_N_ELEMENTS (items); i++)
{
g_autoptr(IdeBuildStage) stage = NULL;
g_autoptr(GbpFlatpakTransfer) transfer = NULL;
const gchar *id = items[i];
if (id == NULL)
continue;
transfer = gbp_flatpak_transfer_new (context, id, NULL, branch, FALSE);
stage = g_object_new (IDE_TYPE_BUILD_STAGE_TRANSFER,
"context", context,
"transfer", transfer,
NULL);
g_signal_connect_object (stage,
"query",
G_CALLBACK (check_if_installed),
transfer,
0);
stage_id = ide_build_pipeline_connect (pipeline, IDE_BUILD_PHASE_DOWNLOADS, i, stage);
ide_build_pipeline_addin_track (IDE_BUILD_PIPELINE_ADDIN (self), stage_id);
}
return TRUE;
}
static void
check_if_file_exists (IdeBuildStage *stage,
IdeBuildPipeline *pipeline,
......@@ -533,9 +372,7 @@ gbp_flatpak_pipeline_addin_load (IdeBuildPipelineAddin *addin,
context = ide_object_get_context (IDE_OBJECT (self));
if (!register_mkdirs_stage (self, pipeline, context, &error) ||
!register_remotes_stage (self, pipeline, context, &error) ||
!register_build_init_stage (self, pipeline, context, &error) ||
!register_download_stage (self, pipeline, context, &error) ||
!register_dependencies_stage (self, pipeline, context, &error) ||
!register_build_finish_stage (self, pipeline, context, &error))
g_warning ("%s", error->message);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment