Skip to content

Add argument to install debug extension #520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/builder-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static gboolean opt_sandboxed;
static gboolean opt_rebuild_on_sdk_change;
static gboolean opt_skip_if_unchanged;
static gboolean opt_install;
static gboolean opt_install_debug;
static char *opt_state_dir;
static char *opt_from_git;
static char *opt_from_git_branch;
Expand Down Expand Up @@ -134,6 +135,7 @@ static GOptionEntry entries[] = {
{ "from-git-branch", 0, 0, G_OPTION_ARG_STRING, &opt_from_git_branch, "Branch to use in --from-git", "BRANCH"},
{ "mirror-screenshots-url", 0, 0, G_OPTION_ARG_STRING, &opt_mirror_screenshots_url, "Download and rewrite screenshots to match this url", "URL"},
{ "install", 0, 0, G_OPTION_ARG_NONE, &opt_install, "Install if build succeeds", NULL},
{ "install-debug", 0, 0, G_OPTION_ARG_NONE, &opt_install_debug, "Install debug extensions if build succeeds", NULL},
{ "install-deps-from", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_install_deps_from, "Install build dependencies from this remote", "REMOTE"},
{ "install-deps-only", 0, 0, G_OPTION_ARG_NONE, &opt_install_deps_only, "Stop after installing dependencies"},
{ "user", 0, 0, G_OPTION_ARG_NONE, &opt_user, "Install dependencies in user installations", NULL },
Expand Down Expand Up @@ -1001,7 +1003,7 @@ main (int argc,
}

if (!opt_build_only &&
(opt_repo || opt_install) &&
(opt_repo || opt_install || opt_install_debug) &&
(opt_export_only || builder_cache_has_checkout (cache)))
{
g_autoptr(GFile) debuginfo_metadata = NULL;
Expand All @@ -1011,7 +1013,7 @@ main (int argc,

if (opt_repo)
export_repo = g_file_new_for_path (opt_repo);
else if (opt_install)
else if (opt_install || opt_install_debug)
export_repo = g_object_ref (builder_context_get_cache_dir (build_context));

g_print ("Exporting %s to repo\n", builder_manifest_get_id (manifest));
Expand Down Expand Up @@ -1216,6 +1218,19 @@ main (int argc,
return 1;
}
}
if (opt_install_debug)
{
if (export_repo == NULL)
g_printerr ("NOTE: No export due to --require-changes, ignoring --install-debug\n");
else if (!do_install (build_context, flatpak_file_get_path_cached (export_repo),
builder_manifest_get_debug_id (manifest),
builder_manifest_get_branch (manifest, build_context),
&error))
{
g_printerr ("Install failed: %s\n", error->message);
return 1;
}
}

if (!opt_finish_only && !opt_export_only)
prune_unused_stages = TRUE;
Expand Down