Accepting request 690200 from system:packagemanager:dnf

- Add patch to fix fetching zck-compressed repos (rh#1694411)
  * Patch: librepo-PR148-clean-up-curl-target_handle.patch
- Upgrade to 1.9.6
  + Fix progress reporting with zchunk files
  + Reduce download delays by using still_running correctly
  + Improve error handling, cleanup
  + Simplified lr_perform()'s loop to prevent busy wait
  + Require libcurl >= 7.28.0
- Drop patch included in this release
  * Patch: PR138-Fix-progress-reporting-with-zchunk-files.patch

OBS-URL: https://build.opensuse.org/request/show/690200
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/librepo?expand=0&rev=6
This commit is contained in:
Dominique Leuenberger 2019-04-01 10:40:01 +00:00 committed by Git OBS Bridge
commit e43b337708
6 changed files with 53 additions and 88 deletions

View File

@ -1,81 +0,0 @@
From 746c0904d663d2bca38b9dc83708b763c333851b Mon Sep 17 00:00:00 2001
From: Jonathan Dieter <jdieter@gmail.com>
Date: Tue, 1 Jan 2019 15:10:24 +0000
Subject: [PATCH] Fix progress reporting with zchunk files
Currently, when downloading a zchunk file, the progress bar gets reset to
zero when the header is finished downloading. This patch fixes that bug.
Signed-off-by: Jonathan Dieter <jdieter@gmail.com>
---
librepo/downloader.c | 18 ++++++++++++++++++
librepo/downloadtarget.h | 6 ++++++
2 files changed, 24 insertions(+)
diff --git a/librepo/downloader.c b/librepo/downloader.c
index 9724409..53bb5c9 100644
--- a/librepo/downloader.c
+++ b/librepo/downloader.c
@@ -414,6 +414,13 @@ lr_progresscb(void *ptr,
if (!target->target->progresscb)
return ret;
+#ifdef WITH_ZCHUNK
+ if (target->target->is_zchunk) {
+ total_to_download = target->target->total_to_download;
+ now_downloaded = now_downloaded + target->target->downloaded;
+ }
+#endif /* WITH_ZCHUNK */
+
ret = target->target->progresscb(target->target->cbdata,
total_to_download,
now_downloaded);
@@ -1106,6 +1113,7 @@ prep_zck_header(LrTarget *target, GError **err)
target->target->zck_dl = zck_dl_init(zck);
}
target->target->range = zck_get_range(0, target->target->zck_header_size-1);
+ target->target->total_to_download = target->target->zck_header_size;
target->target->resume = 0;
target->zck_state = LR_ZCK_DL_HEADER;
return lr_zck_clear_header(target, err);
@@ -1174,6 +1182,11 @@ find_local_zck_chunks(LrTarget *target, GError **err)
g_slist_free_full(filelist, free);
free(uf);
}
+ target->target->downloaded = target->target->total_to_download;
+ /* Calculate how many bytes need to be downloaded */
+ for(zckChunk *idx = zck_get_first_chunk(zck); idx != NULL; idx = zck_get_next_chunk(idx))
+ if(zck_get_chunk_valid(idx) != 1)
+ target->target->total_to_download += zck_get_chunk_comp_size(idx) + 92; /* Estimate of multipart overhead */
target->zck_state = LR_ZCK_DL_BODY;
return TRUE;
}
@@ -1299,6 +1312,11 @@ check_zck(LrTarget *target, GError **err)
}
}
zck_reset_failed_chunks(zck);
+ /* Recalculate how many bytes remain to be downloaded by subtracting from total_to_download */
+ target->target->downloaded = target->target->total_to_download;
+ for(zckChunk *idx = zck_get_first_chunk(zck); idx != NULL; idx = zck_get_next_chunk(idx))
+ if(zck_get_chunk_valid(idx) != 1)
+ target->target->downloaded -= zck_get_chunk_comp_size(idx) + 92;
return prep_zck_body(target, err);
}
#endif /* WITH_ZCHUNK */
diff --git a/librepo/downloadtarget.h b/librepo/downloadtarget.h
index 59bd1a8..f4c1f26 100644
--- a/librepo/downloadtarget.h
+++ b/librepo/downloadtarget.h
@@ -152,6 +152,12 @@ typedef struct {
gint64 zck_header_size; /*!<
Zchunk header size */
+
+ double total_to_download; /*!<
+ Total to download in zchunk file */
+
+ double downloaded; /*!<
+ Amount already downloaded in zchunk file */
#endif /* WITH_ZCHUNK */
} LrDownloadTarget;

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a6c9504e48e0cc591383eafecc532d7b776bdd2caaf695d23c459855d32576b6
size 810624

3
librepo-1.9.6.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d16ef973c29b93ea82dba1ea92d6979eed0ec322869f445acda11acfa43bba7f
size 810407

View File

@ -0,0 +1,28 @@
From e7d7a50ef8a6c2ac1c3492a15fffaab68546a49f Mon Sep 17 00:00:00 2001
From: Jonathan Dieter <jdieter@gmail.com>
Date: Sun, 31 Mar 2019 18:04:32 +0100
Subject: [PATCH] Clean up target->curl_handle rather than target->handle
Cleaning up target->handle causes a segfault when this codepath is run, so
this patch fixes it so we clean up target->curl_handle
Signed-off-by: Jonathan Dieter <jdieter@gmail.com>
---
librepo/downloader.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/librepo/downloader.c b/librepo/downloader.c
index d7e2d70..9650f07 100644
--- a/librepo/downloader.c
+++ b/librepo/downloader.c
@@ -1451,8 +1451,8 @@ prepare_next_transfer(LrDownload *dd, gboolean *candidatefound, GError **err)
if(target->zck_state == LR_ZCK_DL_FINISHED) {
g_debug("%s: Target already fully downloaded: %s", __func__, target->target->path);
target->state = LR_DS_FINISHED;
- curl_easy_cleanup(target->handle);
- target->handle = NULL;
+ curl_easy_cleanup(target->curl_handle);
+ target->curl_handle = NULL;
g_free(target->headercb_interrupt_reason);
target->headercb_interrupt_reason = NULL;
fclose(target->f);

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Sun Mar 31 18:26:16 UTC 2019 - Neal Gompa <ngompa13@gmail.com>
- Add patch to fix fetching zck-compressed repos (rh#1694411)
* Patch: librepo-PR148-clean-up-curl-target_handle.patch
-------------------------------------------------------------------
Sun Mar 31 15:04:35 UTC 2019 - Neal Gompa <ngompa13@gmail.com>
- Upgrade to 1.9.6
+ Fix progress reporting with zchunk files
+ Reduce download delays by using still_running correctly
+ Improve error handling, cleanup
+ Simplified lr_perform()'s loop to prevent busy wait
+ Require libcurl >= 7.28.0
- Drop patch included in this release
* Patch: PR138-Fix-progress-reporting-with-zchunk-files.patch
-------------------------------------------------------------------
Sun Feb 3 17:23:59 UTC 2019 - Neal Gompa <ngompa13@gmail.com>

View File

@ -29,7 +29,7 @@
%define devname %{name}-devel
Name: librepo
Version: 1.9.3
Version: 1.9.6
Release: 0
Summary: Repodata downloading library
License: LGPL-2.0-or-later
@ -39,15 +39,15 @@ URL: https://github.com/rpm-software-management/librepo
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
# Patches proposed upstream
# From: https://github.com/rpm-software-management/librepo/pull/138
Patch0101: PR138-Fix-progress-reporting-with-zchunk-files.patch
## Clean up target->curl_handle rather than target->handle (rh#1694411)
Patch0101: librepo-PR148-clean-up-curl-target_handle.patch
BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: gpgme-devel
BuildRequires: pkgconfig(check)
BuildRequires: pkgconfig(glib-2.0) >= 2.26.0
BuildRequires: pkgconfig(libcurl) >= 7.19.0
BuildRequires: pkgconfig(libcurl) >= 7.28.0
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(openssl)