mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-28 10:46:15 +01:00
Merge pull request #513 from lethliel/python3_compatible_fetch_module
[python3] cpio.py is now a bytes only api.
This commit is contained in:
commit
19965b7a15
13
osc/fetch.py
13
osc/fetch.py
@ -23,6 +23,7 @@ from . import oscerr
|
|||||||
import tempfile
|
import tempfile
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from osc.util.helper import decode_it
|
||||||
from .meter import create_text_meter
|
from .meter import create_text_meter
|
||||||
|
|
||||||
class Fetcher:
|
class Fetcher:
|
||||||
@ -77,16 +78,16 @@ class Fetcher:
|
|||||||
raise oscerr.APIError('CPIO archive is incomplete '
|
raise oscerr.APIError('CPIO archive is incomplete '
|
||||||
'(see .errors file)')
|
'(see .errors file)')
|
||||||
if package == '_repository':
|
if package == '_repository':
|
||||||
n = re.sub(r'\.pkg\.tar\..z$', '.arch', hdr.filename)
|
n = re.sub(rb'\.pkg\.tar\..z$', b'.arch', hdr.filename)
|
||||||
if n.startswith('container:'):
|
if n.startswith(b'container:'):
|
||||||
n = re.sub(r'\.tar\..z$', '.tar', hdr.filename)
|
n = re.sub(rb'\.tar\..z$', b'.tar', hdr.filename)
|
||||||
pac = pkgs[n.rsplit('.', 1)[0]]
|
pac = pkgs[decode_it(n.rsplit(b'.', 1)[0])]
|
||||||
pac.canonname = hdr.filename
|
pac.canonname = hdr.filename
|
||||||
else:
|
else:
|
||||||
pac = pkgs[n.rsplit('.', 1)[0]]
|
pac = pkgs[decode_it(n.rsplit(b'.', 1)[0])]
|
||||||
else:
|
else:
|
||||||
# this is a kiwi product
|
# this is a kiwi product
|
||||||
pac = pkgs[hdr.filename]
|
pac = pkgs[decode_it(hdr.filename)]
|
||||||
|
|
||||||
# Extract a single file from the cpio archive
|
# Extract a single file from the cpio archive
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user