public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/rpkg] 1.70-1: A few patches:
Date: Mon, 10 Aug 2026 21:44:44 GMT	[thread overview]
Message-ID: <178639828448.1.16001843247118344549.rpms-rpkg-4d309050b8a6@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/rpkg
            Branch : 1.70-1
            Commit : 4d309050b8a601efc3b290e6f29d3af78daa7228
            Author : Ondřej Nosek <onosek@redhat.com>
            Date   : 2024-09-17T23:47:31+00:00
            Stats  : +153/-6 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpkg/c/4d309050b8a601efc3b290e6f29d3af78daa7228?branch=1.70-1

            Log:
            A few patches:

- Patch: Fixing encoding of the url when checking lookaside
- Patch: Fix package in Pypi

Signed-off-by: Ondřej Nosek <onosek@redhat.com>

---
diff --git a/0004-Fix-package-in-Pypi.patch b/0004-Fix-package-in-Pypi.patch
new file mode 100644
index 0000000..e82222f
--- /dev/null
+++ b/0004-Fix-package-in-Pypi.patch
@@ -0,0 +1,48 @@
+From 69a62d90ccab505bdd95b9817415b93582541d6c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ond=C5=99ej=20Nosek?= <onosek@redhat.com>
+Date: Mon, 8 Jul 2024 02:29:04 +0200
+Subject: [PATCH 1/2] Fix package in Pypi
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The pyrpkg module couldn't be imported.
+Flake8 doesn't need installation of all dependencies - quicker.
+
+Signed-off-by: Ondřej Nosek <onosek@redhat.com>
+---
+ pyproject.toml | 4 ++--
+ tox.ini        | 2 ++
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/pyproject.toml b/pyproject.toml
+index 9d41225..dc4a285 100644
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -83,5 +83,5 @@ include = [
+ 
+ [tool.hatch.build.targets.wheel]
+ packages = [
+-    "dist/rpkg",
++    "pyrpkg",
+ ]
+diff --git a/tox.ini b/tox.ini
+index 3357e2d..2638246 100644
+--- a/tox.ini
++++ b/tox.ini
+@@ -34,10 +34,12 @@ sitepackages=true
+ sitepackages=true
+ 
+ [testenv:flake8]
++skip_install = True
+ deps = flake8
+ commands = python -m flake8 pyrpkg/ tests/
+ 
+ [testenv:flake8python2]
++skip_install = True
+ deps = flake8
+ commands = python -m flake8 pyrpkg/ tests/
+ 
+-- 
+2.46.0
+

diff --git a/0005-Fixing-encoding-of-the-url-when-checking-lookaside.patch b/0005-Fixing-encoding-of-the-url-when-checking-lookaside.patch
new file mode 100644
index 0000000..0801d00
--- /dev/null
+++ b/0005-Fixing-encoding-of-the-url-when-checking-lookaside.patch
@@ -0,0 +1,72 @@
+From 4a1ed7633aad84c8e3bd9e856b5d8d95136a739d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ond=C5=99ej=20Nosek?= <onosek@redhat.com>
+Date: Thu, 12 Sep 2024 00:28:04 +0200
+Subject: [PATCH 2/2] Fixing encoding of the url when checking lookaside
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In RHEL-7 (Python 2.7) encoding of the url was unicode. Curl's
+method 'setopt' expects utf-8.
+
+JIRA: RHELCMP-13939
+
+Signed-off-by: Ondřej Nosek <onosek@redhat.com>
+---
+ pyrpkg/lookaside.py     |  4 +++-
+ tests/test_lookaside.py | 10 ++++++++--
+ 2 files changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/pyrpkg/lookaside.py b/pyrpkg/lookaside.py
+index 72109bf..5929fc9 100644
+--- a/pyrpkg/lookaside.py
++++ b/pyrpkg/lookaside.py
+@@ -167,7 +167,7 @@ class CGILookasideCache(object):
+         self.log.info("Downloading %s from %s", filename, self.download_url)
+         urled_file = urllib.parse.quote(filename)
+         url = self.get_download_url(name, urled_file, hash, hashtype, **kwargs)
+-        if isinstance(url, six.text_type):
++        if six.PY2 and isinstance(url, six.text_type):
+             url = url.encode('utf-8')
+         self.log.debug("Full url: %s", url)
+ 
+@@ -215,6 +215,8 @@ class CGILookasideCache(object):
+ 
+         urled_file = urllib.parse.quote(filename)
+         url = self.get_download_url(name, urled_file, hash, hashtype or self.hashtype)
++        if six.PY2 and isinstance(url, six.text_type):
++            url = url.encode('utf-8')
+ 
+         c = pycurl.Curl()
+         c.setopt(pycurl.URL, url)
+diff --git a/tests/test_lookaside.py b/tests/test_lookaside.py
+index 12da113..6bace2e 100644
+--- a/tests/test_lookaside.py
++++ b/tests/test_lookaside.py
+@@ -112,7 +112,10 @@ class CGILookasideCacheTestCase(unittest.TestCase):
+         lc = CGILookasideCache('sha512', 'http://example.com', '_')
+         lc.download(name, filename, hash, outfile, hashtype='sha512')
+         self.assertEqual(curl.perform.call_count, 1)
+-        self.assertEqual(curlopts[pycurl.URL].decode('utf-8'), full_url)
++        if six.PY2:
++            self.assertEqual(curlopts[pycurl.URL].decode('utf-8'), full_url)
++        else:
++            self.assertEqual(curlopts[pycurl.URL], full_url)
+         self.assertEqual(os.path.getmtime(outfile), 0)
+ 
+         with open(outfile) as f:
+@@ -167,7 +170,10 @@ class CGILookasideCacheTestCase(unittest.TestCase):
+         lc.download(name, filename, hash, outfile, hashtype='sha512',
+                     branch=branch)
+         self.assertEqual(curl.perform.call_count, 1)
+-        self.assertEqual(curlopts[pycurl.URL].decode('utf-8'), full_url)
++        if six.PY2:
++            self.assertEqual(curlopts[pycurl.URL].decode('utf-8'), full_url)
++        else:
++            self.assertEqual(curlopts[pycurl.URL], full_url)
+ 
+     @mock.patch('pyrpkg.lookaside.pycurl.Curl')
+     def test_download_corrupted(self, mock_curl):
+-- 
+2.46.0
+

diff --git a/rpkg.spec b/rpkg.spec
index df1f182..c956f52 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -1,6 +1,6 @@
 Name:           rpkg
 Version:        1.67
-Release:        3%{?dist}
+Release:        4%{?dist}
 
 Summary:        Python library for interacting with rpm+git
 # Automatically converted from old format: GPLv2+ and LGPLv2 - review is highly recommended.
@@ -23,6 +23,13 @@ Source0:        https://pagure.io/releases/rpkg/%{name}-%{version}.tar.gz
 %global with_python3 1
 %endif
 
+# No support for setup.py since Python 3.12 (RHEL 10)
+%if 0%{?rhel} >= 10
+%global with_hatchling 1
+%else
+%global with_hatchling 0
+%endif
+
 
 # Fix for bug 1579367
 # Due to https://pagure.io/koji/issue/912, python[23]-koji package does not
@@ -38,6 +45,8 @@ Patch2:         0002-Remove-pytest-coverage-execution.patch
 %if 0%{?with_python2}
 Patch3:         0003-Remove-Environment-Markers-syntax.patch
 %endif
+Patch4:         0004-Fix-package-in-Pypi.patch
+Patch5:         0005-Fixing-encoding-of-the-url-when-checking-lookaside.patch
 
 
 %description
@@ -124,11 +133,17 @@ BuildRequires:  python3-openidc-client
 BuildRequires:  python3-pycurl
 BuildRequires:  python3-six >= 1.9.0
 BuildRequires:  python3-requests
-BuildRequires:  python3-setuptools
 BuildRequires:  python3-pytest
 BuildRequires:  python3-PyYAML
 BuildRequires:  rpmlint
 BuildRequires:  rpmdevtools
+%if 0%{?with_hatchling}
+BuildRequires:  pyproject-rpm-macros
+BuildRequires:  python3-hatchling
+BuildRequires:  python3-pip
+%else
+BuildRequires:  python3-setuptools
+%endif
 
 Requires:       mock
 Requires:       redhat-rpm-config
@@ -177,18 +192,18 @@ Common files for python2-%{name} and python3-%{name}.
 %prep
 %autosetup -p1
 
-# Removes section from setup.py that is relevant only for pip and
-# is not compatible with in RHEL-6 tools
-sed -i -n '/extras_require/,/}/!p' setup.py
-
 %build
 %if 0%{?with_python2}
 %{__python2} setup.py build
 %endif
 
 %if 0%{?with_python3}
+%if 0%{?with_hatchling}
+%pyproject_wheel
+%else
 %py3_build
 %endif
+%endif
 
 
 %install
@@ -197,8 +212,12 @@ sed -i -n '/extras_require/,/}/!p' setup.py
 %endif
 
 %if 0%{?with_python3}
+%if 0%{?with_hatchling}
+%pyproject_install
+%else
 %py3_install
 %endif
+%endif
 
 
 # Create configuration directory to holding downstream clients config files
@@ -246,8 +265,12 @@ example_cli_dir=$RPM_BUILD_ROOT%{_datadir}/%{name}/examples/cli
 %doc README.rst CHANGELOG.rst
 %license COPYING COPYING-koji LGPL
 %{python3_sitelib}/pyrpkg
+%if 0%{?with_hatchling}
+%{python3_sitelib}/%{name}-%{version}.dist-info
+%else
 %{python3_sitelib}/%{name}-%{version}-py*.egg-info
 %endif
+%endif
 
 %files common
 %{_datadir}/%{name}
@@ -255,6 +278,10 @@ example_cli_dir=$RPM_BUILD_ROOT%{_datadir}/%{name}/examples/cli
 
 
 %changelog
+* Mon Sep 16 2024 Ondřej Nosek <onosek@redhat.com> - 1.67-4
+- Patch: Fixing encoding of the url when checking lookaside
+- Patch: Fix package in Pypi
+
 * Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.67-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
 

             reply	other threads:[~2026-08-10 21:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 21:44  [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-08-10 21:44 [rpms/rpkg] 1.70-1: A few patches: 
2026-08-10 21:44 
2026-08-10 21:44 
2026-08-10 21:44 
2026-08-10 21:44 

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178639828448.1.16001843247118344549.rpms-rpkg-4d309050b8a6@fedoraproject.org \
    --to=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox