Check mtime of entity compose file instead of one of symlink file

- Disable emoji shortcut key with no-emoji hint
- Resolves: #2026540 Own %%pkgcache directory
This commit is contained in:
Takao Fujiwara 2021-12-03 15:02:00 +09:00
parent f080240d12
commit fd5bd5cf1a
2 changed files with 461 additions and 4 deletions

View File

@ -152,6 +152,124 @@ index e12be45d..b1424e87 100644
--
2.28.0
From fbea5441fc53ae1d5533bed1ee53009141cf905a Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 10 Sep 2021 00:09:26 +0900
Subject: [PATCH] Fix build errors in Ubuntu focal
- Ubuntu focal uses glib 2.64.6 which does not include errno.h
so config.h includes errno.h as the workaround.
- make autogen.sh not to delete dist files in Travis
- Call $(PYTHON) for gensimple.py for Ubuntu python3
- Add a code review in src/ibuscomposetable.c
BUG=https://github.com/ibus/ibus/pull/2348
---
autogen.sh | 2 +-
configure.ac | 9 +++++++++
engine/Makefile.am | 2 +-
src/ibuscomposetable.c | 4 ++++
src/ibusregistry.c | 4 ++++
src/ibusshare.c | 3 +++
6 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/autogen.sh b/autogen.sh
index 693a2740..ea633e06 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -53,4 +53,4 @@ ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4" REQUIRED_AUTOMAKE_VERSION=1.11 CFLAGS="$CFL
echo "rm $f"
rm $f
done
-}
+} || :
diff --git a/configure.ac b/configure.ac
index 29f8b3db..ce096ad3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,6 +162,15 @@ PKG_CHECK_MODULES(GIO2, [
PKG_CHECK_MODULES(GTHREAD2, [
gthread-2.0 >= glib_required_version
])
+PKG_CHECK_EXISTS(
+ [glib-2.0 >= 2.65.0],
+ [AC_DEFINE(GLIB2_EMBED_ERRNO_H, TRUE, [glib2 include errno.h])]
+)
+AH_BOTTOM([
+#ifndef GLIB2_EMBED_ERRNO_H
+# include <errno.h>
+#endif
+])
# --disable-tests option.
AC_ARG_ENABLE(tests,
diff --git a/engine/Makefile.am b/engine/Makefile.am
index 84bc7f6c..03867f52 100644
--- a/engine/Makefile.am
+++ b/engine/Makefile.am
@@ -99,7 +99,7 @@ simple.xml: simple.xml.in
mv $@.tmp $@
simple.xml.in:
- $(srcdir)/gensimple.py \
+ $(PYTHON) $(srcdir)/gensimple.py \
--input=$(XKBCONFIG_BASE)/rules/evdev.xml \
--output=$@ \
--version=$(VERSION).`date '+%Y%m%d'` \
diff --git a/src/ibuscomposetable.c b/src/ibuscomposetable.c
index d4184d30..b76464bc 100644
--- a/src/ibuscomposetable.c
+++ b/src/ibuscomposetable.c
@@ -18,6 +18,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <glib.h>
#include <glib/gstdio.h>
@@ -1606,6 +1609,7 @@ ibus_compose_table_compact_check (const IBusComposeTableCompactEx
row_stride = i + 1;
if (seq_index[i + 1] - seq_index[i] > 0) {
+ g_assert (row_stride);
seq = bsearch (compose_buffer + 1,
table->data + seq_index[i],
(seq_index[i + 1] - seq_index[i]) / row_stride,
diff --git a/src/ibusregistry.c b/src/ibusregistry.c
index 23c5ca1b..962afb20 100644
--- a/src/ibusregistry.c
+++ b/src/ibusregistry.c
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <gio/gio.h>
#include <glib/gstdio.h>
#include <string.h>
diff --git a/src/ibusshare.c b/src/ibusshare.c
index 8974511a..0c0bda10 100644
--- a/src/ibusshare.c
+++ b/src/ibusshare.c
@@ -20,6 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include "ibusshare.h"
#include <glib.h>
--
2.33.1
From 943d37444d9cc0881cb5fff87bdd4b9efd5abdb4 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Mon, 9 Aug 2021 12:49:15 +0900
@ -691,3 +809,333 @@ index 861255b1..e63d93f2 100644
--
2.28.0
From 28acfd433b3df1673b7c7177915c027ce48c061e Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 5 Nov 2021 07:22:34 +0900
Subject: [PATCH] ui/gtk2: Deprecate gettext.bind_textdomain_codeset()
since Python 3.8
setup/i18n.py is a symlink of ui/gtk2/i18n.py
env PYTHONWARNINGS='d' ibus-setup
BUG=https://github.com/ibus/ibus/issues/2276
---
setup/i18n.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/setup/i18n.py b/setup/i18n.py
index 976d1aee..af14efc6 100644
--- a/setup/i18n.py
+++ b/setup/i18n.py
@@ -3,7 +3,9 @@
# ibus - The Input Bus
#
# Copyright(c) 2007-2015 Peng Huang <shawn.p.huang@gmail.com>
+# Copyright(c) 2012-2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright(c) 2007-2015 Google, Inc.
+# Copyright(c) 2012-2021 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -23,12 +25,14 @@
import locale
import gettext
import os
+import sys
DOMAINNAME = "ibus10"
_ = lambda a: gettext.dgettext(DOMAINNAME, a)
N_ = lambda a: a
+PY3K = sys.version_info >= (3, 0)
LOCALEDIR = os.getenv("IBUS_LOCALEDIR")
def init_textdomain(domainname):
@@ -42,7 +46,9 @@ def init_textdomain(domainname):
except AttributeError:
pass
gettext.bindtextdomain(domainname, LOCALEDIR)
- gettext.bind_textdomain_codeset(domainname, 'UTF-8')
+ # https://docs.python.org/3/library/gettext.html#gettext.lgettext
+ if not PY3K:
+ gettext.bind_textdomain_codeset(domainname, 'UTF-8')
def gettext_engine_longname(engine):
name = engine.get_name()
--
2.33.1
From cfcc6f194cfc95ab0cf1b3b719d77321c249a83b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Na=C3=AFm=20Favier?= <n@monade.li>
Date: Tue, 16 Nov 2021 00:33:37 +0100
Subject: [PATCH] src/ibuscomposetable: invalidate cache based on symlink
mtime too
When the compose file is a symbolic link, take the link itself's
modification time into account (in addition to its target's) in
determining whether to invalidate the compose cache.
This is useful e.g. on NixOS systems where the compose file might point
to a store path with an irrelevant modification time, and we want the
cache to expire when the symlink itself changes.
BUG=https://github.com/ibus/ibus/pull/2362
---
src/ibuscomposetable.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/ibuscomposetable.c b/src/ibuscomposetable.c
index b76464bc..250e0139 100644
--- a/src/ibuscomposetable.c
+++ b/src/ibuscomposetable.c
@@ -1040,10 +1040,14 @@ ibus_compose_table_load_cache (const gchar *compose_file)
if (!g_file_test (path, G_FILE_TEST_EXISTS))
break;
- if (g_stat (compose_file, &original_buf))
- break;
if (g_stat (path, &cache_buf))
break;
+ if (g_lstat (compose_file, &original_buf))
+ break;
+ if (original_buf.st_mtime > cache_buf.st_mtime)
+ break;
+ if (g_stat (compose_file, &original_buf))
+ break;
if (original_buf.st_mtime > cache_buf.st_mtime)
break;
if (!g_file_get_contents (path, &contents, &length, &error)) {
--
2.33.1
From 2bc47f09832073c87ccdf1060bd93ff95878685a Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 2 Dec 2021 23:52:36 +0900
Subject: [PATCH] autogen: Delete gnome-autogen dependency
You may like to call ./autogen.sh --enable-gtk-doc with your custom
configure options.
Also set SAVE_DIST_FILE=1 by default
---
autogen.sh | 96 +++++++++++++++++++++++++++++++++----------------
src/Makefile.am | 18 ++++++----
3 files changed, 80 insertions(+), 41 deletions(-)
diff --git a/autogen.sh b/autogen.sh
index ea633e06..1acbf705 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,22 +1,47 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-
-PKG_NAME="ibus"
-DIST_FILES="
-engine/simple.xml.in
-src/ibusemojigen.h
-src/ibusunicodegen.h
-"
+: ${srcdir=$(dirname $0)}
+: ${srcdir:=.}
+: ${SAVE_DIST_FILES:=0}
+
+olddir=$(pwd)
+# shellcheck disable=SC2016
+PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac)
+WANT_GTK_DOC=0
+GCC_VERSION=$(gcc --version | head -1 | awk '{print $3}')
+GCC_MAJOR_VERSION=$(echo "$GCC_VERSION" | awk -F. '{print $1}')
FEDORA_PKG1='autoconf automake libtool gettext-devel'
FEDORA_PKG2='glib2-devel gtk2-devel gtk3-devel
wayland-devel'
FEDORA_PKG3='cldr-emoji-annotation iso-codes-devel unicode-emoji unicode-ucd
xkeyboard-config-devel'
-(test -z "$DISABLE_INSTALL_PKGS") && {
+CFLAGS=${CFLAGS-"-Wall -Wformat -Werror=format-security"}
+(test $GCC_MAJOR_VERSION -ge 10) && {
+ CFLAGS="$CFLAGS -fanalyzer -fsanitize=address -fsanitize=leak"
+ FEDORA_PKG1="$FEDORA_PKG1 libasan"
+}
+
+cd "$srcdir"
+
+(test -f configure.ac \
+ && test -f README ) || {
+ echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
+ echo " top-level $PKG_NAME directory"
+ exit 1
+}
+
+(test $(grep -q "^GTK_DOC_CHECK" configure.ac)) || {
+ WANT_GTK_DOC=1
+ FEDORA_PKG2="$FEDORA_PKG2 gtk-doc"
+}
+
+(test -f ChangeLog) || {
+ touch ChangeLog
+}
+
+(test "x$DISABLE_INSTALL_PKGS" = "x") && {
(test -f /etc/fedora-release ) && {
rpm -q $FEDORA_PKG1 || exit 1
rpm -q $FEDORA_PKG2 || exit 1
@@ -27,30 +52,39 @@ FEDORA_PKG3='cldr-emoji-annotation iso-codes-devel unicode-emoji unicode-ucd
}
}
-(test -f $srcdir/configure.ac \
- && test -f $srcdir/README ) || {
- echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
- echo " top-level $PKG_NAME directory"
- exit 1
-}
-
-which gnome-autogen.sh || {
- echo "Not found gnome-autogen.sh. You may need to install gnome-common"
- exit 1
+CONFIGFLAGS="$@"
+(test "$#" = 0 -a "x$NOCONFIGURE" = "x" ) && {
+ echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
+ echo "*** If you wish to pass any to it, please specify them on the" >&2
+ echo "*** '$0' command line." >&2
+ echo "" >&2
+ (test $WANT_GTK_DOC -eq 1) && CONFIGFLAGS="--enable-gtk-doc $@"
}
-(test -f $srcdir/ChangeLog) || {
- touch $srcdir/ChangeLog
-}
+(test $WANT_GTK_DOC -eq 1) && gtkdocize --copy
-CFLAGS=${CFLAGS-"-Wall -Wformat -Werror=format-security"}
+ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4" REQUIRED_AUTOMAKE_VERSION=1.11 \
+autoreconf --verbose --force --install || exit 1
-# need --enable-gtk-doc for gnome-autogen.sh to make dist
-ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4" REQUIRED_AUTOMAKE_VERSION=1.11 CFLAGS="$CFLAGS" . gnome-autogen.sh "$@"
+cd "$olddir"
+(test "x$NOCONFIGURE" = "x" ) && {
+ echo "$srcdir/configure $CONFIGFLAGS"
+ $srcdir/configure $CONFIGFLAGS || exit 1
+ (test "$1" = "--help" ) && {
+ exit 0
+ } || {
+ echo "Now type 'make' to compile $PKG_NAME" || exit 1
+ }
+} || {
+ echo "Skipping configure process."
+}
-(test -z "$SAVE_DIST_FILES") && {
- for f in $DIST_FILES ; do
- echo "rm $f"
- rm $f
- done
+cd "$srcdir"
+(test "x$SAVE_DIST_FILES" = "x0" ) && {
+ # rm engine/simple.xml.in src/ibusemojigen.h src/ibusunicodegen.h
+ for d in engine src; do
+ echo "make -C $d maintainer-clean-generic"
+ make -C $d maintainer-clean-generic
+ done
} || :
+cd "$olddir"
diff --git a/src/Makefile.am b/src/Makefile.am
index 742ee7d7..578694b5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@
# ibus - The Input Bus
#
# Copyright (c) 2007-2015 Peng Huang <shawn.p.huang@gmail.com>
-# Copyright (c) 2015-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2015-2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2007-2017 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
@@ -296,8 +296,8 @@ dicts/emoji-%.dict: emoji-parser
echo "Skip $$plus_comment $@"; \
fi;
-ibusemojigen.h: dicts/emoji-en.dict
- $(NULL)
+ibusemojigen.h:
+ $(MAKE) $(AM_MAKEFLAGS) dicts/emoji-en.dict
# We put dicts/emoji-%.dict as the make target for the parallel build
# and the make target has to be genarated even if the file size is zero.
@@ -364,8 +364,8 @@ dicts/unicode-blocks.dict: unicode-parser
echo "Generated $@"; \
fi;
-ibusunicodegen.h: dicts/unicode-blocks.dict
- $(NULL)
+ibusunicodegen.h:
+ $(MAKE) $(AM_MAKEFLAGS) dicts/unicode-blocks.dict
unicode_parser_SOURCES = \
unicode-parser.c \
@@ -398,9 +398,15 @@ CLEANFILES += \
stamp-ibusenumtypes.h \
$(NULL)
-DISTCLEANFILES = \
+MAINTAINERCLEANFILES = \
ibusemojigen.h \
ibusunicodegen.h \
+ dicts/emoji-en.dict \
+ dicts/unicode-blocks.dict \
+ $(NULL)
+
+DISTCLEANFILES = \
+ $(MAINTAINERCLEANFILES) \
ibusversion.h \
$(NULL)
--
2.33.1
From 104148bcdada1f8f22ef905c930f9944f3e99a63 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 2 Dec 2021 23:53:28 +0900
Subject: [PATCH] src: Disable emoji shortcut key with no-emoji hint
BUG=https://gitlab.gnome.org/GNOME/gtk/-/issues/4337
---
src/ibusengine.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/ibusengine.c b/src/ibusengine.c
index 9aeafbf9..7e844838 100644
--- a/src/ibusengine.c
+++ b/src/ibusengine.c
@@ -2,8 +2,8 @@
/* vim:set et sts=4: */
/* ibus - The Input Bus
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2018-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
- * Copyright (C) 2008-2019 Red Hat, Inc.
+ * Copyright (C) 2018-2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2008-2021 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -954,6 +954,10 @@ ibus_engine_filter_key_event (IBusEngine *engine,
return FALSE;
for (n = names; n; n = n->next) {
const gchar *name = (const gchar *)n->data;
+ if (!g_strcmp0 (name, "emoji") &&
+ (engine->priv->content_hints & IBUS_INPUT_HINT_NO_EMOJI)) {
+ continue;
+ }
keys = g_hash_table_lookup (priv->extension_keybindings, name);
for (; keys; keys++) {
if (keys->keyval == 0 && keys->keycode == 0 && keys->state == 0)
--
2.33.1

View File

@ -8,6 +8,7 @@
%global with_pkg_config %(pkg-config --version >/dev/null 2>&1 && echo -n "1" || echo -n "0")
%global ibus_api_version 1.0
%global pkgcache /var/cache/%name
# for bytecompile in %%{_datadir}/ibus/setup
%global __python %{__python3}
@ -38,7 +39,7 @@
Name: ibus
Version: 1.5.25
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
URL: https://github.com/ibus/%name/wiki
@ -344,6 +345,8 @@ done
# install xinput config file
install -pm 644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_xinputconf}
install -m 755 -d $RPM_BUILD_ROOT%pkgcache/bus
# install .desktop files
%if %with_python2
echo "NoDisplay=true" >> $RPM_BUILD_ROOT%{_datadir}/applications/ibus-setup.desktop
@ -382,9 +385,6 @@ if [ "$1" -eq 0 ]; then
dconf update || :
[ -f %{_sysconfdir}/dconf/db/ibus ] && \
rm %{_sysconfdir}/dconf/db/ibus || :
# 'ibus write-cache --system' updates the system cache.
[ -f /var/cache/ibus/bus/registry ] && \
rm /var/cache/ibus/bus/registry || :
fi
%posttrans
@ -440,6 +440,10 @@ dconf update || :
# Do not use %%config(noreplace) to always get the new keywords in _xinputconf
# For user customization, $HOME/.xinputrc can be used instead.
%config %{_xinputconf}
%verify(not mtime) %dir %pkgcache
%verify(not mtime) %dir %pkgcache/bus
# 'ibus write-cache --system' updates the system cache.
%ghost %pkgcache/bus/registry
%files libs
%{_libdir}/libibus-*%{ibus_api_version}.so.*
@ -513,6 +517,11 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* Fri Dec 03 2021 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.25-6
- Check mtime of entity compose file instead of one of symlink file
- Disable emoji shortcut key with no-emoji hint
- Resolves: #2026540 Own %%pkgcache directory
* Fri Oct 29 2021 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.25-5
- Resolves: #1942970 Clear Emoijer preedit/lookup popup between applications