Backport glib-mkenums flags annotation parsing fixes

This commit is contained in:
Kalev Lember 2017-08-01 22:54:29 +01:00
parent 52c8682ec3
commit 7601a56f32
3 changed files with 99 additions and 1 deletions

View File

@ -0,0 +1,62 @@
From ca69df0f16fd0bda99baf609a8ce9f38e1039f65 Mon Sep 17 00:00:00 2001
From: Emmanuele Bassi <ebassi@gnome.org>
Date: Tue, 1 Aug 2017 10:11:09 +0100
Subject: [PATCH 1/2] Revert "glib-mkenums: fix parsing of /*< flags >*/
annotation"
This reverts commit 1672678bc48c1c060d1ee6bb3df124b3e4f9ca33.
A more comprehensive fix will follow.
---
gobject/glib-mkenums.in | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in
index 9fae3a8a9..a82a374cf 100755
--- a/gobject/glib-mkenums.in
+++ b/gobject/glib-mkenums.in
@@ -83,7 +83,7 @@ def write_output(output):
# glib-mkenums.py
# Information about the current enumeration
-flags = False # Is enumeration a bitmask?
+flags = None # Is enumeration a bitmask?
option_underscore_name = '' # Overriden underscore variant of the enum name
# for example to fix the cases we don't get the
# mixed-case -> underscorized transform right.
@@ -196,7 +196,7 @@ def parse_entries(file, file_name):
value = groups[1]
if len(groups) > 2:
options = groups[2]
- if not flags and value is not None and '<<' in value:
+ if flags is None and value is not None and '<<' in value:
seenbitshift = 1
if options is not None:
@@ -449,12 +449,12 @@ def process_file(curfilename):
if 'skip' in options:
continue
enum_prefix = options.get('prefix', None)
- flags = 'flags' in options
+ flags = options.get('flags', None)
option_lowercase_name = options.get('lowercase_name', None)
option_underscore_name = options.get('underscore_name', None)
else:
enum_prefix = None
- flags = False
+ flags = None
option_lowercase_name = None
option_underscore_name = None
@@ -479,7 +479,7 @@ def process_file(curfilename):
parse_entries(curfile, curfilename)
# figure out if this was a flags or enums enumeration
- if not flags:
+ if flags is None:
flags = seenbitshift
# Autogenerate a prefix
--
2.13.0

View File

@ -0,0 +1,29 @@
From 8cc99502022944917f5dd78ce1d1427582081396 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= <alberts.muktupavels@gmail.com>
Date: Tue, 1 Aug 2017 12:18:42 +0300
Subject: [PATCH 2/2] glib-mkenums: fix parsing of flags annotation
https://bugzilla.gnome.org/show_bug.cgi?id=779332
---
gobject/glib-mkenums.in | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in
index a82a374cf..d4bfd11c3 100755
--- a/gobject/glib-mkenums.in
+++ b/gobject/glib-mkenums.in
@@ -450,6 +450,11 @@ def process_file(curfilename):
continue
enum_prefix = options.get('prefix', None)
flags = options.get('flags', None)
+ if 'flags' in options:
+ if flags is None:
+ flags = 1
+ else:
+ flags = int(flags)
option_lowercase_name = options.get('lowercase_name', None)
option_underscore_name = options.get('underscore_name', None)
else:
--
2.13.0

View File

@ -5,7 +5,7 @@
Name: glib2
Version: 2.53.4
Release: 3%{?dist}
Release: 4%{?dist}
Summary: A library of handy utility functions
License: LGPLv2+
@ -14,6 +14,8 @@ Source0: http://download.gnome.org/sources/glib/2.53/glib-%{version}.tar.xz
# Backported from upstream
Patch0: 0001-Revert-GKeyFile-Add-array-length-annotations-to-to_d.patch
Patch1: 0001-Revert-glib-mkenums-fix-parsing-of-flags-annotation.patch
Patch2: 0002-glib-mkenums-fix-parsing-of-flags-annotation.patch
BuildRequires: chrpath
BuildRequires: gettext
@ -85,6 +87,8 @@ the functionality of the installed glib2 package.
%prep
%setup -q -n glib-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
# Bug 1324770: Also explicitly remove PCRE sources since we use --with-pcre=system
@ -235,6 +239,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/installed-tests
%changelog
* Tue Aug 01 2017 Kalev Lember <klember@redhat.com> - 2.53.4-4
- Backport glib-mkenums flags annotation parsing fixes
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.53.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild