public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpkg] 1.70-1: Backport PR#439
@ 2026-08-10 21:44 Pavel Raiskup
  0 siblings, 0 replies; only message in thread
From: Pavel Raiskup @ 2026-08-10 21:44 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/rpkg
            Branch : 1.70-1
            Commit : 86fbb49476714eaa0e4b1c67000f29adc048dceb
            Author : Pavel Raiskup <praiskup@redhat.com>
            Date   : 2019-04-19T20:09:22+02:00
            Stats  : +64/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpkg/c/86fbb49476714eaa0e4b1c67000f29adc048dceb?branch=1.70-1

            Log:
            Backport PR#439

Version: 1.57-8

---
diff --git a/0001-srpm_import-be-compatible-with-rhbz-1693751.patch b/0001-srpm_import-be-compatible-with-rhbz-1693751.patch
new file mode 100644
index 0000000..ed8e9aa
--- /dev/null
+++ b/0001-srpm_import-be-compatible-with-rhbz-1693751.patch
@@ -0,0 +1,57 @@
+From 3d9523be1ae64a84ce849fa199b3c1e01b3d805b Mon Sep 17 00:00:00 2001
+From: Pavel Raiskup <praiskup@redhat.com>
+Date: Fri, 19 Apr 2019 19:21:02 +0200
+Subject: [PATCH] srpm_import: be compatible with rhbz#1693751
+
+Older RPMs returned 'bytes' objects, newer return 'str'.
+
+If 'str' object is returned on Python 3 - it doesn't need to be
+decoded, and it actually raises error [1]:
+
+    >>> str('', encoding='utf-8')
+    Traceback (most recent call last):
+      File "<stdin>", line 1, in <module>
+    TypeError: decoding str is not supported
+
+This change also OK for Python 2 where str() has decode method
+(str is alternative for bytes).
+
+[1] https://pagure.io/copr/copr/issue/677
+
+Signed-off-by: Pavel Raiskup <praiskup@redhat.com>
+---
+ pyrpkg/__init__.py | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index f1ecc6f..8fe4ed0 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -1248,8 +1248,8 @@ class Commands(object):
+         archlist = [pkg.header['arch'] for pkg in hdr.packages]
+         if not archlist:
+             raise rpkgError('No compatible build arches found in %s' % spec)
+-        if six.PY3:
+-            return [str(arch, encoding='utf-8') for arch in archlist]
++        if hasattr(archlist[0], 'decode'):
++            return [arch.decode('utf-8') for arch in archlist]
+         else:
+             return archlist
+ 
+@@ -1339,9 +1339,10 @@ class Commands(object):
+             hdr = koji.get_rpm_header(srpm)
+             name = hdr[rpm.RPMTAG_NAME]
+             contents = hdr[rpm.RPMTAG_FILENAMES]
+-            if six.PY3:
+-                name = str(name, encoding='utf-8')
+-                contents = [str(filename, encoding='utf-8')
++            if hasattr(name, 'decode'):
++                # RPM before rhbz#1693751 returned bytes
++                name = name.decode('utf-8')
++                contents = [filename.decode('utf-8')
+                             for filename in contents]
+         except Exception as e:
+             raise rpkgError('Error querying srpm: {0}'.format(str(e)))
+-- 
+2.20.1
+

diff --git a/rpkg.spec b/rpkg.spec
index 793481e..ff9b164 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -4,7 +4,7 @@
 
 Name:           rpkg
 Version:        1.57
-Release:        7%{?dist}
+Release:        8%{?dist}
 
 Summary:        Python library for interacting with rpm+git
 License:        GPLv2+ and LGPLv2
@@ -25,6 +25,9 @@ Patch0:         remove-koji-and-rpm-py-installer-from-requires.patch
 # https://pagure.io/rpkg/c/00a89ee07132a0d11ae35ce370cb0579b2b9defe
 Patch0001:      0001-Upload-.crate-files-to-lookaside-cache.patch
 
+# https://pagure.io/rpkg/pull-request/439
+Patch0002:      0001-srpm_import-be-compatible-with-rhbz-1693751.patch
+
 %if 0%{?fedora} || 0%{?rhel} > 7
 # Enable python3 build by default
 %global with_python3 1
@@ -260,6 +263,9 @@ nosetests tests
 
 
 %changelog
+* Fri Apr 19 2019 Pavel Raiskup <praiskup@redhat.com> - 1.57-8
+- compat fix with RPM after rhbz#1693751
+
 * Wed Mar 20 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.57-7
 - Backport patch for uploading *.crate into lookaside
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-10 21:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10 21:44 [rpms/rpkg] 1.70-1: Backport PR#439 Pavel Raiskup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox