diff options
author | Einhard Leichtfuß <alguien@respiranto.de> | 2022-04-29 20:50:20 +0200 |
---|---|---|
committer | Einhard Leichtfuß <alguien@respiranto.de> | 2022-04-29 20:50:20 +0200 |
commit | cf41d66d911beaf3c65906c9d40a95f38bcbd681 (patch) | |
tree | 1a4e223925110b91a7a3abcd47a61c686337ae3a | |
parent | 4c3e069581b71b5a50a997f932936628f3729b9d (diff) |
Fix svn PKGBUILD: move sources to $_lang
This required allowing a fixed prepare() function and, for the optional,
dictionary-specific prepare() part to be inserted into such a fixed
prepare() function.
-rw-r--r-- | general-config.bash | 19 | ||||
-rw-r--r-- | svn/sample.PKGBUILD | 16 | ||||
-rwxr-xr-x | update.bash | 9 |
3 files changed, 27 insertions, 17 deletions
diff --git a/general-config.bash b/general-config.bash index 2c0cd6a..d3a8368 100644 --- a/general-config.bash +++ b/general-config.bash @@ -72,18 +72,17 @@ do done -# prepare() functions (indexed by $lang$ext). +# Optional prepare() function contents (indexed by $lang$ext). +# - Not necessarily the full function body, but possibly only a part of it. +# - We cannot assume to be in ${srcdir}. typeset -A prepare # Does not work for deu-fra-bin, since the index file must stay in sync. read -r -d '' prepare[deu-fra] << 'EOF' ||: -prepare() -{ - cd "$_lang" - sed -Ei \ - -e 's/(10)(10)(100\>)(\s+\(10)(Googol.*(1|Eins) mit einem Googol Nullen)/\1^(\2^\3)\4^\5/' \ - -e 's/(10)([1-9][0-9]*)(.*(1|Eins) mit \2 Nullen)/\1\^\2\3/' \ - -e 's/(die Zahl 10)(60)/\1^\2/' \ - "${_lang}.tei" -} +cd "${srcdir}${_lang}" +sed -Ei \ + -e 's/(10)(10)(100\>)(\s+\(10)(Googol.*(1|Eins) mit einem Googol Nullen)/\1^(\2^\3)\4^\5/' \ + -e 's/(10)([1-9][0-9]*)(.*(1|Eins) mit \2 Nullen)/\1\^\2\3/' \ + -e 's/(die Zahl 10)(60)/\1^\2/' \ + "${_lang}.tei" EOF diff --git a/svn/sample.PKGBUILD b/svn/sample.PKGBUILD index db637a3..a29aaf0 100644 --- a/svn/sample.PKGBUILD +++ b/svn/sample.PKGBUILD @@ -21,18 +21,24 @@ install="${pkgname}.install" source=("${pkgname}::svn+https://github.com/freedict/fd-dictionaries/trunk/${_lang}") sha512sums=('SKIP') -%PREPARE% +prepare() +{ + # The Makefile expects the TEI XML file to reside in a directory named + # ${_lang}. + mv "$pkgname" "$_lang" +%PREPARE_CONTENT% +} pkgver() { - cd "$pkgname" + cd "$_lang" local _ver="$(svnversion)" printf "r%s" "${_ver//[[:alpha:]]}" } build() { - cd "$pkgname" + cd "$_lang" make FREEDICT_TOOLS=/usr/lib/freedict-tools build-dictd } @@ -40,9 +46,9 @@ package() { install -m 755 -d "${pkgdir}/usr/share/dictd" install -m 644 -t "${pkgdir}/usr/share/dictd/" \ - "${pkgname}/build/dictd/${_lang}".{dict.dz,index} + "${_lang}/build/dictd/${_lang}".{dict.dz,index} - for file in "$pkgname"/{AUTHORS,README,NEWS,ChangeLog} + for file in "$_lang"/{AUTHORS,README,NEWS,ChangeLog} do if test -f "$file" then diff --git a/update.bash b/update.bash index 208d7f2..118aeb1 100755 --- a/update.bash +++ b/update.bash @@ -105,7 +105,12 @@ function update replace '_pkgver' 'pkgver' fi - replace_line '%PREPARE%' "${prepare[${lang}${ext}]}" rm-plus-one + local rstring_base="${prepare[${lang}${ext}]}" + local rstring + rstring=$'\n'"$(sed -E 's/^/\t/' <<< "$rstring_base")"$'\n' + replace_line '%PREPARE_CONTENT%' "${rstring_base:+${rstring}}" + rstring=$'prepare()\n{'"$rstring"$'}\n' + replace_line '%PREPARE%' "${rstring_base:+${rstring}}" rm-plus-one write PKGBUILD makepkg --printsrcinfo > .SRCINFO @@ -188,7 +193,7 @@ function handle_all_vcs for lang in "${vcs_langs[@]}" do - cd $lang || exit 1 + cd "$lang" || exit 1 $nopull || git pull -q pkgver="$(sed -En 's/\s*pkgver\s*=\s*(.+)\s*/\1/p' .SRCINFO)" makepkg --nobuild --nodeps > /dev/null 2>&1 |