Commit 521bbd66 authored by Sebastien Luttringer's avatar Sebastien Luttringer
Browse files

fix extracting payload with utf8 filenames

tarfile module fail to extract tarball with utf8 filenames when destination is an unicode
string. We need to convert dest as utf-8 string to restore an expected behaviour
parent 99eb38c6
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -628,7 +628,9 @@ class PackageImage(Image):
        # launch payload extract
        if payload:
            for payname in self.payload:
                dest = os.path.join(directory, "payload", payname)
                # here we need to decode payname which is in unicode to escape
                # tarfile to encode filename of file inside tarball inside unicode
                dest = os.path.join(directory, "payload", payname.encode("utf-8"))
                arrow("Extracting payload %s in %s" % (payname, dest))
                self.payload[payname].extract(dest, force=force)

@@ -994,7 +996,6 @@ class Changelog(dict):
            version = max(self)
        # in non verbose mode display only asked version if exists
        if not verbose and version not in self:
            print "chich"
            return
        out('#light##yellow#Changelog:#reset#')
        # display asked version
+4 −4
Original line number Diff line number Diff line
@@ -2,14 +2,14 @@
# -*- coding: utf-8 -*-
# Started 12/05/2011 by Seblu <seblu@seblu.net>

description = """[image]
description = u"""[image]
name =
version =
description =
author =
"""

changelog = """[1]
changelog = u"""[1]
- Initial version
"""

@@ -36,7 +36,7 @@ parser.add_argument("target", type=str, action=TargetAction,
# vim:set ts=2 sw=2 noet:
"""

setup = """# -*- python -*-
setup = u"""# -*- python -*-
# -*- coding: utf-8 -*-

# image object is a reference to current image
@@ -52,7 +52,7 @@ arrow("hostname: %s" % namespace.hostname)
# vim:set ts=2 sw=2 noet:
"""

createdb = """
createdb = u"""
CREATE TABLE image (md5 TEXT NOT NULL PRIMARY KEY,
                    name TEXT NOT NULL,
                    version INTEGER NOT NULL,