summaryrefslogtreecommitdiff
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)
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 209556b56d4..3d3e54406b3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -897,6 +897,7 @@ dist_patch_DATA = \
897 %D%/packages/patches/akonadi-not-relocatable.patch \ 897 %D%/packages/patches/akonadi-not-relocatable.patch \
898 %D%/packages/patches/akonadi-timestamps.patch \ 898 %D%/packages/patches/akonadi-timestamps.patch \
899 %D%/packages/patches/allegro-mesa-18.2.5-and-later.patch \ 899 %D%/packages/patches/allegro-mesa-18.2.5-and-later.patch \
900 %D%/packages/patches/ibus-anthy-fix-tests.patch \
900 %D%/packages/patches/anki-mpv-args.patch \ 901 %D%/packages/patches/anki-mpv-args.patch \
901 %D%/packages/patches/antiword-CVE-2014-8123.patch \ 902 %D%/packages/patches/antiword-CVE-2014-8123.patch \
902 %D%/packages/patches/antlr3-3_1-fix-java8-compilation.patch \ 903 %D%/packages/patches/antlr3-3_1-fix-java8-compilation.patch \
diff --git a/gnu/packages/ibus.scm b/gnu/packages/ibus.scm
index d880956c566..e9294fab1ee 100644
--- a/gnu/packages/ibus.scm
+++ b/gnu/packages/ibus.scm
@@ -59,10 +59,12 @@
59 #:use-module (gnu packages gstreamer) 59 #:use-module (gnu packages gstreamer)
60 #:use-module (gnu packages gtk) 60 #:use-module (gnu packages gtk)
61 #:use-module (gnu packages iso-codes) 61 #:use-module (gnu packages iso-codes)
62 #:use-module (gnu packages linux)
62 #:use-module (gnu packages logging) 63 #:use-module (gnu packages logging)
63 #:use-module (gnu packages perl) 64 #:use-module (gnu packages perl)
64 #:use-module (gnu packages pkg-config) 65 #:use-module (gnu packages pkg-config)
65 #:use-module (gnu packages python) 66 #:use-module (gnu packages python)
67 #:use-module (gnu packages python-check)
66 #:use-module (gnu packages python-xyz) 68 #:use-module (gnu packages python-xyz)
67 #:use-module (gnu packages python-web) 69 #:use-module (gnu packages python-web)
68 #:use-module (gnu packages serialization) 70 #:use-module (gnu packages serialization)
@@ -348,18 +350,44 @@ Chinese pinyin input methods.")
348 version "/ibus-anthy-" version ".tar.gz")) 350 version "/ibus-anthy-" version ".tar.gz"))
349 (sha256 351 (sha256
350 (base32 352 (base32
351 "16vd0k8wm13s38869jqs3dnwmjvywgn0snnpyi41m28binhlssf8")))) 353 "16vd0k8wm13s38869jqs3dnwmjvywgn0snnpyi41m28binhlssf8"))
354 (patches (search-patches "ibus-anthy-fix-tests.patch"))))
352 (build-system gnu-build-system) 355 (build-system gnu-build-system)
353 (arguments 356 (arguments
354 (list 357 (list
358 ;; The test suite hangs (see:
359 ;; https://github.com/ibus/ibus-anthy/issues/28).
360 #:tests? #f
355 #:configure-flags 361 #:configure-flags
356 ;; Use absolute exec path in the anthy.xml. 362 ;; Use absolute exec path in the anthy.xml.
357 #~(list (string-append "--libexecdir=" #$output "/libexec")) 363 #~(list (string-append "--libexecdir=" #$output "/libexec"))
358 ;; The test suite fails (see: 364 ;; The test suite fails (see:
359 ;; https://github.com/ibus/ibus-anthy/issues/28). 365 ;; https://github.com/ibus/ibus-anthy/issues/28).
360 #:tests? #f
361 #:phases 366 #:phases
362 #~(modify-phases %standard-phases 367 #~(modify-phases %standard-phases
368 (add-after 'unpack 'fix-check
369 (lambda _
370 (substitute* "data/Makefile.in"
371 ;; Use a year current at the time the release was made, to
372 ;; avoid the "This year 2023 is not included in era.y"
373 ;; error.
374 (("`date '\\+%Y'`")
375 "2021"))))
376 (add-after 'unpack 'do-not-override-GI_TYPELIB_PATH
377 ;; Do not override the GI_TYPELIB_PATH to avoid the pygobject
378 ;; error: "ValueError: Namespace Gdk not available".
379 (lambda _
380 (substitute* "tests/test-build.sh"
381 (("GI_TYPELIB_PATH=\\$BUILDDIR/../gir" all)
382 (string-append all ":$GI_TYPELIB_PATH")))))
383 (add-before 'check 'prepare-for-tests
384 (lambda* (#:key tests? #:allow-other-keys)
385 (when tests?
386 ;; IBus requires write access to the HOME directory.
387 (setenv "HOME" "/tmp")
388 ;; The single test is skipped if no actual display is found.
389 (system "Xvfb :1 &")
390 (setenv "DISPLAY" ":1"))))
363 (add-after 'install 'wrap-programs 391 (add-after 'install 'wrap-programs
364 (lambda* (#:key inputs #:allow-other-keys) 392 (lambda* (#:key inputs #:allow-other-keys)
365 (for-each 393 (for-each
@@ -376,7 +404,11 @@ Chinese pinyin input methods.")
376 `(,glib "bin") 404 `(,glib "bin")
377 intltool 405 intltool
378 pkg-config 406 pkg-config
379 python)) 407 procps ;for ps
408 python
409 python-pycotap
410 util-linux ;for getopt
411 xorg-server-for-tests))
380 (inputs 412 (inputs
381 (list anthy 413 (list anthy
382 gtk+ 414 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 00000000000..6934358980b
--- /dev/null
+++ b/gnu/packages/patches/ibus-anthy-fix-tests.patch
@@ -0,0 +1,49 @@
1Submitted upstream: https://github.com/ibus/ibus-anthy/pull/35
2
3diff --git a/tests/test-build.sh b/tests/test-build.sh
4index e83b78f..a0efe32 100755
5--- a/tests/test-build.sh
6+++ b/tests/test-build.sh
7@@ -63,26 +63,27 @@ parse_args()
8 done;
9 }
10
11+maybe_install_pycotap() {
12+ # Check if pycotap is already available.
13+ python3 -m pycotap >/dev/null && return 0
14+
15+ # Red Hat specific hint.
16+ if test -f /etc/redhat-release ; then
17+ if ! rpm -q --quiet python3-pycotap; then
18+ echo "Please install python3-pycotap"
19+ exit -1
20+ fi
21+ fi;
22+}
23+
24 init_environment()
25 {
26 if test x$FORCE_TEST != x ; then
27 RUN_ARGS="$RUN_ARGS --force";
28 fi;
29- HAS_TAP=0;
30- if test -f /etc/redhat-release ; then
31- rpm -q --quiet python3-pycotap
32- if test $? -ne 0 ; then
33- echo "Not found python3-pycotap";
34- exit -1;
35- fi;
36- HAS_TAP=1;
37- fi;
38- TAP_DIR=`python -m site --user-site`/pycotap;
39- if test $HAS_TAP -ne 1 && \
40- test x"$TAP_DIR" != x && test ! -d "$TAP_DIR" ; then
41- echo "pip install pycotap --user";
42- pip install pycotap --user;
43- fi;
44+
45+ maybe_install_pycotap
46+
47 if test ! -f $BUILDDIR/../data/$ANTHY_SCHEMA_FILE ; then
48 echo "Not found $BUILDDIR/../data/$ANTHY_SCHEMA_FILE";
49 exit -1;