summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/package_deb.bbclass18
1 files changed, 11 insertions, 7 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index 9e1ed28c3a..398ceeeb28 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -96,9 +96,8 @@ python do_package_deb () {
96 bb.utils.mkdirhier(controldir) 96 bb.utils.mkdirhier(controldir)
97 os.chmod(controldir, 0755) 97 os.chmod(controldir, 0755)
98 try: 98 try:
99 ctrlfile = open(os.path.join(controldir, 'control'), 'w') 99 import codecs
100 # import codecs 100 ctrlfile = codecs.open(os.path.join(controldir, 'control'), 'w', 'utf-8')
101 # ctrlfile = codecs.open("someFile", "w", "utf-8")
102 except OSError: 101 except OSError:
103 bb.utils.unlockfile(lf) 102 bb.utils.unlockfile(lf)
104 raise bb.build.FuncFailed("unable to open control file for writing.") 103 raise bb.build.FuncFailed("unable to open control file for writing.")
@@ -149,7 +148,7 @@ python do_package_deb () {
149 # Special behavior for description... 148 # Special behavior for description...
150 if 'DESCRIPTION' in fs: 149 if 'DESCRIPTION' in fs:
151 summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "." 150 summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "."
152 ctrlfile.write('Description: %s\n' % unicode(summary)) 151 ctrlfile.write('Description: %s\n' % unicode(summary,'utf-8'))
153 description = localdata.getVar('DESCRIPTION', True) or "." 152 description = localdata.getVar('DESCRIPTION', True) or "."
154 description = textwrap.dedent(description).strip() 153 description = textwrap.dedent(description).strip()
155 if '\\n' in description: 154 if '\\n' in description:
@@ -158,19 +157,24 @@ python do_package_deb () {
158 # We don't limit the width when manually indent, but we do 157 # We don't limit the width when manually indent, but we do
159 # need the textwrap.fill() to set the initial_indent and 158 # need the textwrap.fill() to set the initial_indent and
160 # subsequent_indent, so set a large width 159 # subsequent_indent, so set a large width
161 ctrlfile.write('%s\n' % unicode(textwrap.fill(t, width=100000, initial_indent=' ', subsequent_indent=' '))) 160 ctrlfile.write('%s\n' % unicode(textwrap.fill(t, width=100000, initial_indent=' ', subsequent_indent=' '),'utf-8'))
162 else: 161 else:
163 # Auto indent 162 # Auto indent
164 ctrlfile.write('%s\n' % unicode(textwrap.fill(description.strip(), width=74, initial_indent=' ', subsequent_indent=' '))) 163 ctrlfile.write('%s\n' % unicode(textwrap.fill(description.strip(), width=74, initial_indent=' ', subsequent_indent=' '),'utf-8'))
165 164
166 else: 165 else:
167 ctrlfile.write(unicode(c % tuple(pullData(fs, localdata)))) 166 ctrlfile.write(unicode(c % tuple(pullData(fs, localdata)),'utf-8'))
168 except KeyError: 167 except KeyError:
169 import sys 168 import sys
170 (type, value, traceback) = sys.exc_info() 169 (type, value, traceback) = sys.exc_info()
171 bb.utils.unlockfile(lf) 170 bb.utils.unlockfile(lf)
172 ctrlfile.close() 171 ctrlfile.close()
173 raise bb.build.FuncFailed("Missing field for deb generation: %s" % value) 172 raise bb.build.FuncFailed("Missing field for deb generation: %s" % value)
173 except UnicodeDecodeError:
174 bb.utils.unlockfile(lf)
175 ctrlfile.close()
176 raise bb.build.FuncFailed("Non UTF-8 characters found in one of the fields")
177
174 # more fields 178 # more fields
175 179
176 custom_fields_chunk = get_package_additional_metadata("deb", localdata) 180 custom_fields_chunk = get_package_additional_metadata("deb", localdata)