52c9006a4d
These changes were submitted upstream for review: https://github.com/rpm-software-management/rpmlint/pull/1066 The changes are backward compatible as far back as rpm-4.12¹. ¹ As long as I've read the rpm commit history properly, that is.
83 lines
3.0 KiB
Diff
83 lines
3.0 KiB
Diff
From c228e8edcdc64e6e2877b48da4c43dbeae124c23 Mon Sep 17 00:00:00 2001
|
|
From: Todd Zullinger <tmz@pobox.com>
|
|
Date: Thu, 25 May 2023 14:11:56 -0400
|
|
Subject: [PATCH] rpmdiff: adjust for rpm-4.19.0 API changes
|
|
|
|
The `fiFromHeader()` method has been removed from rpm-4.19.0, in rpm
|
|
commit 742be88cd (Drop the klunky and ugly rpm.fi python binding
|
|
finally, 2022-04-08)
|
|
|
|
It has (apparently) been deprecated since rpm commit f0c3985a7 (Make
|
|
fiFromHeader() static inside header-py, deprecate, 2009-09-23).
|
|
|
|
Use `rpm.files()` instead, which was added in rpm commit 3b086277b (New
|
|
rpmfile[s] python bindings, 2013-12-18). This was released in
|
|
rpm-4.12.0.
|
|
---
|
|
rpmlint/rpmdiff.py | 33 +++++++++++++++------------------
|
|
1 file changed, 15 insertions(+), 18 deletions(-)
|
|
|
|
diff --git a/rpmlint/rpmdiff.py b/rpmlint/rpmdiff.py
|
|
index 34249ba3..a9e972bd 100644
|
|
--- a/rpmlint/rpmdiff.py
|
|
+++ b/rpmlint/rpmdiff.py
|
|
@@ -21,19 +21,17 @@ class Rpmdiff:
|
|
PRCO = ('REQUIRES', 'PROVIDES', 'CONFLICTS', 'OBSOLETES',
|
|
'RECOMMENDS', 'SUGGESTS', 'ENHANCES', 'SUPPLEMENTS')
|
|
|
|
- # {fname : (size, mode, mtime, flags, dev, inode,
|
|
- # nlink, state, vflags, user, group, digest)}
|
|
- __FILEIDX = [['S', 0],
|
|
- ['M', 1],
|
|
- ['5', 11],
|
|
- ['D', 4],
|
|
- ['N', 6],
|
|
- ['L', 7],
|
|
- ['V', 8],
|
|
- ['U', 9],
|
|
- ['G', 10],
|
|
- ['F', 3],
|
|
- ['T', 2]]
|
|
+ __FILEIDX = [['S', 'size'],
|
|
+ ['M', 'mode'],
|
|
+ ['5', 'digest'],
|
|
+ ['D', 'rdev'],
|
|
+ ['N', 'nlink'],
|
|
+ ['L', 'state'],
|
|
+ ['V', 'vflags'],
|
|
+ ['U', 'user'],
|
|
+ ['G', 'group'],
|
|
+ ['F', 'fflags'],
|
|
+ ['T', 'mtime']]
|
|
|
|
DEPFORMAT = '%-12s%s %s %s %s'
|
|
FORMAT = '%-12s%s'
|
|
@@ -78,9 +76,8 @@ class Rpmdiff:
|
|
self.__comparePRCOs(old, new, tag)
|
|
|
|
# compare the files
|
|
-
|
|
- old_files_dict = self.__fileIteratorToDict(old.fiFromHeader())
|
|
- new_files_dict = self.__fileIteratorToDict(new.fiFromHeader())
|
|
+ old_files_dict = self.__fileIteratorToDict(rpm.files(old))
|
|
+ new_files_dict = self.__fileIteratorToDict(rpm.files(new))
|
|
files = list(set(chain(iter(old_files_dict), iter(new_files_dict))))
|
|
files.sort()
|
|
|
|
@@ -101,7 +98,7 @@ class Rpmdiff:
|
|
fmt = ''
|
|
for entry in FILEIDX:
|
|
if entry[1] is not None and \
|
|
- old_file[entry[1]] != new_file[entry[1]]:
|
|
+ getattr(old_file, entry[1]) != getattr(new_file, entry[1]):
|
|
fmt += entry[0]
|
|
diff = True
|
|
else:
|
|
@@ -236,5 +233,5 @@ class Rpmdiff:
|
|
def __fileIteratorToDict(self, fi):
|
|
result = {}
|
|
for filedata in fi:
|
|
- result[filedata[0]] = filedata[1:]
|
|
+ result[filedata.name] = filedata
|
|
return result
|