daemon: ensure we consistently use output API
There were places where we were relying on the stdout self read hack to relay messages to clients. Fix those by explicitly using the output API in all spots where the daemon may pass. Really, we should exclusively be using the output API in the daemon and libpriv trees, though many other instances exist for now. Closes: #919 Approved by: cgwalters
This commit is contained in:
parent
7b774cee7e
commit
1fb9dc57c9
@ -233,7 +233,8 @@ clean_pkgcache_orphans (OstreeSysroot *sysroot,
|
||||
if (n_freed > 0 || freed_space > 0)
|
||||
{
|
||||
char *freed_space_str = g_format_size_full (freed_space, 0);
|
||||
g_print ("Freed pkgcache branches: %u size: %s\n", n_freed, freed_space_str);
|
||||
rpmostree_output_message ("Freed pkgcache branches: %u size: %s",
|
||||
n_freed, freed_space_str);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -597,9 +597,9 @@ finalize_removal_overrides (RpmOstreeSysrootUpgrader *self,
|
||||
|
||||
if (inactive_removals->len > 0)
|
||||
{
|
||||
g_print ("Inactive base removals:\n");
|
||||
rpmostree_output_message ("Inactive base removals:");
|
||||
for (guint i = 0; i < inactive_removals->len; i++)
|
||||
g_print (" %s\n", (const char*)inactive_removals->pdata[i]);
|
||||
rpmostree_output_message (" %s", (const char*)inactive_removals->pdata[i]);
|
||||
}
|
||||
|
||||
g_assert (!self->override_remove_packages);
|
||||
@ -646,9 +646,9 @@ finalize_replacement_overrides (RpmOstreeSysrootUpgrader *self,
|
||||
|
||||
if (inactive_replacements->len > 0)
|
||||
{
|
||||
g_print ("Inactive base replacements:\n");
|
||||
rpmostree_output_message ("Inactive base replacements:");
|
||||
for (guint i = 0; i < inactive_replacements->len; i++)
|
||||
g_print (" %s\n", (const char*)inactive_replacements->pdata[i]);
|
||||
rpmostree_output_message (" %s", (const char*)inactive_replacements->pdata[i]);
|
||||
}
|
||||
|
||||
g_assert (!self->override_replace_local_packages);
|
||||
@ -767,9 +767,9 @@ finalize_overlays (RpmOstreeSysrootUpgrader *self,
|
||||
|
||||
if (g_hash_table_size (inactive_requests) > 0)
|
||||
{
|
||||
g_print ("Inactive requests:\n");
|
||||
rpmostree_output_message ("Inactive requests:");
|
||||
GLNX_HASH_TABLE_FOREACH_KV (inactive_requests, const char*, req, const char*, nevra)
|
||||
g_print (" %s (already provided by %s)\n", req, nevra);
|
||||
rpmostree_output_message (" %s (already provided by %s)", req, nevra);
|
||||
}
|
||||
|
||||
g_assert (!self->overlay_packages);
|
||||
|
@ -348,25 +348,26 @@ static void
|
||||
print_commit_diff (CommitDiff *diff)
|
||||
{
|
||||
/* Print out the results of the two diffs */
|
||||
g_print ("Diff Analysis: %s => %s\n", diff->from, diff->to);
|
||||
g_print ("Files:\n modified: %u\n removed: %u\n added: %u\n",
|
||||
diff->modified->len, diff->removed->len, diff->added->len);
|
||||
g_print ("Packages:\n modified: %u\n removed: %u\n added: %u\n",
|
||||
diff->modified_pkgs_new->len, diff->removed_pkgs->len, diff->added_pkgs->len);
|
||||
rpmostree_output_message ("Diff Analysis: %s => %s", diff->from, diff->to);
|
||||
rpmostree_output_message ("Files: modified: %u removed: %u added: %u",
|
||||
diff->modified->len, diff->removed->len, diff->added->len);
|
||||
rpmostree_output_message ("Packages: modified: %u removed: %u added: %u",
|
||||
diff->modified_pkgs_new->len,
|
||||
diff->removed_pkgs->len,
|
||||
diff->added_pkgs->len);
|
||||
|
||||
if (diff->flags & COMMIT_DIFF_FLAGS_ETC)
|
||||
{
|
||||
g_print ("* Configuration changed in /etc\n");
|
||||
rpmostree_output_message ("* Configuration changed in /etc");
|
||||
}
|
||||
if (diff->flags & COMMIT_DIFF_FLAGS_ROOTFS)
|
||||
{
|
||||
g_print ("* Content outside of /usr and /etc is modified\n");
|
||||
rpmostree_output_message ("* Content outside of /usr and /etc is modified");
|
||||
}
|
||||
if (diff->flags & COMMIT_DIFF_FLAGS_BOOT)
|
||||
{
|
||||
g_print ("* Kernel/initramfs changed\n");
|
||||
rpmostree_output_message ("* Kernel/initramfs changed");
|
||||
}
|
||||
fflush (stdout);
|
||||
}
|
||||
|
||||
/* We want to ensure the rollback deployment matches our booted checksum. If it
|
||||
@ -406,7 +407,7 @@ prepare_rollback_deployment (OstreeSysroot *sysroot,
|
||||
if (!ostree_sysroot_prepare_cleanup (sysroot, cancellable, error))
|
||||
return g_prefix_error (error, "Performing initial cleanup: "), FALSE;
|
||||
|
||||
g_print ("Preparing new rollback matching currently booted deployment\n");
|
||||
rpmostree_output_message ("Preparing new rollback matching currently booted deployment");
|
||||
|
||||
if (!ostree_sysroot_deploy_tree (sysroot,
|
||||
ostree_deployment_get_osname (booted_deployment),
|
||||
@ -537,9 +538,9 @@ livefs_transaction_execute_inner (LiveFsTransaction *self,
|
||||
}
|
||||
|
||||
if (resuming_overlay)
|
||||
g_print ("Note: Resuming interrupted overlay of %s\n", target_csum);
|
||||
rpmostree_output_message ("Note: Resuming interrupted overlay of %s", target_csum);
|
||||
if (replacing_overlay)
|
||||
g_print ("Note: Previous overlay: %s\n", replacing_overlay);
|
||||
rpmostree_output_message ("Note: Previous overlay: %s", replacing_overlay);
|
||||
|
||||
/* Look at the difference between the two commits - we could also walk the
|
||||
* filesystem, but doing it at the ostree level is potentially faster, since
|
||||
@ -573,7 +574,7 @@ livefs_transaction_execute_inner (LiveFsTransaction *self,
|
||||
return glnx_throw (error, "Replacement mode not implemented yet");
|
||||
if ((self->flags & RPMOSTREE_TRANSACTION_LIVEFS_FLAG_DRY_RUN) > 0)
|
||||
{
|
||||
g_print ("livefs OK (dry run)\n");
|
||||
rpmostree_output_message ("livefs OK (dry run)");
|
||||
/* Note early return */
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ change_origin_refspec (OstreeSysroot *sysroot,
|
||||
g_strcmp0 (new_remote, current_remote) != 0 &&
|
||||
g_strcmp0 (new_branch, current_branch) == 0;
|
||||
if (switching_only_remote && new_remote != NULL)
|
||||
g_print ("Rebasing to %s:%s\n", new_remote, current_branch);
|
||||
rpmostree_output_message ("Rebasing to %s:%s", new_remote, current_branch);
|
||||
|
||||
if (out_new_refspec != NULL)
|
||||
*out_new_refspec = g_steal_pointer (&new_refspec);
|
||||
@ -1215,7 +1215,7 @@ cleanup_transaction_execute (RpmostreedTransaction *transaction,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_print ("Deployments unchanged.\n");
|
||||
rpmostree_output_message ("Deployments unchanged.");
|
||||
}
|
||||
}
|
||||
if (self->flags & RPMOSTREE_TRANSACTION_CLEANUP_BASE)
|
||||
|
@ -581,11 +581,10 @@ rpmostree_context_setup (RpmOstreeContext *self,
|
||||
|
||||
if (g_variant_dict_lookup (self->spec->dict, "instlangs", "^a&s", &instlangs))
|
||||
{
|
||||
GString *opt = g_string_new ("");
|
||||
char **iter;
|
||||
gboolean first = TRUE;
|
||||
g_autoptr(GString) opt = g_string_new ("");
|
||||
|
||||
for (iter = instlangs; iter && *iter; iter++)
|
||||
gboolean first = TRUE;
|
||||
for (char **iter = instlangs; iter && *iter; iter++)
|
||||
{
|
||||
const char *v = *iter;
|
||||
if (!first)
|
||||
@ -596,7 +595,6 @@ rpmostree_context_setup (RpmOstreeContext *self,
|
||||
}
|
||||
|
||||
dnf_context_set_rpm_macro (self->hifctx, "_install_langs", opt->str);
|
||||
g_string_free (opt, TRUE);
|
||||
}
|
||||
|
||||
/* This is what we use as default. */
|
||||
@ -928,13 +926,13 @@ rpmostree_context_download_metadata (RpmOstreeContext *self,
|
||||
|
||||
g_autoptr(GPtrArray) rpmmd_repos = get_enabled_rpmmd_repos (self->hifctx, DNF_REPO_ENABLED_PACKAGES);
|
||||
|
||||
g_print ("Enabled rpm-md repositories:");
|
||||
g_autoptr(GString) enabled_repos = g_string_new ("Enabled rpm-md repositories:");
|
||||
for (guint i = 0; i < rpmmd_repos->len; i++)
|
||||
{
|
||||
DnfRepo *repo = rpmmd_repos->pdata[i];
|
||||
g_print (" %s", dnf_repo_get_id (repo));
|
||||
g_string_append_printf (enabled_repos, " %s", dnf_repo_get_id (repo));
|
||||
}
|
||||
g_print ("\n");
|
||||
rpmostree_output_message ("%s", enabled_repos->str);
|
||||
|
||||
for (guint i = 0; i < rpmmd_repos->len; i++)
|
||||
{
|
||||
@ -972,8 +970,9 @@ rpmostree_context_download_metadata (RpmOstreeContext *self,
|
||||
else
|
||||
repo_ts_str = g_strdup_printf ("(invalid timestamp)");
|
||||
|
||||
g_print ("rpm-md repo '%s'%s; generated: %s\n", dnf_repo_get_id (repo),
|
||||
!did_update ? " (cached)" : "", repo_ts_str);
|
||||
rpmostree_output_message ("rpm-md repo '%s'%s; generated: %s\n",
|
||||
dnf_repo_get_id (repo), !did_update ? " (cached)" : "",
|
||||
repo_ts_str);
|
||||
}
|
||||
|
||||
{ g_autoptr(DnfState) hifstate = dnf_state_new ();
|
||||
@ -1577,7 +1576,7 @@ rpmostree_context_prepare (RpmOstreeContext *self,
|
||||
!check_goal_solution (self, removed_pkgnames, replaced_nevras, error) ||
|
||||
!sort_packages (self, error))
|
||||
{
|
||||
g_print ("failed\n");
|
||||
rpmostree_output_task_end ("failed");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1675,7 +1674,7 @@ rpmostree_context_download (RpmOstreeContext *self,
|
||||
guint64 size =
|
||||
dnf_package_array_get_download_size (self->pkgs_to_download);
|
||||
g_autofree char *sizestr = g_format_size (size);
|
||||
g_print ("Will download: %u package%s (%s)\n", n, _NS(n), sizestr);
|
||||
rpmostree_output_message ("Will download: %u package%s (%s)", n, _NS(n), sizestr);
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "rpmostree-rpm-util.h"
|
||||
#include "rpmostree-output.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <fnmatch.h>
|
||||
@ -960,8 +961,8 @@ print_pkglist (GPtrArray *pkglist)
|
||||
for (guint i = 0; i < pkglist->len; i++)
|
||||
{
|
||||
DnfPackage *pkg = pkglist->pdata[i];
|
||||
g_print (" %s (%s)\n", dnf_package_get_nevra (pkg),
|
||||
dnf_package_get_reponame (pkg));
|
||||
rpmostree_output_message (" %s (%s)", dnf_package_get_nevra (pkg),
|
||||
dnf_package_get_reponame (pkg));
|
||||
}
|
||||
}
|
||||
|
||||
@ -981,7 +982,7 @@ rpmostree_print_transaction (DnfContext *hifctx)
|
||||
if (packages->len > 0)
|
||||
{
|
||||
empty = FALSE;
|
||||
g_print ("Installing %u packages:\n", packages->len);
|
||||
rpmostree_output_message ("Installing %u packages:", packages->len);
|
||||
print_pkglist (packages);
|
||||
}
|
||||
}
|
||||
@ -995,13 +996,13 @@ rpmostree_print_transaction (DnfContext *hifctx)
|
||||
if (packages->len > 0)
|
||||
{
|
||||
empty = FALSE;
|
||||
g_print ("Removing %u packages:\n", packages->len);
|
||||
rpmostree_output_message ("Removing %u packages:", packages->len);
|
||||
print_pkglist (packages);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty)
|
||||
g_print ("Empty transaction\n");
|
||||
rpmostree_output_message ("Empty transaction");
|
||||
}
|
||||
|
||||
struct _cap_struct {
|
||||
|
Loading…
Reference in New Issue
Block a user