pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel glib2-tools: Handle source files which are not u...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bdfa24af8fa0
branches:  trunk
changeset: 370628:bdfa24af8fa0
user:      prlw1 <prlw1%pkgsrc.org@localhost>
date:      Sat Oct 21 08:57:33 2017 +0000

description:
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:

 devel/glib2-tools/Makefile                        |   4 +-
 devel/glib2/distinfo                              |   4 +-
 devel/glib2/patches/patch-gobject_glib-mkenums.in |  51 +++++++++++++++++++++-
 3 files changed, 52 insertions(+), 7 deletions(-)

diffs (93 lines):

diff -r a96746469300 -r bdfa24af8fa0 devel/glib2-tools/Makefile
--- a/devel/glib2-tools/Makefile        Sat Oct 21 04:11:02 2017 +0000
+++ b/devel/glib2-tools/Makefile        Sat Oct 21 08:57:33 2017 +0000
@@ -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 -r a96746469300 -r bdfa24af8fa0 devel/glib2/distinfo
--- a/devel/glib2/distinfo      Sat Oct 21 04:11:02 2017 +0000
+++ b/devel/glib2/distinfo      Sat Oct 21 08:57:33 2017 +0000
@@ -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-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 -r a96746469300 -r bdfa24af8fa0 devel/glib2/patches/patch-gobject_glib-mkenums.in
--- a/devel/glib2/patches/patch-gobject_glib-mkenums.in Sat Oct 21 04:11:02 2017 +0000
+++ b/devel/glib2/patches/patch-gobject_glib-mkenums.in Sat Oct 21 08:57:33 2017 +0000
@@ -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 @@
  
  # 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))



Home | Main Index | Thread Index | Old Index