aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-06-14 08:06:21 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-06-14 11:05:30 -0400
commit4e60cbe5bbcf425442952de0e8eb6410e9304d1d (patch)
tree9b4dee1d2cf8e077d68e6b9bcd35d544ef74ba31
parent6bbfcc359a111c257d4a9ea788027baddf4e7d64 (diff)
downloadguix-4e60cbe5bbcf425442952de0e8eb6410e9304d1d.tar
guix-4e60cbe5bbcf425442952de0e8eb6410e9304d1d.tar.gz
gnu: ibus-anthy: Prepare for tests.
* gnu/packages/patches/ibus-anthy-fix-tests.patch: New patch. * gnu/packages/ibus.scm (ibus-anthy): Register it. * gnu/packages/ibus.scm (ibus-anthy) [source]: Apply patch. [arguments]: Clarify #:tests? comment. Add a fix-check, do-not-override-GI_TYPELIB_PATH and prepare-for-tests phases. [native-inputs]: Add procps, python-pycotap, util-linux and xorg-server-for-tests.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/ibus.scm38
-rw-r--r--gnu/packages/patches/ibus-anthy-fix-tests.patch49
3 files changed, 85 insertions, 3 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 209556b56d..3d3e54406b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -897,6 +897,7 @@ dist_patch_DATA = \
%D%/packages/patches/akonadi-not-relocatable.patch \
%D%/packages/patches/akonadi-timestamps.patch \
%D%/packages/patches/allegro-mesa-18.2.5-and-later.patch \
+ %D%/packages/patches/ibus-anthy-fix-tests.patch \
%D%/packages/patches/anki-mpv-args.patch \
%D%/packages/patches/antiword-CVE-2014-8123.patch \
%D%/packages/patches/antlr3-3_1-fix-java8-compilation.patch \
diff --git a/gnu/packages/ibus.scm b/gnu/packages/ibus.scm
index d880956c56..e9294fab1e 100644
--- a/gnu/packages/ibus.scm
+++ b/gnu/packages/ibus.scm
@@ -59,10 +59,12 @@
#:use-module (gnu packages gstreamer)
#:use-module (gnu packages gtk)
#:use-module (gnu packages iso-codes)
+ #:use-module (gnu packages linux)
#:use-module (gnu packages logging)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-check)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages python-web)
#:use-module (gnu packages serialization)
@@ -348,18 +350,44 @@ Chinese pinyin input methods.")
version "/ibus-anthy-" version ".tar.gz"))
(sha256
(base32
- "16vd0k8wm13s38869jqs3dnwmjvywgn0snnpyi41m28binhlssf8"))))
+ "16vd0k8wm13s38869jqs3dnwmjvywgn0snnpyi41m28binhlssf8"))
+ (patches (search-patches "ibus-anthy-fix-tests.patch"))))
(build-system gnu-build-system)
(arguments
(list
+ ;; The test suite hangs (see:
+ ;; https://github.com/ibus/ibus-anthy/issues/28).
+ #:tests? #f
#:configure-flags
;; Use absolute exec path in the anthy.xml.
#~(list (string-append "--libexecdir=" #$output "/libexec"))
;; The test suite fails (see:
;; https://github.com/ibus/ibus-anthy/issues/28).
- #:tests? #f
#:phases
#~(modify-phases %standard-phases
+ (add-after 'unpack 'fix-check
+ (lambda _
+ (substitute* "data/Makefile.in"
+ ;; Use a year current at the time the release was made, to
+ ;; avoid the "This year 2023 is not included in era.y"
+ ;; error.
+ (("`date '\\+%Y'`")
+ "2021"))))
+ (add-after 'unpack 'do-not-override-GI_TYPELIB_PATH
+ ;; Do not override the GI_TYPELIB_PATH to avoid the pygobject
+ ;; error: "ValueError: Namespace Gdk not available".
+ (lambda _
+ (substitute* "tests/test-build.sh"
+ (("GI_TYPELIB_PATH=\\$BUILDDIR/../gir" all)
+ (string-append all ":$GI_TYPELIB_PATH")))))
+ (add-before 'check 'prepare-for-tests
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ ;; IBus requires write access to the HOME directory.
+ (setenv "HOME" "/tmp")
+ ;; The single test is skipped if no actual display is found.
+ (system "Xvfb :1 &")
+ (setenv "DISPLAY" ":1"))))
(add-after 'install 'wrap-programs
(lambda* (#:key inputs #:allow-other-keys)
(for-each
@@ -376,7 +404,11 @@ Chinese pinyin input methods.")
`(,glib "bin")
intltool
pkg-config
- python))
+ procps ;for ps
+ python
+ python-pycotap
+ util-linux ;for getopt
+ xorg-server-for-tests))
(inputs
(list anthy
gtk+
diff --git a/gnu/packages/patches/ibus-anthy-fix-tests.patch b/gnu/packages/patches/ibus-anthy-fix-tests.patch
new file mode 100644
index 0000000000..6934358980
--- /dev/null
+++ b/gnu/packages/patches/ibus-anthy-fix-tests.patch
@@ -0,0 +1,49 @@
+Submitted upstream: https://github.com/ibus/ibus-anthy/pull/35
+
+diff --git a/tests/test-build.sh b/tests/test-build.sh
+index e83b78f..a0efe32 100755
+--- a/tests/test-build.sh
++++ b/tests/test-build.sh
+@@ -63,26 +63,27 @@ parse_args()
+ done;
+ }
+
++maybe_install_pycotap() {
++ # Check if pycotap is already available.
++ python3 -m pycotap >/dev/null && return 0
++
++ # Red Hat specific hint.
++ if test -f /etc/redhat-release ; then
++ if ! rpm -q --quiet python3-pycotap; then
++ echo "Please install python3-pycotap"
++ exit -1
++ fi
++ fi;
++}
++
+ init_environment()
+ {
+ if test x$FORCE_TEST != x ; then
+ RUN_ARGS="$RUN_ARGS --force";
+ fi;
+- HAS_TAP=0;
+- if test -f /etc/redhat-release ; then
+- rpm -q --quiet python3-pycotap
+- if test $? -ne 0 ; then
+- echo "Not found python3-pycotap";
+- exit -1;
+- fi;
+- HAS_TAP=1;
+- fi;
+- TAP_DIR=`python -m site --user-site`/pycotap;
+- if test $HAS_TAP -ne 1 && \
+- test x"$TAP_DIR" != x && test ! -d "$TAP_DIR" ; then
+- echo "pip install pycotap --user";
+- pip install pycotap --user;
+- fi;
++
++ maybe_install_pycotap
++
+ if test ! -f $BUILDDIR/../data/$ANTHY_SCHEMA_FILE ; then
+ echo "Not found $BUILDDIR/../data/$ANTHY_SCHEMA_FILE";
+ exit -1;