diff options
author | prlw1 <prlw1@pkgsrc.org> | 2017-10-21 08:57:33 +0000 |
---|---|---|
committer | prlw1 <prlw1@pkgsrc.org> | 2017-10-21 08:57:33 +0000 |
commit | 0113f0b80ae6ab8a62545aa9b7f0632839bfe5cb (patch) | |
tree | 854f3fe6a2b2f1ac79d848a8f9dc4cdbd60897cb /devel | |
parent | 2c9970f210041c89e73b0a9ad31bc5040c33a88a (diff) | |
download | pkgsrc-0113f0b80ae6ab8a62545aa9b7f0632839bfe5cb.tar.gz |
glib2-tools: Handle source files which are not utf-8
python 3 is strict about file encodings. After glib-mkenums was
translated from perl to python, build failures occur due to e.g.,
ISO-8859-1 characters in authors' names as reported by martin@ in
PR pkg/52631 for xfce4-gtk2-engines, but also causing build failures
for at least libgnome and libgnomeui.
Chritoph Reiter produced an elegant workaround, making use of the
open() function's error decoding "replace" option:
'replace' causes a replacement marker (such as '?') to be inserted
where there is malformed data.
which is applied here.
https://bugzilla.gnome.org/show_bug.cgi?id=785113#c27
Diffstat (limited to 'devel')
-rw-r--r-- | devel/glib2-tools/Makefile | 4 | ||||
-rw-r--r-- | devel/glib2/distinfo | 4 | ||||
-rw-r--r-- | devel/glib2/patches/patch-gobject_glib-mkenums.in | 51 |
3 files changed, 52 insertions, 7 deletions
diff --git a/devel/glib2-tools/Makefile b/devel/glib2-tools/Makefile index 9e1b6c78c50..ffc3685ef42 100644 --- a/devel/glib2-tools/Makefile +++ b/devel/glib2-tools/Makefile @@ -1,7 +1,9 @@ -# $NetBSD: Makefile,v 1.1 2017/10/15 14:10:39 prlw1 Exp $ +# $NetBSD: Makefile,v 1.2 2017/10/21 08:57:33 prlw1 Exp $ .include "../../devel/glib2/Makefile.common" +PKGREVISION= 1 + PKGNAME:= ${PKGNAME:S/glib2/glib2-tools/} CATEGORIES= devel gnome diff --git a/devel/glib2/distinfo b/devel/glib2/distinfo index c4b46188831..44fada08696 100644 --- a/devel/glib2/distinfo +++ b/devel/glib2/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.224 2017/10/15 08:23:06 prlw1 Exp $ +$NetBSD: distinfo,v 1.225 2017/10/21 08:57:33 prlw1 Exp $ SHA1 (glib-2.54.1.tar.xz) = 3be679369c7134e05b188285154b00940370b109 RMD160 (glib-2.54.1.tar.xz) = c14a2ab435e47d706a88d4d1efb1008216107abc @@ -35,4 +35,4 @@ SHA1 (patch-glib_gtimezone.c) = d9686da52f171a073d80cfd9f80aa490088a00a3 SHA1 (patch-gobject_Makefile.am) = 6eed6b57f5ff0aa0dfb623110b23a3ff78aa4e75 SHA1 (patch-gobject_Makefile.in) = a4768ff7b0607a8a4dfbb2cff087a987b451fd18 SHA1 (patch-gobject_glib-genmarshal.in) = f21ca416d4eb4ad5a8ce3ffa053f8bcd2be8953a -SHA1 (patch-gobject_glib-mkenums.in) = 7c58333ec4946ecb26e709db0be51b7f07035db9 +SHA1 (patch-gobject_glib-mkenums.in) = 7468c428ca33de20571d0199d17a0dcc6ea9d624 diff --git a/devel/glib2/patches/patch-gobject_glib-mkenums.in b/devel/glib2/patches/patch-gobject_glib-mkenums.in index 62f6c8b6189..20b679de5a4 100644 --- a/devel/glib2/patches/patch-gobject_glib-mkenums.in +++ b/devel/glib2/patches/patch-gobject_glib-mkenums.in @@ -1,9 +1,11 @@ -$NetBSD: patch-gobject_glib-mkenums.in,v 1.1 2017/10/15 08:23:06 prlw1 Exp $ +$NetBSD: patch-gobject_glib-mkenums.in,v 1.2 2017/10/21 08:57:33 prlw1 Exp $ -Revert 4395a897 Use env to run the Python-based tools -https://bugzilla.gnome.org/show_bug.cgi?id=788527 +- Revert 4395a897 Use env to run the Python-based tools + https://bugzilla.gnome.org/show_bug.cgi?id=788527 +- Don't insist that authors' names in comments be encoded in utf-8 + https://bugzilla.gnome.org/show_bug.cgi?id=785113 ---- gobject/glib-mkenums.in.orig 2017-08-07 14:58:31.000000000 +0000 +--- gobject/glib-mkenums.in.orig 2017-10-21 08:20:09.664007702 +0000 +++ gobject/glib-mkenums.in @@ -1,4 +1,4 @@ -#!/usr/bin/env @PYTHON@ @@ -11,3 +13,44 @@ https://bugzilla.gnome.org/show_bug.cgi?id=788527 # If the code below looks horrible and unpythonic, do not panic. # +@@ -34,6 +34,11 @@ if sys.stdout.encoding is None: + else: + output_stream = sys.stdout + ++# Some source files aren't utf-8 and the old perl version didn't care. ++# Replace invalid data with a replacement character to keep things working. ++# https://bugzilla.gnome.org/show_bug.cgi?id=785113#c20 ++decoding_errors = "replace" ++ + # pylint: disable=too-few-public-methods + class Color: + '''ANSI Terminal colors''' +@@ -157,7 +162,8 @@ def parse_entries(file, file_name): + m = re.match(r'\#include\s*<([^>]*)>', line) + if m: + newfilename = os.path.join("..", m.group(1)) +- newfile = io.open(newfilename, encoding="utf-8") ++ newfile = io.open(newfilename, encoding="utf-8", ++ errors=decoding_errors) + + if not parse_entries(newfile, newfilename): + return False +@@ -253,7 +259,7 @@ def read_template_file(file): + } + in_ = 'junk' + +- ifile = io.open(file, encoding="utf-8") ++ ifile = io.open(file, encoding="utf-8", errors=decoding_errors) + for line in ifile: + m = re.match(r'\/\*\*\*\s+(BEGIN|END)\s+([\w-]+)\s+\*\*\*\/', line) + if m: +@@ -409,7 +415,8 @@ def process_file(curfilename): + firstenum = True + + try: +- curfile = io.open(curfilename, encoding="utf-8") ++ curfile = io.open(curfilename, encoding="utf-8", ++ errors=decoding_errors) + except IOError as e: + if e.errno == errno.ENOENT: + print_warning('No file "{}" found.'.format(curfilename)) |