From bb624fdd3155d944239eff582323ea7bbb8309f9 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Thu, 23 Jun 2022 22:13:24 -0400 Subject: [PATCH] bundle-uri: add trace regions around downloading bundles These values will be used explicitly during tests, but they can also be informative for users interested in what downloads or copies are happening. Signed-off-by: Derrick Stolee --- bundle-uri.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bundle-uri.c b/bundle-uri.c index 3673c19024ee96..764ce3fdbbae85 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -275,6 +275,8 @@ static int download_https_uri_to_file(const char *file, const char *uri) if (start_command(&cp)) return 1; + trace2_region_enter("bundle-uri", "download_https_uri_to_file", the_repository); + child_in = fdopen(cp.in, "w"); if (!child_in) { result = 1; @@ -312,6 +314,7 @@ static int download_https_uri_to_file(const char *file, const char *uri) return 1; if (child_out) fclose(child_out); + trace2_region_leave("bundle-uri", "download_https_uri_to_file", the_repository); return result; } @@ -320,6 +323,8 @@ static int copy_uri_to_file(const char *filename, int fd, const char *uri) int res, uri_fd; const char *out; + trace2_data_string("bundle-uri", the_repository, "uri", uri); + if (skip_prefix(uri, "https:", &out) || skip_prefix(uri, "http:", &out)) { close(fd); @@ -331,6 +336,7 @@ static int copy_uri_to_file(const char *filename, int fd, const char *uri) out = uri; /* Copy as a file */ + trace2_region_enter("bundle-uri", "copy_file", the_repository); uri_fd = open(out, 0); if (uri_fd < 0) @@ -338,6 +344,7 @@ static int copy_uri_to_file(const char *filename, int fd, const char *uri) res = copy_fd(uri_fd, fd); close(uri_fd); + trace2_region_leave("bundle-uri", "copy_file", the_repository); return res; }