unit test: more closely mimic rpm2cpio behavior when reading past header

This commit is contained in:
Mike McLean 2023-02-20 16:49:57 -05:00 committed by Tomas Kopecek
parent accdeb3c63
commit aebff00673

View file

@ -57,10 +57,11 @@ class TestHeaderSizes(unittest.TestCase):
# The following bit uses rpmlib to read the header, which advances the file
# pointer past it. This is the same approach rpm2cpio uses.
ts = rpm.TransactionSet()
ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES | rpm._RPMVSF_NODIGESTS | rpm.RPMVSF_NOHDRCHK)
fd = os.open(fn, os.O_RDONLY)
try:
os.lseek(fd, s_lead + s_sig, 0) # seek to header start
hdr, h_start = rpm.readHeaderFromFD(fd)
hdr = ts.hdrFromFdno(fd)
p_offset = os.lseek(fd, 0, os.SEEK_CUR)
finally:
os.close(fd)