public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/rpkg] 1.70-1: Backport patch for RPM after rhbz#1693751
Date: Mon, 10 Aug 2026 21:44:02 GMT	[thread overview]
Message-ID: <178639824297.1.7413248144163818922.rpms-rpkg-26e277b27b07@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/rpkg
            Branch : 1.70-1
            Commit : 26e277b27b07df3a2603328fda8ffdeb8aca2de9
            Author : Ondřej Nosek <onosek@redhat.com>
            Date   : 2019-04-25T12:54:42+00:00
            Stats  : +59/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpkg/c/26e277b27b07df3a2603328fda8ffdeb8aca2de9?branch=1.70-1

            Log:
            Backport patch for RPM after rhbz#1693751

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

---
diff --git a/0002-Handle-data-from-python-RPM-binding-as-UTF-8-string.patch b/0002-Handle-data-from-python-RPM-binding-as-UTF-8-string.patch
new file mode 100644
index 0000000..473d9f1
--- /dev/null
+++ b/0002-Handle-data-from-python-RPM-binding-as-UTF-8-string.patch
@@ -0,0 +1,52 @@
+From 7f3f4b607948f1babb154b7946813fa6f8edb8fe Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
+Date: Mon, 22 Apr 2019 16:13:24 +0200
+Subject: [PATCH] Handle data from python RPM binding as UTF-8 string
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The RPM python3 bindings return ALL string data as surrogate-escaped
+utf-8 string objects.
+See: https://bugzilla.redhat.com/show_bug.cgi?id=1693751
+
+Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
+---
+ pyrpkg/__init__.py | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py
+index 8fe4ed0..23b1ed7 100644
+--- a/pyrpkg/__init__.py
++++ b/pyrpkg/__init__.py
+@@ -1248,8 +1248,11 @@ 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 hasattr(archlist[0], 'decode'):
+-            return [arch.decode('utf-8') for arch in archlist]
++        if six.PY3:
++            return [str(arch, encoding='utf-8')
++                    if not isinstance(arch, six.string_types)
++                    else arch
++                    for arch in archlist]
+         else:
+             return archlist
+ 
+@@ -1339,10 +1342,10 @@ class Commands(object):
+             hdr = koji.get_rpm_header(srpm)
+             name = hdr[rpm.RPMTAG_NAME]
+             contents = hdr[rpm.RPMTAG_FILENAMES]
+-            if hasattr(name, 'decode'):
++            if six.PY3 and not isinstance(name, six.string_types):
+                 # RPM before rhbz#1693751 returned bytes
+-                name = name.decode('utf-8')
+-                contents = [filename.decode('utf-8')
++                name = str(name, encoding='utf-8')
++                contents = [str(filename, encoding='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 ff9b164..9eac3e2 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -4,7 +4,7 @@
 
 Name:           rpkg
 Version:        1.57
-Release:        8%{?dist}
+Release:        9%{?dist}
 
 Summary:        Python library for interacting with rpm+git
 License:        GPLv2+ and LGPLv2
@@ -28,6 +28,9 @@ 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
 
+# https://pagure.io/rpkg/pull-request/440
+Patch0003:      0002-Handle-data-from-python-RPM-binding-as-UTF-8-string.patch
+
 %if 0%{?fedora} || 0%{?rhel} > 7
 # Enable python3 build by default
 %global with_python3 1
@@ -263,6 +266,9 @@ nosetests tests
 
 
 %changelog
+* Thu Apr 25 2019 Ondřej Nosek <onosek@redhat.com> - 1.57-9
+- yet another compat fix with RPM after rhbz#1693751
+
 * Fri Apr 19 2019 Pavel Raiskup <praiskup@redhat.com> - 1.57-8
 - compat fix with RPM after rhbz#1693751
 

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

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=178639824297.1.7413248144163818922.rpms-rpkg-26e277b27b07@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