Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sun, 03 Nov 2019 09:29:16
Message-Id: 1572773340.c5c1c0c5296e681389f5ae537784a31f35fd78e9.mgorny@gentoo
1 commit: c5c1c0c5296e681389f5ae537784a31f35fd78e9
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 3 08:58:36 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 3 09:29:00 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5c1c0c5
7
8 myspell.eclass: Remove last rited eclass
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 eclass/myspell.eclass | 259 --------------------------------------------------
13 1 file changed, 259 deletions(-)
14
15 diff --git a/eclass/myspell.eclass b/eclass/myspell.eclass
16 deleted file mode 100644
17 index af639b00e06..00000000000
18 --- a/eclass/myspell.eclass
19 +++ /dev/null
20 @@ -1,259 +0,0 @@
21 -# Copyright 1999-2015 Gentoo Foundation
22 -# Distributed under the terms of the GNU General Public License v2
23 -
24 -# Author: Kevin F. Quinn <kevquinn@g.o>
25 -# Packages: app-dicts/myspell-*
26 -# Maintainer: maintainer-needed@g.o
27 -
28 -# @DEAD
29 -# Replaced by myspell-r2.eclass. Removal in 14 days.
30 -
31 -inherit multilib
32 -
33 -EXPORT_FUNCTIONS src_install pkg_preinst pkg_postinst
34 -
35 -IUSE=""
36 -
37 -SLOT="0"
38 -
39 -# tar, gzip, bzip2 are included in the base profile, but not unzip
40 -DEPEND="app-arch/unzip"
41 -
42 -# Dictionaries don't have any runtime dependencies
43 -# Myspell dictionaries can be used by hunspell, openoffice and others
44 -RDEPEND=""
45 -
46 -# The destination directory for myspell dictionaries
47 -MYSPELL_DICTBASE="/usr/share/myspell"
48 -
49 -# Legacy variable for dictionaries installed before eselect-oodict existed
50 -# so has to remain for binpkg support. This variable is unmaintained -
51 -# if you have a problem with it, emerge app-eselect/eselect-oodict.
52 -# The location for openoffice softlinks
53 -MYSPELL_OOOBASE="/usr/lib/openoffice/share/dict/ooo"
54 -
55 -
56 -# set array "fields" to the elements of $1, separated by $2.
57 -# This saves having to muck about with IFS all over the place.
58 -set_fields() {
59 - local old_IFS
60 - old_IFS="${IFS}"
61 - IFS=$2
62 - fields=($1)
63 - IFS="${old_IFS}"
64 -}
65 -
66 -# language is the second element of the ebuild name
67 -# myspell-<lang>-<version>
68 -get_myspell_lang() {
69 - local fields
70 - set_fields "${P}" "-"
71 - echo ${fields[1]}
72 -}
73 -
74 -get_myspell_suffixes() {
75 - case $1 in
76 - DICT) echo ".aff .dic" ;;
77 - HYPH) echo ".dic" ;;
78 - THES) echo ".dat .idx" ;;
79 - esac
80 -}
81 -
82 -# OOo dictionary files are held on the mirrors, rather than
83 -# being fetched direct from the OOo site as upstream doesn't
84 -# change the name when they rebuild the dictionaries.
85 -# <lang>-<country>.zip becomes myspell-<lang>-<country>-version.zip
86 -get_myspell_ooo_uri() {
87 - local files fields newfile filestem srcfile dict uris
88 - files=()
89 - uris=""
90 - for dict in \
91 - "${MYSPELL_SPELLING_DICTIONARIES[@]}" \
92 - "${MYSPELL_HYPHENATION_DICTIONARIES[@]}" \
93 - "${MYSPELL_THESAURUS_DICTIONARIES[@]}"; do
94 - set_fields "${dict}" ","
95 - newfile=${fields[4]// }
96 - for file in "${files[@]}"; do
97 - [[ ${file} == ${newfile} ]] && continue 2
98 - done
99 - filestem=${newfile/.zip}
100 - files=("${files[@]}" "${newfile}")
101 - srcfile="myspell-${filestem}-${PV}.zip"
102 - [[ -z ${uris} ]] &&
103 - uris="mirror://gentoo/${srcfile}" ||
104 - uris="${uris} mirror://gentoo/${srcfile}"
105 - done
106 - echo "${uris}"
107 -}
108 -
109 -
110 -[[ -z ${SRC_URI} ]] && SRC_URI=$(get_myspell_ooo_uri)
111 -
112 -# Format of dictionary.lst files (from OOo standard
113 -# dictionary.lst file):
114 -#
115 -# List of All Dictionaries to be Loaded by OpenOffice
116 -# ---------------------------------------------------
117 -# Each Entry in the list have the following space delimited fields
118 -#
119 -# Field 0: Entry Type "DICT" - spellchecking dictionary
120 -# "HYPH" - hyphenation dictionary
121 -# "THES" - thesaurus files
122 -#
123 -# Field 1: Language code from Locale "en" or "de" or "pt" ...
124 -#
125 -# Field 2: Country Code from Locale "US" or "GB" or "PT"
126 -#
127 -# Field 3: Root name of file(s) "en_US" or "hyph_de" or "th_en_US"
128 -# (do not add extensions to the name)
129 -
130 -# Format of MYSPELL_[SPELLING|HYPHENATION|THESAURUS]_DICTIONARIES:
131 -#
132 -# Field 0: Language code
133 -# Field 1: Country code
134 -# Field 2: Root name of dictionary files
135 -# Field 3: Description
136 -# Field 4: Archive filename
137 -#
138 -# This format is from the available.lst, hyphavail.lst and
139 -# thesavail.lst files on the openoffice.org repository.
140 -
141 -myspell_src_install() {
142 - local filen fields entry dictlst
143 - cd "${WORKDIR}"
144 - # Install the dictionary, hyphenation and thesaurus files.
145 - # Create dictionary.lst.<lang> file containing the parts of
146 - # OOo's dictionary.lst file for this language, indicating
147 - # which dictionaries are relevant for each country variant
148 - # of the language.
149 - insinto ${MYSPELL_DICTBASE}
150 - dictlst="dictionary.lst.$(get_myspell_lang)"
151 - echo "# Autogenerated by ${CATEGORY}/${P}" > ${dictlst}
152 - for entry in "${MYSPELL_SPELLING_DICTIONARIES[@]}"; do
153 - set_fields "${entry}" ","
154 - echo "DICT ${fields[0]} ${fields[1]} ${fields[2]}" >> ${dictlst}
155 - doins ${fields[2]}.aff || die "Missing ${fields[2]}.aff"
156 - doins ${fields[2]}.dic || die "Missing ${fields[2]}.dic"
157 - done
158 - for entry in "${MYSPELL_HYPHENATION_DICTIONARIES[@]}"; do
159 - set_fields "${entry}" ","
160 - echo "HYPH ${fields[0]} ${fields[1]} ${fields[2]}" >> ${dictlst}
161 - doins ${fields[2]}.dic || die "Missing ${fields[2]}.dic"
162 - done
163 - for entry in "${MYSPELL_THESAURUS_DICTIONARIES[@]}"; do
164 - set_fields "${entry}" ","
165 - echo "THES ${fields[0]} ${fields[1]} ${fields[2]}" >> ${dictlst}
166 - doins ${fields[2]}.dat || die "Missing ${fields[2]}.dat"
167 - doins ${fields[2]}.idx || die "Missing ${fields[2]}.idx"
168 - done
169 - doins ${dictlst} || die "Failed to install ${dictlst}"
170 - # Install any txt files (usually README.txt) as documentation
171 - for filen in *.txt; do
172 - [[ -s ${filen} ]] && dodoc ${filen}
173 - done
174 -}
175 -
176 -
177 -# Add entries in dictionary.lst.<lang> to OOo dictionary.lst
178 -# and create softlinks indicated by dictionary.lst.<lang>
179 -myspell_pkg_postinst() {
180 - # Update for known applications
181 - if has_version ">=app-eselect/eselect-oodict-20060706"; then
182 - if has_version app-office/openoffice; then
183 - eselect oodict set myspell-$(get_myspell_lang)
184 - fi
185 - if has_version app-office/openoffice-bin; then
186 - # On AMD64, openoffice-bin is 32-bit so force ABI
187 - has_multilib_profile && ABI=x86
188 - eselect oodict set myspell-$(get_myspell_lang) --libdir $(get_libdir)
189 - fi
190 - return
191 - fi
192 - if has_version app-eselect/eselect-oodict; then
193 - eselect oodict set myspell-$(get_myspell_lang)
194 - return
195 - fi
196 -
197 - # Legacy code for dictionaries installed before eselect-oodict existed
198 - # so has to remain for binpkg support. This code is unmaintained -
199 - # if you have a problem with it, emerge app-eselect/eselect-oodict.
200 - [[ -d ${MYSPELL_OOOBASE} ]] || return
201 - # This stuff is here, not in src_install, as the softlinks are
202 - # deliberately _not_ listed in the package database.
203 - local dictlst entry fields prefix suffix suffixes filen
204 - # Note; can only reach this point if ${MYSPELL_DICTBASE}/${dictlst}
205 - # was successfully installed
206 - dictlst="dictionary.lst.$(get_myspell_lang)"
207 - while read entry; do
208 - fields=(${entry})
209 - [[ ${fields[0]:0:1} == "#" ]] && continue
210 - [[ -f ${MYSPELL_OOOBASE}/dictionary.lst ]] || \
211 - touch ${MYSPELL_OOOBASE}/dictionary.lst
212 - grep "^${fields[0]} ${fields[1]} ${fields[2]} " \
213 - ${MYSPELL_OOOBASE}/dictionary.lst > /dev/null 2>&1 ||
214 - echo "${entry}" >> ${MYSPELL_OOOBASE}/dictionary.lst
215 - for suffix in $(get_myspell_suffixes ${fields[0]}); do
216 - filen="${fields[3]}${suffix}"
217 - [[ -h ${MYSPELL_OOOBASE}/${filen} ]] &&
218 - rm -f ${MYSPELL_OOOBASE}/${filen}
219 - [[ ! -f ${MYSPELL_OOOBASE}/${filen} ]] &&
220 - ln -s ${MYSPELL_DICTBASE}/${filen} \
221 - ${MYSPELL_OOOBASE}/${filen}
222 - done
223 - done < ${MYSPELL_DICTBASE}/${dictlst}
224 -}
225 -
226 -
227 -# Remove softlinks and entries in dictionary.lst - uses
228 -# dictionary.<lang>.lst from /usr/share/myspell
229 -# Done in preinst (prerm happens after postinst, which overwrites
230 -# the dictionary.<lang>.lst file)
231 -myspell_pkg_preinst() {
232 - # Update for known applications
233 - if has_version ">=app-eselect/eselect-oodict-20060706"; then
234 - if has_version app-office/openoffice; then
235 - # When building from source, the default library path is correct
236 - eselect oodict unset myspell-$(get_myspell_lang)
237 - fi
238 - if has_version app-office/openoffice-bin; then
239 - # On AMD64, openoffice-bin is 32-bit, so get 32-bit library directory
240 - has_multilib_profile && ABI=x86
241 - eselect oodict unset myspell-$(get_myspell_lang) --libdir $(get_libdir)
242 - fi
243 - eselect oodict unset myspell-$(get_myspell_lang) --libdir $(get_libdir)
244 - return
245 - fi
246 - # Previous versions of eselect-oodict didn't cater for -bin on amd64
247 - if has_version app-eselect/eselect-oodict; then
248 - eselect oodict unset myspell-$(get_myspell_lang)
249 - return
250 - fi
251 -
252 - # Legacy code for dictionaries installed before eselect-oodict existed
253 - # Don't delete this; needed for uninstalls and binpkg support.
254 - # This code is unmaintained - if you have a problem with it,
255 - # emerge app-eselect/eselect-oodict.
256 - local filen dictlst entry fields removeentry suffix
257 - dictlst="dictionary.lst.$(get_myspell_lang)"
258 - [[ -d ${MYSPELL_OOOBASE} ]] || return
259 - [[ -f ${MYSPELL_DICTBASE}/${dictlst} ]] || return
260 - while read entry; do
261 - fields=(${entry})
262 - [[ ${fields[0]:0:1} == "#" ]] && continue
263 - [[ ${fields[3]} == "" ]] && continue
264 - # Remove entry from dictionary.lst
265 - sed -i -e "/^${fields[0]} ${fields[1]} ${fields[2]} ${fields[3]}$/ { d }" \
266 - ${MYSPELL_OOOBASE}/dictionary.lst
267 - # See if any other entries in dictionary.lst match the current
268 - # dictionary type and filename
269 - grep "^${fields[0]} .* ${fields[3]}$" ${MYSPELL_OOOBASE}/dictionary.lst \
270 - 2>&1 > /dev/null && continue
271 - # If no other entries match, remove relevant symlinks
272 - for suffix in $(get_myspell_suffixes ${fields[0]}); do
273 - filen="${fields[3]}${suffix}"
274 - ewarn "Removing entry ${MYSPELL_OOOBASE}/${filen}"
275 - [[ -h ${MYSPELL_OOOBASE}/${filen} ]] &&
276 - rm -f ${MYSPELL_OOOBASE}/${filen}
277 - done
278 - done < ${MYSPELL_DICTBASE}/${dictlst}
279 -}