commit:     7c6d22d36d75b98c922f4dd8b75b9b2977924574
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  9 07:32:20 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun  9 07:35:01 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c6d22d3

app-i18n/mozc: use savedconfig

Closes: https://bugs.gentoo.org/877765
Closes: https://bugs.gentoo.org/843227
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-i18n/mozc/metadata.xml              |  1 -
 app-i18n/mozc/mozc-2.28.5029.102.ebuild | 37 ++++++++++++++++++---------------
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/app-i18n/mozc/metadata.xml b/app-i18n/mozc/metadata.xml
index 36b5449ea94d..7fd885c8d62f 100644
--- a/app-i18n/mozc/metadata.xml
+++ b/app-i18n/mozc/metadata.xml
@@ -13,7 +13,6 @@
                <flag name="fcitx4">Enable support for 
<pkg>app-i18n/fcitx</pkg> 4</flag>
                <flag name="gui">Install graphical user interface tool 
(mozc_tool)</flag>
                <flag name="ibus">Enable support for 
<pkg>app-i18n/ibus</pkg></flag>
-               <flag name="mozcdic-ut">Enable support for Mozc UT 
Dictionaries. Must be placed at compile time at /tmp/mozcdic-ut.txt</flag>
                <flag name="renderer">Enable native candidate window</flag>
        </use>
        <upstream>

diff --git a/app-i18n/mozc/mozc-2.28.5029.102.ebuild 
b/app-i18n/mozc/mozc-2.28.5029.102.ebuild
index 366320f57f8f..d12f141d9a99 100644
--- a/app-i18n/mozc/mozc-2.28.5029.102.ebuild
+++ b/app-i18n/mozc/mozc-2.28.5029.102.ebuild
@@ -5,7 +5,7 @@ EAPI="8"
 
 PYTHON_COMPAT=( python3_{10..11} )
 
-inherit edo elisp-common multiprocessing python-any-r1 toolchain-funcs desktop 
xdg
+inherit desktop edo elisp-common multiprocessing python-any-r1 savedconfig 
toolchain-funcs xdg
 
 if [[ "${PV}" == "9999" ]]; then
        inherit git-r3
@@ -46,18 +46,21 @@ fi
 LICENSE="BSD BSD-2 ipadic public-domain unicode"
 SLOT="0"
 KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
-IUSE="debug emacs fcitx4 +gui ibus renderer test mozcdic-ut"
+IUSE="debug emacs fcitx4 +gui ibus renderer test"
 REQUIRED_USE="|| ( emacs fcitx4 ibus )"
 RESTRICT="!test? ( test )"
 
-BDEPEND="$(python_gen_any_dep 'dev-python/six[${PYTHON_USEDEP}]')
+BDEPEND="
+       $(python_gen_any_dep 'dev-python/six[${PYTHON_USEDEP}]')
        >=dev-libs/protobuf-3.0.0
        dev-util/gyp
        dev-util/ninja
        virtual/pkgconfig
        emacs? ( app-editors/emacs:* )
-       fcitx4? ( sys-devel/gettext )"
-DEPEND="dev-cpp/abseil-cpp:=[cxx17(+)]
+       fcitx4? ( sys-devel/gettext )
+"
+DEPEND="
+       dev-cpp/abseil-cpp:=[cxx17(+)]
        >=dev-libs/protobuf-3.0.0:=
        fcitx4? (
                app-i18n/fcitx:4
@@ -83,7 +86,8 @@ DEPEND="dev-cpp/abseil-cpp:=[cxx17(+)]
                >=dev-cpp/gtest-1.8.0
                dev-libs/jsoncpp
        )"
-RDEPEND="dev-cpp/abseil-cpp:=[cxx17(+)]
+RDEPEND="
+       dev-cpp/abseil-cpp:=[cxx17(+)]
        >=dev-libs/protobuf-3.0.0:=
        emacs? ( app-editors/emacs:* )
        fcitx4? (
@@ -105,7 +109,8 @@ RDEPEND="dev-cpp/abseil-cpp:=[cxx17(+)]
                x11-libs/cairo
                x11-libs/gtk+:2
                x11-libs/pango
-       )"
+       )
+"
 
 S="${WORKDIR}/${P}/src"
 
@@ -116,7 +121,7 @@ PATCHES=(
 )
 
 python_check_deps() {
-       has_version -b "dev-python/six[${PYTHON_USEDEP}]"
+       python_has_version "dev-python/six[${PYTHON_USEDEP}]"
 }
 
 src_unpack() {
@@ -189,15 +194,11 @@ src_prepare() {
                -e "/'-stdlib=libc++'/d" \
                -i gyp/common.gypi || die
 
-       # Add mozcdic-ut
-       if use mozcdic-ut; then
-               if [ ! -f "${BROOT}"/tmp/mozcdic-ut.txt ]; then
-                       ewarn "No mozcdic-ut.txt found. Please place your 
customized mozcdic-ut.txt in /tmp/.";
-                       die
-               else
-                       einfo "mozcdic-ut.txt found. Adding to mozc 
dictionary..."
-                       cat "${BROOT}"/tmp/mozcdic-ut.txt >> 
"${WORKDIR}/${P}/src/data/dictionary_oss/dictionary00.txt" || die
-               fi
+       # bug #877765
+       restore_config mozcdic-ut.txt
+       if [[ -f /mozcdic-ut.txt && -s mozcdic-ut.txt ]]; then
+               einfo "mozcdic-ut.txt found. Adding to mozc dictionary..."
+               cat mozcdic-ut.txt >> 
"${WORKDIR}/${P}/src/data/dictionary_oss/dictionary00.txt" || die
        fi
 }
 
@@ -287,6 +288,8 @@ src_install() {
        exeinto /usr/libexec/mozc
        doexe out_linux/${BUILD_TYPE}/mozc_server
 
+       [[ -s mozcdic-ut.txt ]] && save_config mozcdic-ut.txt
+
        if use gui; then
                doexe out_linux/${BUILD_TYPE}/mozc_tool
        fi

Reply via email to