mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-26 20:22:13 +01:00
Merge pull request #866 from marcus-h/cpio_bytes_fix
Fix a potential TypeError in CpioRead.copyin and CpioRead.copyin_file
This commit is contained in:
commit
5e313ed485
@ -90,8 +90,8 @@ class Fetcher:
|
|||||||
try:
|
try:
|
||||||
fd, tmpfile = tempfile.mkstemp(prefix='osc_build_file')
|
fd, tmpfile = tempfile.mkstemp(prefix='osc_build_file')
|
||||||
archive.copyin_file(hdr.filename,
|
archive.copyin_file(hdr.filename,
|
||||||
os.path.dirname(tmpfile),
|
decode_it(os.path.dirname(tmpfile)),
|
||||||
os.path.basename(tmpfile))
|
decode_it(os.path.basename(tmpfile)))
|
||||||
self.move_package(tmpfile, pac.localdir, pac)
|
self.move_package(tmpfile, pac.localdir, pac)
|
||||||
finally:
|
finally:
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
|
@ -182,7 +182,7 @@ class CpioRead:
|
|||||||
hdr = self._get_hdr(filename)
|
hdr = self._get_hdr(filename)
|
||||||
if not hdr:
|
if not hdr:
|
||||||
raise CpioError(filename, '\'%s\' does not exist in archive' % filename)
|
raise CpioError(filename, '\'%s\' does not exist in archive' % filename)
|
||||||
dest = dest or os.getcwd()
|
dest = dest or os.getcwd().encode()
|
||||||
fn = new_fn or filename
|
fn = new_fn or filename
|
||||||
self._copyin_file(hdr, dest, fn)
|
self._copyin_file(hdr, dest, fn)
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ class CpioRead:
|
|||||||
extracts the cpio archive to dest.
|
extracts the cpio archive to dest.
|
||||||
If dest is None $PWD will be used.
|
If dest is None $PWD will be used.
|
||||||
"""
|
"""
|
||||||
dest = dest or os.getcwd()
|
dest = dest or os.getcwd().encode()
|
||||||
for h in self.hdrs:
|
for h in self.hdrs:
|
||||||
self._copyin_file(h, dest, h.filename)
|
self._copyin_file(h, dest, h.filename)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user