Open WCX1024979076 opened 4 days ago
很好很强大,我不懂AUR 你可以维护在AUR上
release it to AUR to let us take a try :smile:
Where is package.patch?
rime-frost should have a conflicts=(rime-luna-pinyin)
and provides=(rime-luna-pinyin)
. Because it provides same files as rime-luna-pinyin such as double_pinyin_mspy, the only difference is it use rime-frost as dictionary, not rime-luna-pinyin.
The patch is to fix a bug (maybe not a bug, only appears in AUR packages). The package installed by AUR needs to be installed under /usr/share/rime-data
, which causes lua/aux_code.lua:76
to not find the lua/aux_code/moqi_aux_code.txt
file.
package.patch
diff --color --unified --recursive --text rime-frost/lua/aux_code.lua rime-frost-new/lua/aux_code.lua
--- rime-frost/lua/aux_code.lua 2024-10-17 15:06:34.987178552 +0800
+++ rime-frost-new/lua/aux_code.lua 2024-10-17 15:21:06.655348549 +0800
@@ -70,8 +70,9 @@
local defaultFile = 'moqi_aux_code.txt'
local userPath = rime_api.get_user_data_dir() .. "/lua/aux_code/"
local fileAbsolutePath = userPath .. txtpath .. ".txt"
+ local fileRelativePath = '/usr/share/rime-data/'
- local file = io.open(fileAbsolutePath, "r") or io.open(userPath .. defaultFile, "r")
+ local file = io.open(fileAbsolutePath, "r") or io.open(userPath .. defaultFile, "r") or io.open(fileRelativePath .. "/lua/aux_code/moqi_aux_code.txt")
if not file then
error("Unable to open auxiliary code file.")
return {}
aux_code.lua (after patch)
function AuxFilter.readAuxTxt(txtpath)
-- log.info("** AuxCode filter", 'read Aux code txt:', txtpath)
local defaultFile = 'moqi_aux_code.txt'
local userPath = rime_api.get_user_data_dir() .. "/lua/aux_code/"
local fileAbsolutePath = userPath .. txtpath .. ".txt"
local fileRelativePath = '/usr/share/rime-data/'
local file = io.open(fileAbsolutePath, "r") or io.open(userPath .. defaultFile, "r") or io.open(fileRelativePath .. "/lua/aux_code/moqi_aux_code.txt")
if not file then
error("Unable to open auxiliary code file.")
return {}
end
aux_code.lua (before patch) https://github.com/gaboolic/rime-frost/blob/1daf5e1e8ee087ab6ecf73ac9cbfcfaaf50d59ee/lua/aux_code.lua#L67
rime-frost should have a
conflicts=(rime-luna-pinyin)
andprovides=(rime-luna-pinyin)
. Because it provides same files as rime-luna-pinyin such as double_pinyin_mspy, the only difference is it use rime-frost as dictionary, not rime-luna-pinyin.
OK, I'll change it.
PKGBUILD
# Maintainer: TimWcx <timwcx#qq.com>
_pkgbase=rime-frost
pkgname=${_pkgbase}-git
pkgver=r210.1daf5e1
pkgrel=1
pkgdesc="Rime 配置:白霜词库 | 蒹葭苍苍,白露为霜。基于雾凇拼音重制的,更纯净、词频准确、智能的词库。"
arch=("any")
url="https://github.com/gaboolic/rime-frost"
license=("GPL-3.0-or-later")
depends=("lua" "librime")
makedepends=("git" "rime-prelude" "sed")
conflicts=(
rime-luna-pinyin
rime-emoji
rime-ice-git
rime-ice-pinyin-git
rime-ice-double-pinyin-git
rime-ice-double-pinyin-abc-git
rime-ice-double-pinyin-mspy-git
rime-ice-double-pinyin-sogou-git
rime-ice-double-pinyin-flypy-git
rime-ice-double-pinyin-ziguang-git
)
provides=(rime-luna-pinyin)
source=("${_pkgbase}::git+${url}.git" "package.patch")
sha512sums=("SKIP"
be94577ee610847ecb17aa1a22d4341bb124dd1b50a89a06b512e9b16370340e16284268985bebec7472482a9ee8e3b24a84a066829877d8e9e8307d69b6eb0e)
_schemas=(
rime_frost
double_pinyin
double_pinyin_abc
double_pinyin_mspy
double_pinyin_sogou
double_pinyin_flypy
double_pinyin_ziguang
)
pkgver() {
cd "${_pkgbase}" &&
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
_suggestion=${_pkgbase//-/_}_suggestion.yaml
prepare() {
cd "${_pkgbase}" &&
mv ./default.yaml "./${_suggestion}" &&
# Link essentials.
for _f in $(pacman -Qql rime-prelude | grep -v "/$"); do ln -sf "$_f" .; done &&
patch --forward --strip=1 --input="../package.patch"
}
build() {
cd "${_pkgbase}" || return
_schemas_deps=()
for _s in "${_schemas[@]}"; do
_deps=()
mapfile -t _deps <<< "$(sed -n '/dependencies:/,/^$/ {/dependencies:/d; /^$/d; s/.*- *//g; s/ *#.*//g; p }' "$_s.schema.yaml")"
_schemas_deps=("${_schemas_deps[@]}" "${_deps[@]}")
done
mapfile -t _schemas_deps <<< "$(printf "%s\n" "${_schemas_deps[@]}" | sort -u)"
# build current schema and it's depends only, sort by length
_compile_schemas=("${_schemas_deps[@]}" "${_schemas[@]}")
for _s in "${_compile_schemas[@]}"; do rime_deployer --compile "$_s.schema.yaml"; done
# comment ignore schemas
_suggestion_schemas=$(sed -n '/^schema_list:/,/^$/ {/^schema_list:/d; /^\s*#.*$/d; /^$/d; s/.*schema:\s*//g; s/\s*#.*//g; p }' "$_suggestion")
for _s in $_suggestion_schemas; do
if [[ ! ${_schemas[*]} =~ (^|[[:space:]])"$_s"($|[[:space:]]) ]]; then
sed -i "s/^\s*- schema: $_s .*\$/#&/" "$_suggestion";
fi
done
find . -type l -delete
}
package() {
cd "${_pkgbase}" || return
_install_base="$pkgdir/usr/share/rime-data"
install -Dm644 "$_suggestion" -t "$_install_base/"
install -Dm644 ./build/*.{bin,yaml} -t "$_install_base/build"
[ -f "./rime.lua" ] && install -Dm644 ./rime.lua -t "$_install_base/"
find lua -type f -exec sh -c 'install -Dm644 "$1" -t '"$_install_base"'/$(dirname $1)' shell {} \;
for _f in *.schema.yaml; do
if [ -f "build/$_f" ]; then
install -Dm644 "$_f" -t "$_install_base/"
grep -q "opencc_config: emoji.json" "$_f" &&
install -Dm644 ./opencc/* -t "$_install_base/opencc/"
fi
done
for _f in *.dict.yaml; do
if [ -f "build/${_f/.dict.yaml/}.table.bin" ]; then
install -Dm644 "$_f" -t "$_install_base/"
fi
done
for _f in */*.dict.yaml; do
if grep -q "\- ${_f/.dict.yaml/}" "$_install_base/"*.dict.yaml; then
install -Dm644 "$_f" -t "$_install_base/$(dirname "$_f")"
fi
done
for _f in *.yaml; do
if grep -q "${_f/.yaml/:}" build/*.schema.yaml; then
install -Dm644 "$_f" -t "$_install_base/"
fi
done
}
感谢大家
作者您好,我是
rime-frost
的新用户+rime
的新用户+archlinux
用户,这两天我用了一下rime-frost
感觉体验良好,所以就想把rime-frost
打包到Arch User Repository(AUR)
上,之前的雾凇拼音在AUR
上有人维护,链接在https://aur.archlinux.org/packages/rime-ice-git,目前我已经写好了AUR打包文件PKGBUILD
想征求一下大佬的意见,另附PKGBUILD
代码。