diff options
Diffstat (limited to 'meta/classes/package_deb.bbclass')
| -rw-r--r-- | meta/classes/package_deb.bbclass | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass index e1d05a74c2..e35f427ea2 100644 --- a/meta/classes/package_deb.bbclass +++ b/meta/classes/package_deb.bbclass | |||
| @@ -117,7 +117,7 @@ python do_package_deb () { | |||
| 117 | 117 | ||
| 118 | controldir = os.path.join(root, 'DEBIAN') | 118 | controldir = os.path.join(root, 'DEBIAN') |
| 119 | bb.utils.mkdirhier(controldir) | 119 | bb.utils.mkdirhier(controldir) |
| 120 | os.chmod(controldir, 0755) | 120 | os.chmod(controldir, 0o755) |
| 121 | try: | 121 | try: |
| 122 | import codecs | 122 | import codecs |
| 123 | ctrlfile = codecs.open(os.path.join(controldir, 'control'), 'w', 'utf-8') | 123 | ctrlfile = codecs.open(os.path.join(controldir, 'control'), 'w', 'utf-8') |
| @@ -173,7 +173,7 @@ python do_package_deb () { | |||
| 173 | # Special behavior for description... | 173 | # Special behavior for description... |
| 174 | if 'DESCRIPTION' in fs: | 174 | if 'DESCRIPTION' in fs: |
| 175 | summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "." | 175 | summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "." |
| 176 | ctrlfile.write('Description: %s\n' % unicode(summary,'utf-8')) | 176 | ctrlfile.write('Description: %s\n' % summary) |
| 177 | description = localdata.getVar('DESCRIPTION', True) or "." | 177 | description = localdata.getVar('DESCRIPTION', True) or "." |
| 178 | description = textwrap.dedent(description).strip() | 178 | description = textwrap.dedent(description).strip() |
| 179 | if '\\n' in description: | 179 | if '\\n' in description: |
| @@ -182,29 +182,25 @@ python do_package_deb () { | |||
| 182 | # We don't limit the width when manually indent, but we do | 182 | # We don't limit the width when manually indent, but we do |
| 183 | # need the textwrap.fill() to set the initial_indent and | 183 | # need the textwrap.fill() to set the initial_indent and |
| 184 | # subsequent_indent, so set a large width | 184 | # subsequent_indent, so set a large width |
| 185 | ctrlfile.write('%s\n' % unicode(textwrap.fill(t, width=100000, initial_indent=' ', subsequent_indent=' '),'utf-8')) | 185 | ctrlfile.write('%s\n' % textwrap.fill(t, width=100000, initial_indent=' ', subsequent_indent=' ')) |
| 186 | else: | 186 | else: |
| 187 | # Auto indent | 187 | # Auto indent |
| 188 | ctrlfile.write('%s\n' % unicode(textwrap.fill(description.strip(), width=74, initial_indent=' ', subsequent_indent=' '),'utf-8')) | 188 | ctrlfile.write('%s\n' % textwrap.fill(description.strip(), width=74, initial_indent=' ', subsequent_indent=' ')) |
| 189 | 189 | ||
| 190 | else: | 190 | else: |
| 191 | ctrlfile.write(unicode(c % tuple(pullData(fs, localdata)),'utf-8')) | 191 | ctrlfile.write(c % tuple(pullData(fs, localdata))) |
| 192 | except KeyError: | 192 | except KeyError: |
| 193 | import sys | 193 | import sys |
| 194 | (type, value, traceback) = sys.exc_info() | 194 | (type, value, traceback) = sys.exc_info() |
| 195 | bb.utils.unlockfile(lf) | 195 | bb.utils.unlockfile(lf) |
| 196 | ctrlfile.close() | 196 | ctrlfile.close() |
| 197 | raise bb.build.FuncFailed("Missing field for deb generation: %s" % value) | 197 | raise bb.build.FuncFailed("Missing field for deb generation: %s" % value) |
| 198 | except UnicodeDecodeError: | ||
| 199 | bb.utils.unlockfile(lf) | ||
| 200 | ctrlfile.close() | ||
| 201 | raise bb.build.FuncFailed("Non UTF-8 characters found in one of the fields") | ||
| 202 | 198 | ||
| 203 | # more fields | 199 | # more fields |
| 204 | 200 | ||
| 205 | custom_fields_chunk = get_package_additional_metadata("deb", localdata) | 201 | custom_fields_chunk = get_package_additional_metadata("deb", localdata) |
| 206 | if custom_fields_chunk is not None: | 202 | if custom_fields_chunk is not None: |
| 207 | ctrlfile.write(unicode(custom_fields_chunk)) | 203 | ctrlfile.write(custom_fields_chunk) |
| 208 | ctrlfile.write("\n") | 204 | ctrlfile.write("\n") |
| 209 | 205 | ||
| 210 | mapping_rename_hook(localdata) | 206 | mapping_rename_hook(localdata) |
| @@ -255,17 +251,17 @@ python do_package_deb () { | |||
| 255 | rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS", True) or "") | 251 | rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS", True) or "") |
| 256 | debian_cmp_remap(rconflicts) | 252 | debian_cmp_remap(rconflicts) |
| 257 | if rdepends: | 253 | if rdepends: |
| 258 | ctrlfile.write("Depends: %s\n" % unicode(bb.utils.join_deps(rdepends))) | 254 | ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends)) |
| 259 | if rsuggests: | 255 | if rsuggests: |
| 260 | ctrlfile.write("Suggests: %s\n" % unicode(bb.utils.join_deps(rsuggests))) | 256 | ctrlfile.write("Suggests: %s\n" % bb.utils.join_deps(rsuggests)) |
| 261 | if rrecommends: | 257 | if rrecommends: |
| 262 | ctrlfile.write("Recommends: %s\n" % unicode(bb.utils.join_deps(rrecommends))) | 258 | ctrlfile.write("Recommends: %s\n" % bb.utils.join_deps(rrecommends)) |
| 263 | if rprovides: | 259 | if rprovides: |
| 264 | ctrlfile.write("Provides: %s\n" % unicode(bb.utils.join_deps(rprovides))) | 260 | ctrlfile.write("Provides: %s\n" % bb.utils.join_deps(rprovides)) |
| 265 | if rreplaces: | 261 | if rreplaces: |
| 266 | ctrlfile.write("Replaces: %s\n" % unicode(bb.utils.join_deps(rreplaces))) | 262 | ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces)) |
| 267 | if rconflicts: | 263 | if rconflicts: |
| 268 | ctrlfile.write("Conflicts: %s\n" % unicode(bb.utils.join_deps(rconflicts))) | 264 | ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts)) |
| 269 | ctrlfile.close() | 265 | ctrlfile.close() |
| 270 | 266 | ||
| 271 | for script in ["preinst", "postinst", "prerm", "postrm"]: | 267 | for script in ["preinst", "postinst", "prerm", "postrm"]: |
| @@ -293,7 +289,7 @@ python do_package_deb () { | |||
| 293 | scriptfile.write(scriptvar[pos:]) | 289 | scriptfile.write(scriptvar[pos:]) |
| 294 | scriptfile.write('\n') | 290 | scriptfile.write('\n') |
| 295 | scriptfile.close() | 291 | scriptfile.close() |
| 296 | os.chmod(os.path.join(controldir, script), 0755) | 292 | os.chmod(os.path.join(controldir, script), 0o755) |
| 297 | 293 | ||
| 298 | conffiles_str = ' '.join(get_conffiles(pkg, d)) | 294 | conffiles_str = ' '.join(get_conffiles(pkg, d)) |
| 299 | if conffiles_str: | 295 | if conffiles_str: |
