Blob Blame History Raw
From 442a2731be9dd9af816b4998efcbd62f0f090b5e Mon Sep 17 00:00:00 2001
From: lethliel <mstrigl@suse.com>
Date: Tue, 12 Feb 2019 14:04:42 +0100
Subject: [PATCH] cpio.py is now a bytes only api.

The decoding of the header needs to be done in fetch.py
---
 osc/fetch.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/osc/fetch.py b/osc/fetch.py
index 833c8fa5..5a786250 100644
--- a/osc/fetch.py
+++ b/osc/fetch.py
@@ -23,6 +23,7 @@
 import tempfile
 import re
 
+from osc.util.helper import decode_it
 from .meter import create_text_meter
 
 class Fetcher:
@@ -77,16 +78,16 @@ def __download_cpio_archive(self, apiurl, project, repo, arch, package, **pkgs):
                         raise oscerr.APIError('CPIO archive is incomplete '
                                               '(see .errors file)')
                     if package == '_repository':
-                        n = re.sub(r'\.pkg\.tar\..z$', '.arch', hdr.filename)
-                        if n.startswith('container:'):
-                            n = re.sub(r'\.tar\..z$', '.tar', hdr.filename)
-                            pac = pkgs[n.rsplit('.', 1)[0]]
+                        n = re.sub(b'\.pkg\.tar\..z$', b'.arch', hdr.filename)
+                        if n.startswith(b'container:'):
+                            n = re.sub(b'\.tar\..z$', b'.tar', hdr.filename)
+                            pac = pkgs[decode_it(n.rsplit(b'.', 1)[0])]
                             pac.canonname = hdr.filename
                         else:
-                            pac = pkgs[n.rsplit('.', 1)[0]]
+                            pac = pkgs[decode_it(n.rsplit(b'.', 1)[0])]
                     else:
                         # this is a kiwi product
-                        pac = pkgs[hdr.filename]
+                        pac = pkgs[decode_it(hdr.filename)]
 
                     # Extract a single file from the cpio archive
                     try: