- Upgrade to 1.9.3

+ Replace expat with libxml2
  + Support using python-gpg instead of pygpgme
  + Fix major performance regression with libcurl-7.61.1
  + Add zchunk support
- Drop patch for backported fix that is part of this release
  * Patch: 0001-stop-requiring-attr-xattr.patch
- Add patch proposed upstream to fix progress reporting for zck
  * Patch: PR138-Fix-progress-reporting-with-zchunk-files.patch
- Fix RPM group and description for Python 3 subpackage
- Drop Python 2 subpackage

OBS-URL: https://build.opensuse.org/package/show/system:packagemanager:dnf/librepo?expand=0&rev=11
This commit is contained in:
Neal Gompa 2019-02-03 18:10:44 +00:00 committed by Git OBS Bridge
parent eedb4b4b39
commit ba6236d07a
6 changed files with 128 additions and 198 deletions

View File

@ -1,116 +0,0 @@
From 1dff9c2c8271ba7019b9a9a4d3612b6d4ff86b2b Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenko@redhat.com>
Date: Sat, 10 Feb 2018 18:28:28 +0100
Subject: [PATCH] stop requiring attr(xattr)
Latest xattr dropped xattr bits because they are in glibc.
Fixes: https://github.com/rpm-software-management/librepo/issues/121
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
---
CMakeLists.txt | 1 -
cmake/Modules/FindXattr.cmake | 29 -----------------------------
librepo/checksum.c | 3 ++-
librepo/downloader.c | 2 +-
tests/test_checksum.c | 3 ++-
5 files changed, 5 insertions(+), 33 deletions(-)
delete mode 100644 cmake/Modules/FindXattr.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e5c8c2e..90cf9b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,6 @@ PKG_SEARCH_MODULE(LIBCRYPTO REQUIRED libcrypto openssl)
FIND_PACKAGE(EXPAT REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(Gpgme REQUIRED)
-FIND_PACKAGE(Xattr REQUIRED)
INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS})
diff --git a/cmake/Modules/FindXattr.cmake b/cmake/Modules/FindXattr.cmake
deleted file mode 100644
index fce2c56..0000000
--- a/cmake/Modules/FindXattr.cmake
+++ /dev/null
@@ -1,29 +0,0 @@
-# XATTR_FOUND libattr found
-# XATTR_INCLUDE_DIRS include directories
-# XATTR_LIBRARIES libattr library
-
-FIND_PATH(XATTR_INCLUDE attr/xattr.h
- /usr/include
- /usr/local/include
- ${CMAKE_INCLUDE_PATH}
- ${CMAKE_INSTALL_PREFIX}/usr/include
-)
-
-FIND_LIBRARY(XATTR_LIB NAMES attr libattr
- PATHS
- ${CMAKE_LIBRARY_PATH}
- ${CMAKE_INSTALL_PREFIX}/lib
-)
-
-IF(XATTR_INCLUDE AND XATTR_LIB)
- SET(XATTR_FOUND TRUE)
- SET(XATTR_INCLUDE_DIRS ${XATTR_INCLUDE})
- SET(XATTR_LIBRARIES ${XATTR_LIB})
- MESSAGE(STATUS "Found xattr")
-ELSE(XATTR_INCLUDE AND XATTR_LIB)
- SET(XATTR_FOUND FALSE)
- SET(XATTR_LIBRARIES "")
- MESSAGE(STATUS "Not found xattr")
-ENDIF(XATTR_INCLUDE AND XATTR_LIB)
-
-MARK_AS_ADVANCED( XATTR_LIB XATTR_INCLUDE )
diff --git a/librepo/checksum.c b/librepo/checksum.c
index d005397..f55735c 100644
--- a/librepo/checksum.c
+++ b/librepo/checksum.c
@@ -23,10 +23,11 @@
#include <assert.h>
#include <string.h>
#include <ctype.h>
+#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/xattr.h>
#include <unistd.h>
-#include <attr/xattr.h>
#include <openssl/evp.h>
#include "cleanup.h"
diff --git a/librepo/downloader.c b/librepo/downloader.c
index 5995da0..cf4f050 100644
--- a/librepo/downloader.c
+++ b/librepo/downloader.c
@@ -28,9 +28,9 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/xattr.h>
#include <fcntl.h>
#include <curl/curl.h>
-#include <attr/xattr.h>
#include "downloader.h"
#include "downloader_internal.h"
diff --git a/tests/test_checksum.c b/tests/test_checksum.c
index ab75038..023ae55 100644
--- a/tests/test_checksum.c
+++ b/tests/test_checksum.c
@@ -1,12 +1,13 @@
#define _GNU_SOURCE
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/xattr.h>
#include <fcntl.h>
-#include <attr/xattr.h>
#include "librepo/util.h"
#include "librepo/checksum.h"

View File

@ -0,0 +1,81 @@
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:9e15caff6eb9301f53be8a0d9164063ebe9cd6db382d8725d9af6cf363050d5f
size 577845

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

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

View File

@ -1,7 +1,22 @@
-------------------------------------------------------------------
Sun Feb 3 17:23:59 UTC 2019 - Neal Gompa <ngompa13@gmail.com>
- Upgrade to 1.9.3
+ Replace expat with libxml2
+ Support using python-gpg instead of pygpgme
+ Fix major performance regression with libcurl-7.61.1
+ Add zchunk support
- Drop patch for backported fix that is part of this release
* Patch: 0001-stop-requiring-attr-xattr.patch
- Add patch proposed upstream to fix progress reporting for zck
* Patch: PR138-Fix-progress-reporting-with-zchunk-files.patch
- Fix RPM group and description for Python 3 subpackage
- Drop Python 2 subpackage
-------------------------------------------------------------------
Thu Sep 13 13:57:02 UTC 2018 - Jan Engelhardt <jengelh@inai.de>
- Fix RPM gruops. Update descriptions so that librepo0
- Fix RPM groups. Update descriptions so that librepo0
(which is going to be installed most of the time) has something
halfway useful.

View File

@ -2,7 +2,7 @@
# spec file for package librepo
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2018 Neal Gompa <ngompa13@gmail.com>.
# Copyright (c) 2019 Neal Gompa <ngompa13@gmail.com>.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,25 +17,19 @@
#
# Disable python3 due to missing deps
%if 0%{?suse_version} >= 1330
%bcond_without python3
%else
%bcond_with python3
%endif
%bcond_without tests
# The tests involving gpg checks are too unstable and fail randomly
# So the tests are disabled by default for now until this is resolved.
%bcond_with tests
# zchunk is only available in Leap 15.1 and newer
%if 0%{?sle_version} >= 150100 || 0%{?suse_version} >= 1550
%bcond_without zchunk
%endif
%define major 0
%define libname %{name}%{major}
%define devname %{name}-devel
%{!?python2_sitearch: %global python2_sitearch %{python_sitearch}}
Name: librepo
Version: 1.8.1
Version: 1.9.3
Release: 0
Summary: Repodata downloading library
License: LGPL-2.0-or-later
@ -44,23 +38,26 @@ Group: Development/Libraries/C and C++
URL: https://github.com/rpm-software-management/librepo
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
# Backports from upstream
Patch0001: 0001-stop-requiring-attr-xattr.patch
# Patches proposed upstream
# From: https://github.com/rpm-software-management/librepo/pull/138
Patch0101: PR138-Fix-progress-reporting-with-zchunk-files.patch
BuildRequires: check-devel
BuildRequires: cmake
BuildRequires: doxygen
BuildRequires: glib2-devel >= 2.26.0
BuildRequires: gpgme-devel
BuildRequires: libcurl-devel >= 7.19.0
BuildRequires: libexpat-devel
BuildRequires: openssl-devel
%if 0%{?suse_version} >= 1330 || 0%{?leap_version} >= 420300
BuildRequires: python-rpm-macros
BuildRequires: pkgconfig(check)
BuildRequires: pkgconfig(glib-2.0) >= 2.26.0
BuildRequires: pkgconfig(libcurl) >= 7.19.0
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(openssl)
%if %{with zchunk}
BuildRequires: pkgconfig(zck) >= 0.9.11
%endif
BuildRequires: python-rpm-macros
# prevent provides from nonstandard paths:
%global __provides_exclude ^(%{python2_sitearch}/.*\\.so\\|%{python3_sitearch}/.*\\.so)$
%global __provides_exclude ^(%{python3_sitearch}/.*\\.so)$
%description
A library providing C and Python (libcURL like) API for downloading repository
@ -77,36 +74,17 @@ metadata.
%package -n %{devname}
Summary: Header files for the Repodata downloading library
Group: Development/Libraries/C and C++
Provides: %{name}-devel = %{version}-%{release}
Requires: %{libname}%{?_isa} = %{version}-%{release}
%description -n %{devname}
Development files for %{name}.
This package provides the development files for %{name}.
%package -n python2-librepo
Summary: Python bindings for the librepo library
Group: Development/Languages/Python
BuildRequires: python-devel
BuildRequires: python-gpgme
%if %{with tests}
BuildRequires: python-Flask
BuildRequires: python-nose
%endif
BuildRequires: python-Sphinx
BuildRequires: python-xattr
Provides: python-%{name} = %{version}-%{release}
Requires: %{libname}%{?_isa} = %{version}-%{release}
%description -n python2-librepo
Python 2 bindings for the librepo library.
%if %{with python3}
%package -n python3-librepo
Summary: Python 3 bindings for the librepo library
Group: Development/Languages/Python
Group: Development/Libraries/Python
BuildRequires: python3-devel
BuildRequires: python3-gpgme
%if %{with tests}
BuildRequires: python3-gpg
BuildRequires: python3-Flask
BuildRequires: python3-nose
%endif
@ -115,27 +93,14 @@ BuildRequires: python3-xattr
Requires: %{libname}%{?_isa} = %{version}-%{release}
%description -n python3-librepo
Python 3 bindings for the librepo library.
%endif
This package provides the Python 3 bindings for the librepo library.
%prep
%autosetup -p1
%if %{with python3}
rm -rf py3
mkdir py3
%endif
%build
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo
make %{?_smp_mflags}
%if %{with python3}
pushd ../py3
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPYTHON_DESIRED:str=3 ../../
make %{?_smp_mflags}
popd
%endif
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPYTHON_DESIRED:str=3 %{!?with_zchunk:-DWITH_ZCHUNK=OFF}
%make_build
%check
%if %{with tests}
@ -143,30 +108,20 @@ pushd ./build
make ARGS="-V" test
make clean
popd
%if %{with python3}
pushd ./py3/build
make ARGS="-V" test
popd
%endif
%endif
%install
pushd ./build
%make_install
popd
%if %{with python3}
pushd ./py3/build
%make_install
popd
%endif
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files -n %{libname}
%doc COPYING README.md
%doc README.md
%license COPYING
%{_libdir}/librepo.so.%{major}
%files -n %{devname}
@ -174,12 +129,7 @@ popd
%{_libdir}/pkgconfig/librepo.pc
%{_includedir}/librepo/
%files -n python2-librepo
%{python2_sitearch}/librepo
%if %{with python3}
%files -n python3-librepo
%{python3_sitearch}/librepo
%endif
%changelog