public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/keychecker] epel10.2: Fix rpm 4.15+ compatibility
@ 2026-08-21  5:12 Carl George
  0 siblings, 0 replies; only message in thread
From: Carl George @ 2026-08-21  5:12 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/keychecker
            Branch : epel10.2
            Commit : 56f994aaf4e45449c33e2d6d2028867f0a0c4c85
            Author : Carl George <carl@george.computer>
            Date   : 2022-01-30T20:10:06-06:00
            Stats  : +87/-8 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/keychecker/c/56f994aaf4e45449c33e2d6d2028867f0a0c4c85?branch=epel10.2

            Log:
            Fix rpm 4.15+ compatibility

Resolves: rhbz#2040673

---
diff --git a/0001-Fix-rpm-4.15-compatibility.patch b/0001-Fix-rpm-4.15-compatibility.patch
new file mode 100644
index 0000000..e3c6306
--- /dev/null
+++ b/0001-Fix-rpm-4.15-compatibility.patch
@@ -0,0 +1,75 @@
+From e1f849707a3632b06cf8d8b8867ca3614ec04978 Mon Sep 17 00:00:00 2001
+From: Carl George <carl@george.computer>
+Date: Sun, 30 Jan 2022 16:30:34 -0600
+Subject: [PATCH] Fix rpm 4.15+ compatibility
+
+Before rpm 4.15, rpm's python3 bindings would return string data as
+bytes.  This script worked around that behavior by proactively decoding
+them, which was a noop on python2, retaining compatibility.  In rpm 4.15
+this behavior was corrected so that string data is returned as utf8
+strings, which had a side effect of breaking our workaround on python3.
+The change was also backported to RHEL as rpm-4.14.2-25.el8, available
+since RHEL 8.1.  The last Fedora release with the old behavior was
+Fedora 30, meaning all OS's with the bytes behavior are EOL.  We can
+just use the strings as is, which works on all current Fedora and RHEL
+releases.
+
+https://github.com/jds2001/keychecker/commit/da993741f78d873f6619384a2c857ec6710aa2fb
+https://github.com/rpm-software-management/rpm/commit/84920f898315d09a57a3f1067433eaeb7de5e830
+https://access.redhat.com/errata/RHBA-2019:3584
+---
+ key_checker.py | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/key_checker.py b/key_checker.py
+index e555c80..83001a0 100755
+--- a/key_checker.py
++++ b/key_checker.py
+@@ -58,7 +58,7 @@ def buildKeyList(file=None):
+     '''Build a dict of public keys in the rpm database'''
+     keys = ts.dbMatch(rpm.RPMTAG_NAME, 'gpg-pubkey')
+     for hdr in keys:
+-        pubkeys[hdr[rpm.RPMTAG_VERSION].decode()] = hdr[rpm.RPMTAG_SUMMARY].decode()[4:-1]
++        pubkeys[hdr[rpm.RPMTAG_VERSION]] = hdr[rpm.RPMTAG_PACKAGER]
+     if file:
+         lines = open(file, 'r').read().splitlines()
+         for line in lines:
+@@ -73,18 +73,18 @@ def getPkgNevra(hdr):
+     '''Return a formatted string of the nevra of a header object'''
+     if hdr[rpm.RPMTAG_EPOCH]:
+         return '{0}-{1}:{2}-{3}.{4}'.format(
+-            hdr[rpm.RPMTAG_NAME].decode(),
++            hdr[rpm.RPMTAG_NAME],
+             hdr[rpm.RPMTAG_EPOCH],
+-            hdr[rpm.RPMTAG_VERSION].decode(),
+-            hdr[rpm.RPMTAG_RELEASE].decode(),
+-            hdr[rpm.RPMTAG_ARCH].decode()
++            hdr[rpm.RPMTAG_VERSION],
++            hdr[rpm.RPMTAG_RELEASE],
++            hdr[rpm.RPMTAG_ARCH]
+         )
+     else:
+         return '{0}-{1}-{2}.{3}'.format(
+-            hdr[rpm.RPMTAG_NAME].decode(),
+-            hdr[rpm.RPMTAG_VERSION].decode(),
+-            hdr[rpm.RPMTAG_RELEASE].decode(),
+-            hdr[rpm.RPMTAG_ARCH].decode()
++            hdr[rpm.RPMTAG_NAME],
++            hdr[rpm.RPMTAG_VERSION],
++            hdr[rpm.RPMTAG_RELEASE],
++            hdr[rpm.RPMTAG_ARCH]
+         )
+ 
+ def getSig(hdr):
+@@ -137,7 +137,7 @@ def getPkg(name=None):
+     exists = False
+     for hdr in mi:
+         exists = True
+-        if hdr[rpm.RPMTAG_NAME].decode() == 'gpg-pubkey':
++        if hdr[rpm.RPMTAG_NAME] == 'gpg-pubkey':
+             continue
+         nevra, key = getSig(hdr)
+         try:
+-- 
+2.34.1
+

diff --git a/keychecker.spec b/keychecker.spec
index 6824f22..d55465e 100644
--- a/keychecker.spec
+++ b/keychecker.spec
@@ -1,19 +1,20 @@
 Name:           keychecker
 Version:        1.0
-Release:        12%{?dist}
+Release:        13%{?dist}
 Summary:        Generate list of installed packages sorted by GPG key
 License:        GPLv2+
 URL:            https://github.com/jds2001/keychecker
 Source0:        %{url}/archive/v%{version}.tar.gz
+
+# https://github.com/jds2001/keychecker/pull/2
+Patch0:         0001-Fix-rpm-4.15-compatibility.patch
+
 BuildArch:      noarch
-%if 0%{?fedora}
+%if %{undefined el7}
 Requires:       python3-rpm
 %else
 Requires:       rpm-python
 %endif
-%if 0%{?rhel} && 0%{?rhel} <= 6
-Requires:       python-argparse
-%endif
 
 
 %description
@@ -21,8 +22,8 @@ Separately list rpm's based on the GPG key they were signed with
 
 
 %prep
-%setup -q
-%if 0%{?fedora}
+%autosetup -p 1
+%if %{undefined el7}
 sed -e '1 s|python|python3|' -i key_checker.py
 %endif
 
@@ -33,11 +34,14 @@ install -Dpm 0755 key_checker.py %{buildroot}%{_bindir}/keychecker
 
 %files
 %license LICENSE
-%doc README known_keys.txt
+%doc README
 %{_bindir}/keychecker
 
 
 %changelog
+* Sun Jan 30 2022 Carl George <carl@george.computer> - 1.0-13
+- Fix rpm 4.15+ compatibility rhbz#2040673
+
 * Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.0-12
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
 

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

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

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-21  5:12 [rpms/keychecker] epel10.2: Fix rpm 4.15+ compatibility Carl George

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