Merge pull request #77 from mbarnes/pull-progress
Use ostree_repo_pull_default_console_progress_changed()
This commit is contained in:
commit
31cd8297e7
@ -22,8 +22,6 @@ noinst_LTLIBRARIES += librpmostree.la
|
||||
librpmostree_la_SOURCES = \
|
||||
src/rpmostree-postprocess.c \
|
||||
src/rpmostree-postprocess.h \
|
||||
src/rpmostree-pull-progress.c \
|
||||
src/rpmostree-pull-progress.h \
|
||||
src/rpmostree-json-parsing.c \
|
||||
src/rpmostree-json-parsing.h \
|
||||
src/rpmostree-util.c \
|
||||
|
@ -42,7 +42,7 @@ AC_SUBST(CAP_LIBS)
|
||||
LIBS="$save_LIBS"
|
||||
|
||||
PKG_CHECK_MODULES(PKGDEP_GIO_UNIX, [gio-unix-2.0])
|
||||
PKG_CHECK_MODULES(PKGDEP_RPMOSTREE, [gio-unix-2.0 json-glib-1.0 ostree-1 >= 2014.7 libgsystem rpm hawkey])
|
||||
PKG_CHECK_MODULES(PKGDEP_RPMOSTREE, [gio-unix-2.0 json-glib-1.0 ostree-1 >= 2014.13 libgsystem rpm hawkey])
|
||||
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
||||
|
||||
GOBJECT_INTROSPECTION_REQUIRE([1.34.0])
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "rpmostree-builtins.h"
|
||||
#include "rpmostree-util.h"
|
||||
#include "rpmostree-treepkgdiff.h"
|
||||
#include "rpmostree-pull-progress.h"
|
||||
|
||||
#include "libgsystem.h"
|
||||
|
||||
@ -127,7 +126,7 @@ rpmostree_builtin_rebase (int argc,
|
||||
if (console)
|
||||
{
|
||||
gs_console_begin_status_line (console, "", NULL, NULL);
|
||||
progress = ostree_async_progress_new_and_connect (_rpmostree_pull_progress, console);
|
||||
progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, console);
|
||||
}
|
||||
|
||||
/* Always allow older...there's not going to be a chronological
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include "rpmostree-builtins.h"
|
||||
#include "rpmostree-treepkgdiff.h"
|
||||
#include "rpmostree-pull-progress.h"
|
||||
#include "rpmostree-rpm-util.h"
|
||||
|
||||
#include "libgsystem.h"
|
||||
@ -89,7 +88,7 @@ rpmostree_builtin_upgrade (int argc,
|
||||
if (console)
|
||||
{
|
||||
gs_console_begin_status_line (console, "", NULL, NULL);
|
||||
progress = ostree_async_progress_new_and_connect (_rpmostree_pull_progress, console);
|
||||
progress = ostree_async_progress_new_and_connect (ostree_repo_pull_default_console_progress_changed, console);
|
||||
}
|
||||
|
||||
if (opt_allow_downgrade)
|
||||
|
@ -1,75 +0,0 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
||||
*
|
||||
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the licence or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "rpmostree-pull-progress.h"
|
||||
#include "libgsystem.h"
|
||||
|
||||
void
|
||||
_rpmostree_pull_progress (OstreeAsyncProgress *progress,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSConsole *console = user_data;
|
||||
GString *buf;
|
||||
gs_free char *status = NULL;
|
||||
guint outstanding_fetches;
|
||||
guint outstanding_writes;
|
||||
guint n_scanned_metadata;
|
||||
|
||||
if (!console)
|
||||
return;
|
||||
|
||||
buf = g_string_new ("");
|
||||
|
||||
status = ostree_async_progress_get_status (progress);
|
||||
outstanding_fetches = ostree_async_progress_get_uint (progress, "outstanding-fetches");
|
||||
outstanding_writes = ostree_async_progress_get_uint (progress, "outstanding-writes");
|
||||
n_scanned_metadata = ostree_async_progress_get_uint (progress, "scanned-metadata");
|
||||
if (status)
|
||||
{
|
||||
g_string_append (buf, status);
|
||||
}
|
||||
else if (outstanding_fetches)
|
||||
{
|
||||
guint64 bytes_transferred = ostree_async_progress_get_uint64 (progress, "bytes-transferred");
|
||||
guint fetched = ostree_async_progress_get_uint (progress, "fetched");
|
||||
guint requested = ostree_async_progress_get_uint (progress, "requested");
|
||||
gs_free char *formatted_bytes_transferred =
|
||||
g_format_size_full (bytes_transferred, 0);
|
||||
|
||||
g_string_append_printf (buf, "Receiving objects: %u%% (%u/%u) %s",
|
||||
(guint)((((double)fetched) / requested) * 100),
|
||||
fetched, requested, formatted_bytes_transferred);
|
||||
}
|
||||
else if (outstanding_writes)
|
||||
{
|
||||
g_string_append_printf (buf, "Writing objects: %u", outstanding_writes);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_string_append_printf (buf, "Scanning metadata: %u", n_scanned_metadata);
|
||||
}
|
||||
|
||||
gs_console_begin_status_line (console, buf->str, NULL, NULL);
|
||||
|
||||
g_string_free (buf, TRUE);
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
||||
*
|
||||
* Copyright (C) 2014 Colin Walters <walters@verbum.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the licence or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General
|
||||
* Public License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ostree.h>
|
||||
|
||||
void
|
||||
_rpmostree_pull_progress (OstreeAsyncProgress *progress,
|
||||
gpointer user_data);
|
Loading…
Reference in New Issue
Block a user