From 14bb193dcedd7c181b7398dd3e7dd091b73156a6b3e54f4bc60d467681169c6c Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 3 Mar 2023 08:00:26 +0000 Subject: [PATCH 1/2] Accepting request 1068653 from home:PSuarezHernandez:branches:devel:languages:python - Raise proper exception from urlgrab() when local file is not found (bsc#1208288) - Added: * fix-urlgrab-file-schema-comparison.patch OBS-URL: https://build.opensuse.org/request/show/1068653 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-urlgrabber?expand=0&rev=50 --- fix-urlgrab-file-schema-comparison.patch | 26 ++++++++++++++++++++++++ python-urlgrabber.changes | 8 ++++++++ python-urlgrabber.spec | 4 +++- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 fix-urlgrab-file-schema-comparison.patch diff --git a/fix-urlgrab-file-schema-comparison.patch b/fix-urlgrab-file-schema-comparison.patch new file mode 100644 index 0000000..b7be552 --- /dev/null +++ b/fix-urlgrab-file-schema-comparison.patch @@ -0,0 +1,26 @@ +From 779f65c1845968b59e5bfa21cf0468ba3664271b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= + +Date: Wed, 1 Mar 2023 14:00:08 +0000 +Subject: [PATCH] Fix comparison to work with expected bytes string + +The urlgrab function initially coverts given url to bytes string +via the _to_utf8() helper. This make "url" parameter to be bytes, +and therefore we need to fix the this comparison +--- + urlgrabber/grabber.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: urlgrabber-4.1.0/urlgrabber/grabber.py +=================================================================== +--- urlgrabber-4.1.0.orig/urlgrabber/grabber.py ++++ urlgrabber-4.1.0/urlgrabber/grabber.py +@@ -1210,7 +1210,7 @@ class URLGrabber(object): + if not filename: + # This is better than nothing. + filename = 'index.html' +- if scheme == 'file' and not opts.copy_local: ++ if scheme == b'file' and not opts.copy_local: + # just return the name of the local file - don't make a + # copy currently + path = url2pathname(path) diff --git a/python-urlgrabber.changes b/python-urlgrabber.changes index d95a14b..a776a74 100644 --- a/python-urlgrabber.changes +++ b/python-urlgrabber.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Mar 1 16:29:38 UTC 2023 - Pablo Suárez Hernández + +- Raise proper exception from urlgrab() when local file is not found (bsc#1208288) + +- Added: + * fix-urlgrab-file-schema-comparison.patch + ------------------------------------------------------------------- Wed Aug 3 14:30:01 UTC 2022 - Pablo Suárez Hernández diff --git a/python-urlgrabber.spec b/python-urlgrabber.spec index 9a65884..9d7fa85 100644 --- a/python-urlgrabber.spec +++ b/python-urlgrabber.spec @@ -1,7 +1,7 @@ # # spec file for package python-urlgrabber # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -32,6 +32,8 @@ Patch0: use-binary-mode-when-reopening-files.patch Patch1: fix_find_proxy_logic_and_drop_six.patch # PATCH-FIX_UPSTREAM https://github.com/rpm-software-management/urlgrabber/pull/34 Patch2: avoid_crashing_when_urlgrabber_debug_enabled.patch +# PATCH-FIX_UPSTREAM https://github.com/rpm-software-management/urlgrabber/pull/37 +Patch3: fix-urlgrab-file-schema-comparison.patch BuildRequires: %{python_module pycurl} BuildRequires: %{python_module setuptools} From a75e2e95183b2fe2b75b0a8701b818c55531dc8f2875b577d9e3bed1074492d5 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 3 Mar 2023 08:08:05 +0000 Subject: [PATCH 2/2] - Clean up SPEC file OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-urlgrabber?expand=0&rev=51 --- python-urlgrabber.changes | 5 +++++ python-urlgrabber.spec | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/python-urlgrabber.changes b/python-urlgrabber.changes index a776a74..0882313 100644 --- a/python-urlgrabber.changes +++ b/python-urlgrabber.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Mar 3 08:07:59 UTC 2023 - Matej Cepl + +- Clean up SPEC file + ------------------------------------------------------------------- Wed Mar 1 16:29:38 UTC 2023 - Pablo Suárez Hernández diff --git a/python-urlgrabber.spec b/python-urlgrabber.spec index 9d7fa85..4982116 100644 --- a/python-urlgrabber.spec +++ b/python-urlgrabber.spec @@ -16,7 +16,6 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %define modname urlgrabber Name: python-urlgrabber Version: 4.1.0 @@ -26,13 +25,13 @@ License: LGPL-2.1-only Group: Development/Libraries/Python URL: https://github.com/rpm-software-management/urlgrabber Source: https://github.com/rpm-software-management/%{modname}/releases/download/%{modname}-4-1-0/%{modname}-%{version}.tar.gz -# PATCH-FIX_UPSTREAM https://github.com/rpm-software-management/urlgrabber/pull/32 +# PATCH-FIX_UPSTREAM gh#rpm-software-management/urlgrabber!32 Patch0: use-binary-mode-when-reopening-files.patch -# PATCH-FIX_UPSTREAM https://github.com/rpm-software-management/urlgrabber/pull/35 +# PATCH-FIX_UPSTREAM gh#rpm-software-management/urlgrabber!35 Patch1: fix_find_proxy_logic_and_drop_six.patch -# PATCH-FIX_UPSTREAM https://github.com/rpm-software-management/urlgrabber/pull/34 +# PATCH-FIX_UPSTREAM gh#rpm-software-management/urlgrabber!34 Patch2: avoid_crashing_when_urlgrabber_debug_enabled.patch -# PATCH-FIX_UPSTREAM https://github.com/rpm-software-management/urlgrabber/pull/37 +# PATCH-FIX_UPSTREAM gh#rpm-software-management/urlgrabber!37 Patch3: fix-urlgrab-file-schema-comparison.patch BuildRequires: %{python_module pycurl} @@ -76,12 +75,16 @@ rm -rf %{buildroot}%{_datadir}/doc/urlgrabber-%{version} # Remove wrongly instal %postun %python_uninstall_alternative urlgrabber +if [ ! -f %{_libexecdir}/urlgrabber-ext-down ] ; then + update-alternatives --remove urlgrabber-ext-down %{_libexecdir}/urlgrabber-ext-down +fi %files %{python_files} %license LICENSE %doc ChangeLog README TODO %python_alternative %{_bindir}/urlgrabber %python_alternative %{_libexecdir}/urlgrabber-ext-down -%{python_sitelib}/* +%{python_sitelib}/urlgrabber +%{python_sitelib}/urlgrabber-%{version}*-info %changelog