[ostree/wip/metalinks] metalink: A bit more testing, tweak debug logging



commit 7dd74addbbe9a0e4afcf582ad27ffd40feddcd20
Author: Colin Walters <walters verbum org>
Date:   Wed Aug 20 10:38:23 2014 -0400

    metalink: A bit more testing, tweak debug logging

 src/libostree/ostree-repo-pull.c |   15 +++++++--------
 tests/test-pull-metalink.sh      |    7 +++++--
 2 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index 346f059..102fe45 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -367,7 +367,6 @@ typedef struct
   OtPullData             *pull_data;
   SoupURI               **out_target_uri;
   GFile                 **out_data;
-  gboolean                running;
   gboolean                success;
 } FetchMetalinkSyncData;
 
@@ -381,7 +380,7 @@ on_metalink_fetched (GObject          *src,
   data->success = _ostree_metalink_request_finish ((OstreeMetalink*)src, result,
                                                    data->out_target_uri, data->out_data,
                                                    data->pull_data->async_error);
-  data->running = FALSE;
+  g_main_loop_quit (data->pull_data->loop);
 }
 
 static gboolean
@@ -397,13 +396,11 @@ request_metalink_sync (OtPullData             *pull_data,
   data.pull_data = pull_data;
   data.out_target_uri = out_target_uri;
   data.out_data = out_data;
-  data.running = TRUE;
 
   pull_data->fetching_sync_uri = _ostree_metalink_get_uri (metalink);
   _ostree_metalink_request_async (metalink, cancellable, on_metalink_fetched, &data);
   
-  while (data.running)
-    g_main_context_iteration (NULL, TRUE);
+  run_mainloop_monitor_fetcher (pull_data);
 
   return data.success;
 }
@@ -726,7 +723,8 @@ meta_fetch_on_complete (GObject           *object,
   GError **error = &local_error;
 
   ostree_object_name_deserialize (fetch_data->object, &checksum, &objtype);
-  g_debug ("fetch of %s complete", ostree_object_to_string (checksum, objtype));
+  g_debug ("fetch of %s%s complete", ostree_object_to_string (checksum, objtype),
+           fetch_data->is_detached_meta ? " (detached)" : "");
 
   temp_path = _ostree_fetcher_request_uri_with_partial_finish ((OstreeFetcher*)object, result, error);
   if (!temp_path)
@@ -935,8 +933,9 @@ enqueue_one_object_request (OtPullData        *pull_data,
   FetchObjectData *fetch_data;
   gs_free char *objpath = NULL;
 
-  g_debug ("queuing fetch of %s.%s", checksum,
-           ostree_object_type_to_string (objtype));
+  g_debug ("queuing fetch of %s.%s%s", checksum,
+           ostree_object_type_to_string (objtype),
+           is_detached_meta ? " (detached)" : "");
 
   if (is_detached_meta)
     {
diff --git a/tests/test-pull-metalink.sh b/tests/test-pull-metalink.sh
index 69bfc2c..3d68578 100755
--- a/tests/test-pull-metalink.sh
+++ b/tests/test-pull-metalink.sh
@@ -35,6 +35,8 @@ ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo summary -u
 
 summary_path=${test_tmpdir}/ostree-srv/gnomerepo/summary
 
+echo -n broken > ${summary_path}.bad
+
 echo '1..1'
 cd ${test_tmpdir}
 
@@ -50,8 +52,9 @@ cat > ${test_tmpdir}/metalink-data/metalink.xml <<EOF
         <hash type="sha512">$(sha512sum ${summary_path} | cut -f 1 -d ' ')</hash>
       </verification>
       <resources maxconnections="1">
-        <url protocol="http" type="http" location="US" preference="100" >$(cat 
httpd-address)/ostree/gnomerepo/enoent</url>
-        <url protocol="http" type="http" location="US" preference="99" >$(cat 
httpd-address)/ostree/gnomerepo/summary</url>
+        <url protocol="http" type="http" location="US" preference="100" >$(cat 
httpd-address)/ostree/gnomerepo/summary.bad</url>
+        <url protocol="http" type="http" location="US" preference="99" >$(cat 
httpd-address)/ostree/gnomerepo/nosuchfile</url>
+        <url protocol="http" type="http" location="US" preference="98" >$(cat 
httpd-address)/ostree/gnomerepo/summary</url>
       </resources>
     </file>
   </files>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]