unit test: more closely mimic rpm2cpio behavior when reading past header
This commit is contained in:
parent
accdeb3c63
commit
aebff00673
1 changed files with 3 additions and 2 deletions
|
|
@ -57,10 +57,11 @@ class TestHeaderSizes(unittest.TestCase):
|
||||||
|
|
||||||
# The following bit uses rpmlib to read the header, which advances the file
|
# The following bit uses rpmlib to read the header, which advances the file
|
||||||
# pointer past it. This is the same approach rpm2cpio uses.
|
# 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)
|
fd = os.open(fn, os.O_RDONLY)
|
||||||
try:
|
try:
|
||||||
os.lseek(fd, s_lead + s_sig, 0) # seek to header start
|
hdr = ts.hdrFromFdno(fd)
|
||||||
hdr, h_start = rpm.readHeaderFromFD(fd)
|
|
||||||
p_offset = os.lseek(fd, 0, os.SEEK_CUR)
|
p_offset = os.lseek(fd, 0, os.SEEK_CUR)
|
||||||
finally:
|
finally:
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue