From 4732973d3b05278fd11493bd3f021f14d0caf456 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Sat, 13 Jul 2024 00:39:26 +0900 Subject: [PATCH 1/7] Fix license-validate --- anthy-unicode.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/anthy-unicode.spec b/anthy-unicode.spec index 88953f5..4847d93 100644 --- a/anthy-unicode.spec +++ b/anthy-unicode.spec @@ -12,7 +12,7 @@ Name: anthy-unicode Version: 1.0.0.20240502 Release: %autorelease # The entire source code is LGPLv2+ and dictionaries is GPLv2. the corpus data is under Public Domain. -License: LGPL-2.0-or-later and GPL-2.0-or-later and LicenseRef-Fedora-Public-Domain +License: LGPL-2.0-or-later AND GPL-2.0-or-later AND LicenseRef-Fedora-Public-Domain URL: https://github.com/fujiwarat/anthy-unicode/wiki BuildRequires: emacs BuildRequires: gcc From 41d0118e05fa378622886d3a757a55c19af5e329 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Sat, 13 Jul 2024 10:13:27 +0900 Subject: [PATCH 2/7] Drop emacs.i686 --- anthy-unicode.spec | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/anthy-unicode.spec b/anthy-unicode.spec index 4847d93..e0c6918 100644 --- a/anthy-unicode.spec +++ b/anthy-unicode.spec @@ -7,6 +7,12 @@ %bcond_without xemacs %endif +# emacs.i686 has not been available since emacs-29.4-7.fc40 +%ifarch i686 +%bcond_with emacs +%else +%bcond_without emacs +%endif Name: anthy-unicode Version: 1.0.0.20240502 @@ -14,7 +20,9 @@ Release: %autorelease # The entire source code is LGPLv2+ and dictionaries is GPLv2. the corpus data is under Public Domain. License: LGPL-2.0-or-later AND GPL-2.0-or-later AND LicenseRef-Fedora-Public-Domain URL: https://github.com/fujiwarat/anthy-unicode/wiki +%if %{with emacs} BuildRequires: emacs +%endif BuildRequires: gcc BuildRequires: git %if %{with xemacs} @@ -44,6 +52,7 @@ user dictionaries and the users information which is used for the conversion, is stored into their own home directory. So Anthy Unicode is secure than other conversion server. +%if %{with emacs} %package -n emacs-%{pkg} Summary: Emacs files for %{pkg} Requires: %{name} = %{version}-%{release} @@ -53,6 +62,7 @@ BuildArch: noarch %description -n emacs-%{pkg} This package contains the byte compiled elips packages to run %{pkg} with GNU Emacs. +%endif %if %{with xemacs} %package -n xemacs-%{pkg} @@ -96,9 +106,11 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" # remove unnecessary files rm $RPM_BUILD_ROOT%{_libdir}/lib*.la +%if %{with emacs} ## for emacs-anthy mkdir -p $RPM_BUILD_ROOT%{_emacs_sitestartdir} install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_emacs_sitestartdir} +%endif %if %{with xemacs} ## for xemacs-anthy @@ -147,12 +159,14 @@ cd .. %{_libdir}/lib*.so.* %{_datadir}/%{pkg}/ +%if %{with emacs} %files -n emacs-%{pkg} %doc doc/ELISP %{_emacs_sitelispdir}/%{pkg}/*.el %{_emacs_sitelispdir}/%{pkg}/*.elc %{_emacs_sitestartdir}/*.el %dir %{_emacs_sitelispdir}/%{pkg} +%endif %if %{with xemacs} %files -n xemacs-%{pkg} From f73ccdfb76fbd2d4de9cf4ef96b109c6c5d91764 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Mon, 15 Jul 2024 14:57:21 +0900 Subject: [PATCH 3/7] Fix some compiler warnings - src-main/context.c: Fix warning[-Waddress] &ce->str will always evaluate as 'true' - mkworddic/mkdic.c: Fix warning[-Wformat-overflow=] '%s' directive argument is null --- anthy-unicode-HEAD.patch | 108 +++++++++++++++++++++++++++++++++++++++ anthy-unicode.spec | 1 + 2 files changed, 109 insertions(+) diff --git a/anthy-unicode-HEAD.patch b/anthy-unicode-HEAD.patch index e69de29..216e20c 100644 --- a/anthy-unicode-HEAD.patch +++ b/anthy-unicode-HEAD.patch @@ -0,0 +1,108 @@ +From a4a42a3c933a2f40023e6c857e60e0bf08a1d913 Mon Sep 17 00:00:00 2001 +From: fujiwarat +Date: Mon, 15 Jul 2024 14:53:17 +0900 +Subject: [PATCH] Fix some compiler warnings + +- src-main/context.c: Fix warning[-Waddress] + &ce->str will always evaluate as 'true' +- mkworddic/mkdic.c: Fix warning[-Wformat-overflow=] + '%s' directive argument is null +--- + mkworddic/mkdic.c | 21 +++++++++------------ + src-main/context.c | 5 ++--- + 2 files changed, 11 insertions(+), 15 deletions(-) + +diff --git a/mkworddic/mkdic.c b/mkworddic/mkdic.c +index b0f9f4c..cb68520 100644 +--- a/mkworddic/mkdic.c ++++ b/mkworddic/mkdic.c +@@ -60,8 +60,6 @@ + + #define DEFAULT_FN "anthy.wdic" + +-static const char *progname; +- + /* writewords.cからアクセスするために、global変数 */ + FILE *yomi_entry_index_out, *yomi_entry_out; + FILE *page_out, *page_index_out; +@@ -127,8 +125,7 @@ open_output_files(void) + } + /**/ + if (!(*(fs->fpp))) { +- fprintf (stderr, "%s: cannot open temporary file: %s\n", +- progname, strerror (errno)); ++ fprintf (stderr, "cannot open temporary file: %s\n", strerror (errno)); + exit (2); + } + } +@@ -142,13 +139,13 @@ flush_output_files (void) + struct file_section *fs; + for (fs = file_array; fs->fpp; fs ++) { + if (ferror(*(fs->fpp))) { +- fprintf (stderr, "%s: write error\n", progname); ++ fprintf (stderr, "write error\n"); + exit (1); + } + } + for (fs = file_array; fs->fpp; fs ++) { + if (fflush(*(fs->fpp))) { +- fprintf (stderr, "%s: write error: %s\n", progname, strerror (errno)); ++ fprintf (stderr, "write error: %s\n", strerror (errno)); + exit (1); + } + } +@@ -793,8 +790,8 @@ copy_file(struct mkdic_stat *mds, FILE *in, FILE *out) + while ((nread = fread (buf, 1, sizeof buf, in)) > 0) { + if (fwrite (buf, 1, nread, out) < nread) { + /* Handle short write (maybe disk full). */ +- fprintf (stderr, "%s: %s: write error: %s\n", +- progname, mds->output_fn, strerror (errno)); ++ fprintf (stderr, "%s: write error: %s\n", ++ mds->output_fn, strerror (errno)); + exit (1); + } + } +@@ -839,8 +836,8 @@ link_dics(struct mkdic_stat *mds) + + fp = fopen (mds->output_fn, "w"); + if (!fp) { +- fprintf (stderr, "%s: %s: cannot create: %s\n", +- progname, mds->output_fn, strerror (errno)); ++ fprintf (stderr, "%s: cannot create: %s\n", ++ mds->output_fn, strerror (errno)); + exit (1); + } + +@@ -856,8 +853,8 @@ link_dics(struct mkdic_stat *mds) + } + + if (fclose (fp)) { +- fprintf (stderr, "%s: %s: write error: %s\n", +- progname, mds->output_fn, strerror (errno)); ++ fprintf (stderr, "%s: write error: %s\n", ++ mds->output_fn, strerror (errno)); + exit (1); + } + } +diff --git a/src-main/context.c b/src-main/context.c +index d84858c..f117f7d 100644 +--- a/src-main/context.c ++++ b/src-main/context.c +@@ -706,12 +706,11 @@ anthy_do_print_context(struct anthy_context *ac, int encoding) + void + anthy_release_cand_ent(struct cand_ent *ce) + { ++ assert (ce); + if (ce->elm) { + free(ce->elm); + } +- if (&ce->str) { +- anthy_free_xstr_str(&ce->str); +- } ++ anthy_free_xstr_str(&ce->str); + free(ce); + } + +-- +2.45.0 + diff --git a/anthy-unicode.spec b/anthy-unicode.spec index e0c6918..842170f 100644 --- a/anthy-unicode.spec +++ b/anthy-unicode.spec @@ -42,6 +42,7 @@ Source1: https://github.com/fujiwarat/anthy-unicode/releases/download/%{version} Source2: %{name}-init.el # Upstreamed patches #Patch0: %%{name}-HEAD.patch +Patch0: %{name}-HEAD.patch Summary: Japanese character set input library for Unicode From 235965806601daf0231a8a54f833a20f8295185e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 17 Jul 2024 17:06:56 +0000 Subject: [PATCH 4/7] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From b275bea1863e8ca4df6bae36c108a14797e9b1a0 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Fri, 16 Aug 2024 11:08:08 +0900 Subject: [PATCH 5/7] Delete CI with STI CI with STI is archived in: https://src.fedoraproject.org/rpms/anthy-unicode/tree/ci-sti --- tests/tests.sh | 12 ------------ tests/tests.yml | 19 ------------------- 2 files changed, 31 deletions(-) delete mode 100755 tests/tests.sh delete mode 100644 tests/tests.yml diff --git a/tests/tests.sh b/tests/tests.sh deleted file mode 100755 index 9d18fcd..0000000 --- a/tests/tests.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -: ${SRCDIR:='./source'} - -anthy-dic-tool-unicode --load $SRCDIR/src-util/dic-tool-input -diff $HOME/.config/anthy/private_words_default $SRCDIR/src-util/dic-tool-result -anthy-dic-tool-unicode --dump -[ -d $HOME/.anthy ] || mkdir $HOME/.anthy -mv $HOME/.config/anthy/private_words_default $HOME/.anthy -anthy-dic-tool-unicode --migrate -diff $HOME/.config/anthy/private_words_default $SRCDIR/src-util/dic-tool-result - diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index c5f451c..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,19 +0,0 @@ -- hosts: localhost - tags: - - classic - roles: - - role: standard-test-source - required_packages: - - git - vars: - fetch_only: True - - role: standard-test-basic - #- role: standard-test-beakerlib - required_packages: - - bash - - anthy-unicode - tests: - - smoke1: - dir: . - run: ./tests.sh - From cbe7995d7ca0141d93fd9882349952465aeb6060 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Fri, 16 Aug 2024 20:23:11 +0900 Subject: [PATCH 6/7] Implement CI with TMT - Add dic-tool-* test files to devel package --- .fmf/version | 1 + anthy-unicode.spec | 9 ++++++++- plans/dict-test.fmf | 5 +++++ tests/migration/main.fmf | 15 +++++++++++++++ tests/migration/test.sh | 16 ++++++++++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .fmf/version create mode 100644 plans/dict-test.fmf create mode 100644 tests/migration/main.fmf create mode 100755 tests/migration/test.sh diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/anthy-unicode.spec b/anthy-unicode.spec index 842170f..0bfba64 100644 --- a/anthy-unicode.spec +++ b/anthy-unicode.spec @@ -107,6 +107,11 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" # remove unnecessary files rm $RPM_BUILD_ROOT%{_libdir}/lib*.la +pushd ./src-util +install -m 644 dic-tool-input $RPM_BUILD_ROOT%{_datadir}/%{pkg} +install -m 644 dic-tool-result $RPM_BUILD_ROOT%{_datadir}/%{pkg} +popd + %if %{with emacs} ## for emacs-anthy mkdir -p $RPM_BUILD_ROOT%{_emacs_sitestartdir} @@ -118,7 +123,7 @@ install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_emacs_sitestartdir} mkdir -p $RPM_BUILD_ROOT%{_xemacs_sitestartdir} install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_xemacs_sitestartdir} # FIXME lisp build -pushd $RPM_BUILD_DIR/%{name}-%{version}/src-util +pushd ./src-util make clean #make EMACS=xemacs lispdir="%%{_xemacs_sitelispdir}/%%{pkg}" # The latest /usr/share/automake-*/am/lisp.am calls -L option for @@ -182,6 +187,8 @@ cd .. %files devel %doc doc/DICLIB doc/DICUTIL doc/GLOSSARY doc/GRAMMAR doc/GUIDE.english doc/ILIB doc/LEARNING doc/LIB doc/MISC doc/POS doc/SPLITTER doc/TESTING doc/protocol.txt +%{_datadir}/%{pkg}/dic-tool-input +%{_datadir}/%{pkg}/dic-tool-result %{_includedir}/* %{_libdir}/lib*.so %{_libdir}/pkgconfig/*.pc diff --git a/plans/dict-test.fmf b/plans/dict-test.fmf new file mode 100644 index 0000000..9c5ae63 --- /dev/null +++ b/plans/dict-test.fmf @@ -0,0 +1,5 @@ +summary: anthy-unicode test +discover: + how: fmf +execute: + how: tmt diff --git a/tests/migration/main.fmf b/tests/migration/main.fmf new file mode 100644 index 0000000..843d404 --- /dev/null +++ b/tests/migration/main.fmf @@ -0,0 +1,15 @@ +summary: Migration tests of private dicts from anthy to anthy-unicode +test: ./test.sh +framework: beakerlib +require: + - anthy-unicode + - anthy-unicode-devel + - autoconf + - automake + - emacs + - fedpkg + - gcc + - git + - libtool + - make + - rpm-build diff --git a/tests/migration/test.sh b/tests/migration/test.sh new file mode 100755 index 0000000..a1bd50c --- /dev/null +++ b/tests/migration/test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +[ -d $HOME/.anthy ] || mkdir $HOME/.anthy + +rlJournalStart + rlPhaseStartTest + rlRun -t "anthy-dic-tool-unicode --load /usr/share/anthy-unicode/dic-tool-input" + rlRun -t "diff $HOME/.config/anthy/private_words_default /usr/share/anthy-unicode/dic-tool-result" + rlRun -t "anthy-dic-tool-unicode --dump" + rlRun -t "mv $HOME/.config/anthy/private_words_default $HOME/.anthy" + rlRun -t "anthy-dic-tool-unicode --migrate" + rlRun -t "diff $HOME/.config/anthy/private_words_default /usr/share/anthy-unicode/dic-tool-result" + rlPhaseEnd +rlJournalEnd From 4f8244a770aa3e624bbdd562c044a532d0a5225e Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Fri, 16 Aug 2024 20:27:23 +0900 Subject: [PATCH 7/7] Revert to drop emacs.i686 Fixes: https://src.fedoraproject.org/rpms/anthy-unicode/c/41d0118?branch=rawhide --- anthy-unicode.spec | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/anthy-unicode.spec b/anthy-unicode.spec index 0bfba64..587d7f2 100644 --- a/anthy-unicode.spec +++ b/anthy-unicode.spec @@ -7,12 +7,6 @@ %bcond_without xemacs %endif -# emacs.i686 has not been available since emacs-29.4-7.fc40 -%ifarch i686 -%bcond_with emacs -%else -%bcond_without emacs -%endif Name: anthy-unicode Version: 1.0.0.20240502 @@ -20,9 +14,7 @@ Release: %autorelease # The entire source code is LGPLv2+ and dictionaries is GPLv2. the corpus data is under Public Domain. License: LGPL-2.0-or-later AND GPL-2.0-or-later AND LicenseRef-Fedora-Public-Domain URL: https://github.com/fujiwarat/anthy-unicode/wiki -%if %{with emacs} BuildRequires: emacs -%endif BuildRequires: gcc BuildRequires: git %if %{with xemacs} @@ -53,7 +45,6 @@ user dictionaries and the users information which is used for the conversion, is stored into their own home directory. So Anthy Unicode is secure than other conversion server. -%if %{with emacs} %package -n emacs-%{pkg} Summary: Emacs files for %{pkg} Requires: %{name} = %{version}-%{release} @@ -63,7 +54,6 @@ BuildArch: noarch %description -n emacs-%{pkg} This package contains the byte compiled elips packages to run %{pkg} with GNU Emacs. -%endif %if %{with xemacs} %package -n xemacs-%{pkg} @@ -112,11 +102,9 @@ install -m 644 dic-tool-input $RPM_BUILD_ROOT%{_datadir}/%{pkg} install -m 644 dic-tool-result $RPM_BUILD_ROOT%{_datadir}/%{pkg} popd -%if %{with emacs} ## for emacs-anthy mkdir -p $RPM_BUILD_ROOT%{_emacs_sitestartdir} install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_emacs_sitestartdir} -%endif %if %{with xemacs} ## for xemacs-anthy @@ -165,14 +153,12 @@ cd .. %{_libdir}/lib*.so.* %{_datadir}/%{pkg}/ -%if %{with emacs} %files -n emacs-%{pkg} %doc doc/ELISP %{_emacs_sitelispdir}/%{pkg}/*.el %{_emacs_sitelispdir}/%{pkg}/*.elc %{_emacs_sitestartdir}/*.el %dir %{_emacs_sitelispdir}/%{pkg} -%endif %if %{with xemacs} %files -n xemacs-%{pkg}