[ostree] pull: Display download progress of individual objects as we get it
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] pull: Display download progress of individual objects as we get it
- Date: Fri, 11 Apr 2014 05:59:51 +0000 (UTC)
commit d27c78eab5353286b272fc4375d1fc71f1edd7b5
Author: Colin Walters <walters verbum org>
Date: Fri Apr 11 01:31:14 2014 -0400
pull: Display download progress of individual objects as we get it
It was kind of annoying at least for rpm-ostree upgrades since /boot
happens to be first and we eat a 21MB initramfs with no download
progress.
https://bugzilla.gnome.org/show_bug.cgi?id=726348
src/libostree/ostree-fetcher.c | 25 ++++++++++++++++---------
src/libostree/ostree-repo-pull.c | 1 +
2 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/src/libostree/ostree-fetcher.c b/src/libostree/ostree-fetcher.c
index c3e5803..c8db3a0 100644
--- a/src/libostree/ostree-fetcher.c
+++ b/src/libostree/ostree-fetcher.c
@@ -22,6 +22,8 @@
#include "config.h"
+#include <gio/gfiledescriptorbased.h>
+
#include "ostree-fetcher.h"
#include "ostree.h"
#include "otutil.h"
@@ -240,8 +242,15 @@ on_splice_complete (GObject *object,
goffset filesize;
GError *local_error = NULL;
+ /* Close it here since we do an async fstat(), where we don't want
+ * to hit a bad fd.
+ */
if (pending->out_stream)
- g_hash_table_remove (pending->self->output_stream_set, pending->out_stream);
+ {
+ if (!g_output_stream_close (pending->out_stream, pending->cancellable, &local_error))
+ goto out;
+ g_hash_table_remove (pending->self->output_stream_set, pending->out_stream);
+ }
pending->state = OSTREE_FETCHER_STATE_COMPLETE;
file_info = g_file_query_info (pending->out_tmpfile, OSTREE_GIO_FAST_QUERYINFO,
@@ -283,7 +292,7 @@ on_request_sent (GObject *object,
OstreeFetcherPendingURI *pending = user_data;
GError *local_error = NULL;
gs_unref_object SoupMessage *msg = NULL;
- GOutputStreamSpliceFlags flags = G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET;
+ GOutputStreamSpliceFlags flags = G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE;
pending->state = OSTREE_FETCHER_STATE_COMPLETE;
pending->request_body = soup_request_send_finish ((SoupRequest*) object,
@@ -571,14 +580,12 @@ ostree_fetcher_bytes_transferred (OstreeFetcher *self)
while (g_hash_table_iter_next (&hiter, &key, &value))
{
GFileOutputStream *stream = key;
- GFileInfo *finfo;
-
- finfo = g_file_output_stream_query_info (stream, "standard::size",
- NULL, NULL);
- if (finfo)
+ struct stat stbuf;
+
+ if (G_IS_FILE_DESCRIPTOR_BASED (stream))
{
- ret += g_file_info_get_size (finfo);
- g_object_unref (finfo);
+ if (gs_stream_fstat ((GFileDescriptorBased*)stream, &stbuf, NULL, NULL))
+ ret += stbuf.st_size;
}
}
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index fa50b9b..363c2fe 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -229,6 +229,7 @@ run_mainloop_monitor_fetcher (OtPullData *pull_data)
if (pull_data->progress)
{
update_timeout = g_timeout_source_new_seconds (1);
+ g_source_set_priority (update_timeout, G_PRIORITY_HIGH);
g_source_set_callback (update_timeout, update_progress, pull_data, NULL);
g_source_attach (update_timeout, g_main_loop_get_context (pull_data->loop));
g_source_unref (update_timeout);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]