From 5ce812e8fdd61bfa3d11e379b35395d21c303e27 Mon Sep 17 00:00:00 2001
From: Maxwell G <maxwell@gtmx.me>
Date: Jun 27 2023 20:52:36 +0000
Subject: test: remove usage of deprecated rpm.fi


python-rpmfluff currently FTBFS in rawhide, as this API was removed in
rpm 4.19.

---

diff --git a/rpmfluff/test.py b/rpmfluff/test.py
index 1dbfa03..4787626 100644
--- a/rpmfluff/test.py
+++ b/rpmfluff/test.py
@@ -529,11 +529,10 @@ class TestSimpleRpmBuild(unittest.TestCase):
             # FIXME: sort out architecture properly
             rpmFile = self.rpmbuild.get_built_rpm(arch)
             h = get_rpm_header(rpmFile)
-            files = list(h.fiFromHeader())
+            files = list(rpm.files(h))
             self.assertEqual(1, len(files))
-            (filename, _size, mode, _mtime, _flags, _rdev, _inode, _FNlink, _Fstate, _vflags, _user, _group, _md5sum) = files[0]
-            self.assertEqual("/var/spool/foo", filename)
-            self.assertEqual(0o041777, mode)
+            self.assertEqual("/var/spool/foo", files[0].name)
+            self.assertEqual(0o041777, files[0].mode)
 
     def test_installed_symlink(self):
         self.rpmbuild.add_installed_symlink("foo", "bar")
@@ -546,9 +545,9 @@ class TestSimpleRpmBuild(unittest.TestCase):
             # FIXME: sort out architecture properly
             rpmFile = self.rpmbuild.get_built_rpm(arch)
             h = get_rpm_header(rpmFile)
-            files = list(h.fiFromHeader())
+            files = list(rpm.files(h))
             self.assertEqual(1, len(files))
-            self.assertEqual("/foo", files[0][0])
+            self.assertEqual("/foo", files[0].name)
 
     def test_config_symlink(self):
         self.rpmbuild.add_installed_symlink("foo", "bar", isConfig=True)
@@ -561,9 +560,9 @@ class TestSimpleRpmBuild(unittest.TestCase):
             # FIXME: sort out architecture properly
             rpmFile = self.rpmbuild.get_built_rpm(arch)
             h = get_rpm_header(rpmFile)
-            files = list(h.fiFromHeader())
+            files = list(rpm.files(h))
             self.assertEqual(1, len(files))
-            self.assertEqual("/foo", files[0][0])
+            self.assertEqual("/foo", files[0].name)
 
     def test_doc_symlink(self):
         self.rpmbuild.add_installed_symlink("foo", "bar", isDoc=True)
@@ -576,9 +575,9 @@ class TestSimpleRpmBuild(unittest.TestCase):
             # FIXME: sort out architecture properly
             rpmFile = self.rpmbuild.get_built_rpm(arch)
             h = get_rpm_header(rpmFile)
-            files = list(h.fiFromHeader())
+            files = list(rpm.files(h))
             self.assertEqual(1, len(files))
-            self.assertEqual("/foo", files[0][0])
+            self.assertEqual("/foo", files[0].name)
 
     def test_ghost_symlink(self):
         self.rpmbuild.add_installed_symlink("foo", "bar", isGhost=True)
@@ -591,9 +590,9 @@ class TestSimpleRpmBuild(unittest.TestCase):
             # FIXME: sort out architecture properly
             rpmFile = self.rpmbuild.get_built_rpm(arch)
             h = get_rpm_header(rpmFile)
-            files = list(h.fiFromHeader())
+            files = list(rpm.files(h))
             self.assertEqual(1, len(files))
-            self.assertEqual("/foo", files[0][0])
+            self.assertEqual("/foo", files[0].name)
 
     def test_fake_virus(self):
         """Ensure that adding a fake virus works as expected"""
@@ -635,15 +634,15 @@ class TestSimpleRpmBuild(unittest.TestCase):
         self.rpmbuild.add_simple_compilation(installPath='/usr/bin/program')
         self.rpmbuild.make()
         hdr = self.rpmbuild.get_built_rpm_header('i386')
-        fi = hdr.fiFromHeader()
-        next(fi)
-        self.assertEqual('/usr/bin/program', fi.FN())
-        self.assertEqual(1, fi.FColor())
+        files = rpm.files(hdr)
+        file = next(files)
+        self.assertEqual('/usr/bin/program', file.name)
+        self.assertEqual(1, file.color)
         hdr = self.rpmbuild.get_built_rpm_header('x86_64')
-        fi = hdr.fiFromHeader()
-        next(fi)
-        self.assertEqual('/usr/bin/program', fi.FN())
-        self.assertEqual(2, fi.FColor())
+        files = rpm.files(hdr)
+        file = next(files)
+        self.assertEqual('/usr/bin/program', file.name)
+        self.assertEqual(2, file.color)
 
     def test_multilib_conflict(self):
         """Ensure that the hooks to create a multilib conflict work as expected"""
@@ -700,12 +699,11 @@ class TestSimpleRpmBuild(unittest.TestCase):
                 owner='apache', group='apache')
         self.rpmbuild.make()
         hdr = self.rpmbuild.get_built_rpm_header(expectedArch)
-        files = list(hdr.fiFromHeader())
+        files = list(rpm.files(hdr))
         self.assertEqual(1, len(files))
-        (filename, _size, _mode, _mtime, _flags, _rdev, _inode, _FNlink, _Fstate, _vflags, user, group, _md5sum) = files[0]
-        self.assertEqual('/var/www/html/index.html', filename)
-        self.assertEqual('apache', user)
-        self.assertEqual('apache', group)
+        self.assertEqual('/var/www/html/index.html', files[0].name)
+        self.assertEqual('apache', files[0].user)
+        self.assertEqual('apache', files[0].group)
 
     def test_specfile_encoding_utf8(self):
         self.rpmbuild.section_changelog = "* Fri Mar 30 2001 Trond Eivind Glomsr\\u00F8d <teg@redhat.com>\nDo something"

