Update to 1.11.3

This commit is contained in:
Aleš Matěj 2020-04-01 12:25:28 +02:00
parent 5b935af0c7
commit 06d059ccba
5 changed files with 8 additions and 144 deletions

1
.gitignore vendored
View File

@ -54,3 +54,4 @@
/librepo-1.10.6.tar.gz
/librepo-1.11.0.tar.gz
/librepo-1.11.1.tar.gz
/librepo-1.11.3.tar.gz

111
179.patch
View File

@ -1,111 +0,0 @@
From 34450c11255f7ae19ecda92f9bb4ff2b5adf498b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhrazky@redhat.com>
Date: Thu, 16 Jan 2020 16:36:11 +0100
Subject: [PATCH] Fix calling Python API without holding GIL (RhBug:1788918)
Librepo releases GIL for the download operations, but it wasn't taking
it again early enough in some callbacks where Python API is being called.
This commit moves taking the GIL in the callbacks to before any Python
API is called.
https://bugzilla.redhat.com/show_bug.cgi?id=1788918
---
librepo/python/handle-py.c | 6 ++++--
librepo/python/metadatatarget-py.c | 6 ++++--
librepo/python/packagetarget-py.c | 6 ++++--
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/librepo/python/handle-py.c b/librepo/python/handle-py.c
index 28aad87..02615ad 100644
--- a/librepo/python/handle-py.c
+++ b/librepo/python/handle-py.c
@@ -142,6 +142,8 @@ fastestmirror_callback(void *data, LrFastestMirrorStages stage, void *ptr)
else
user_data = Py_None;
+ EndAllowThreads(self->state);
+
if (!ptr) {
pydata = Py_None;
} else {
@@ -159,7 +161,6 @@ fastestmirror_callback(void *data, LrFastestMirrorStages stage, void *ptr)
}
}
- EndAllowThreads(self->state);
result = PyObject_CallFunction(self->fastestmirror_cb,
"(OlO)", user_data, (long) stage, pydata);
Py_XDECREF(result);
@@ -187,11 +188,12 @@ hmf_callback(void *data, const char *msg, const char *url, const char *metadata)
else
user_data = Py_None;
+ EndAllowThreads(self->state);
+
py_msg = PyStringOrNone_FromString(msg);
py_url = PyStringOrNone_FromString(url);
py_metadata = PyStringOrNone_FromString(metadata);
- EndAllowThreads(self->state);
result = PyObject_CallFunction(self->hmf_cb,
"(OOOO)", user_data, py_msg, py_url, py_metadata);
diff --git a/librepo/python/metadatatarget-py.c b/librepo/python/metadatatarget-py.c
index d5f4088..4cb67ad 100644
--- a/librepo/python/metadatatarget-py.c
+++ b/librepo/python/metadatatarget-py.c
@@ -142,10 +142,11 @@ metadatatarget_mirrorfailure_callback(void *data,
else
user_data = Py_None;
+ EndAllowThreads(self->state);
+
py_msg = PyStringOrNone_FromString(msg);
py_url = PyStringOrNone_FromString(url);
- EndAllowThreads(self->state);
result = PyObject_CallFunction(self->mirrorfailure_cb,
"(OOO)", user_data, py_msg, py_url);
@@ -205,9 +206,10 @@ metadatatarget_end_callback(void *data,
else
user_data = Py_None;
+ EndAllowThreads(self->state);
+
py_msg = PyStringOrNone_FromString(msg);
- EndAllowThreads(self->state);
result = PyObject_CallFunction(self->end_cb,
"(OiO)", user_data, status, py_msg);
Py_DECREF(py_msg);
diff --git a/librepo/python/packagetarget-py.c b/librepo/python/packagetarget-py.c
index 839ec8c..f5182dd 100644
--- a/librepo/python/packagetarget-py.c
+++ b/librepo/python/packagetarget-py.c
@@ -134,9 +134,10 @@ packagetarget_end_callback(void *data,
else
user_data = Py_None;
+ EndAllowThreads(self->state);
+
py_msg = PyStringOrNone_FromString(msg);
- EndAllowThreads(self->state);
result = PyObject_CallFunction(self->end_cb,
"(OiO)", user_data, status, py_msg);
Py_DECREF(py_msg);
@@ -185,10 +186,11 @@ packagetarget_mirrorfailure_callback(void *data,
else
user_data = Py_None;
+ EndAllowThreads(self->state);
+
py_msg = PyStringOrNone_FromString(msg);
py_url = PyStringOrNone_FromString(url);
- EndAllowThreads(self->state);
result = PyObject_CallFunction(self->mirrorfailure_cb,
"(OOO)", user_data, py_msg, py_url);

View File

@ -1,27 +0,0 @@
From c7d2f38c06039798f998c7c83685b1b44ffd24d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhrazky@redhat.com>
Date: Thu, 16 Jan 2020 17:32:29 +0100
Subject: [PATCH] Do not unref LrErr_Exception on exit (RhBug:1778854)
It seems the reference to a Python exception obtained from
PyErr_NewException is borrowed and is not meant to be decref'd on
exit. From valgrind output Python frees the memory allocated for these
itself.
https://bugzilla.redhat.com/show_bug.cgi?id=1778854
---
librepo/python/librepomodule.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/librepo/python/librepomodule.c b/librepo/python/librepomodule.c
index 231a8cf..3d52893 100644
--- a/librepo/python/librepomodule.c
+++ b/librepo/python/librepomodule.c
@@ -134,7 +134,6 @@ exit_librepo(void)
{
Py_XDECREF(debug_cb);
Py_XDECREF(debug_cb_data);
- Py_XDECREF(LrErr_Exception);
}
struct module_state {

View File

@ -26,16 +26,13 @@
%global dnf_conflict 2.8.8
Name: librepo
Version: 1.11.1
Release: 4%{?dist}
Version: 1.11.3
Release: 1%{?dist}
Summary: Repodata downloading library
License: LGPLv2+
URL: https://github.com/rpm-software-management/librepo
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch01: 180.patch
# fixes failing build with Python 3.9, bz1788918
Patch02: 179.patch
BuildRequires: cmake
BuildRequires: gcc
@ -192,6 +189,10 @@ popd
%endif
%changelog
* Wed Apr 01 2020 Ales Matej <amatej@fedoraproject.org> - 1.11.3-1
- Update to 1.11.3
- Prefer mirrorlist/metalink over baseurl (RhBug:1775184)
* Mon Feb 10 2020 Ales Matej <amatej@fedoraproject.org> - 1.11.1-4
- Fix calling Python API without holding GIL (RhBug:1788918)

View File

@ -1 +1 @@
SHA512 (librepo-1.11.1.tar.gz) = e804f93521506c3cc42631a947114f29a36330f9fe8052b72c86bc75ef21d3ccc4a11d9ebe35cf85b7e18eb06a1c92341ff5df22d1f0a125d2762204f59435ac
SHA512 (librepo-1.11.3.tar.gz) = 9d1b63ec9ba089024f5d65c9d09bc56af40f5fcbb6cce6bf20b44f1acc53ac4f3d26ea9a077f7270e0a6b4b596a4fba2f2ba8dea053cc8c8a04e057331ee3c39