Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -628,7 +628,9 @@ class PackageImage(Image): ...@@ -628,7 +628,9 @@ class PackageImage(Image):
# launch payload extract # launch payload extract
if payload: if payload:
for payname in self.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)) arrow("Extracting payload %s in %s" % (payname, dest))
self.payload[payname].extract(dest, force=force) self.payload[payname].extract(dest, force=force)
...@@ -994,7 +996,6 @@ class Changelog(dict): ...@@ -994,7 +996,6 @@ class Changelog(dict):
version = max(self) version = max(self)
# in non verbose mode display only asked version if exists # in non verbose mode display only asked version if exists
if not verbose and version not in self: if not verbose and version not in self:
print "chich"
return return
out('#light##yellow#Changelog:#reset#') out('#light##yellow#Changelog:#reset#')
# display asked version # display asked version
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Started 12/05/2011 by Seblu <seblu@seblu.net> # Started 12/05/2011 by Seblu <seblu@seblu.net>
description = """[image] description = u"""[image]
name = name =
version = version =
description = description =
author = author =
""" """
changelog = """[1] changelog = u"""[1]
- Initial version - Initial version
""" """
...@@ -36,7 +36,7 @@ parser.add_argument("target", type=str, action=TargetAction, ...@@ -36,7 +36,7 @@ parser.add_argument("target", type=str, action=TargetAction,
# vim:set ts=2 sw=2 noet: # vim:set ts=2 sw=2 noet:
""" """
setup = """# -*- python -*- setup = u"""# -*- python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# image object is a reference to current image # image object is a reference to current image
...@@ -52,7 +52,7 @@ arrow("hostname: %s" % namespace.hostname) ...@@ -52,7 +52,7 @@ arrow("hostname: %s" % namespace.hostname)
# vim:set ts=2 sw=2 noet: # vim:set ts=2 sw=2 noet:
""" """
createdb = """ createdb = u"""
CREATE TABLE image (md5 TEXT NOT NULL PRIMARY KEY, CREATE TABLE image (md5 TEXT NOT NULL PRIMARY KEY,
name TEXT NOT NULL, name TEXT NOT NULL,
version INTEGER NOT NULL, version INTEGER NOT NULL,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment