/[gentoo-x86]/eclass/myspell.eclass
Gentoo

Diff of /eclass/myspell.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 Revision 1.2
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/myspell.eclass,v 1.1 2006/05/01 15:24:39 kevquinn Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/myspell.eclass,v 1.2 2006/05/09 18:20:47 kevquinn Exp $
4 4
5EXPORT_FUNCTIONS src_install pkg_postinst pkg_prerm 5EXPORT_FUNCTIONS src_install pkg_preinst pkg_postinst
6 6
7IUSE="" 7IUSE=""
8 8
9SLOT="0" 9SLOT="0"
10 10
130 set_fields "${entry}" "," 130 set_fields "${entry}" ","
131 echo "THES ${fields[0]} ${fields[1]} ${fields[2]}" >> ${dictlst} 131 echo "THES ${fields[0]} ${fields[1]} ${fields[2]}" >> ${dictlst}
132 doins ${fields[2]}.dat || die "Missing ${fields[2]}.dat" 132 doins ${fields[2]}.dat || die "Missing ${fields[2]}.dat"
133 doins ${fields[2]}.idx || die "Missing ${fields[2]}.idx" 133 doins ${fields[2]}.idx || die "Missing ${fields[2]}.idx"
134 done 134 done
135 doins ${dictlst} || die "Failed to install ${dictlist}" 135 doins ${dictlst} || die "Failed to install ${dictlst}"
136 # Install any txt files (usually README.txt) as documentation 136 # Install any txt files (usually README.txt) as documentation
137 for filen in $(ls *.txt 2> /dev/null); do 137 for filen in $(ls *.txt 2> /dev/null); do
138 dodoc ${filen} 138 dodoc ${filen}
139 done 139 done
140} 140}
158 grep "^${fields[0]} ${fields[1]} ${fields[2]} " \ 158 grep "^${fields[0]} ${fields[1]} ${fields[2]} " \
159 ${MYSPELL_OOOBASE}/dictionary.lst > /dev/null 2>&1 || 159 ${MYSPELL_OOOBASE}/dictionary.lst > /dev/null 2>&1 ||
160 echo "${entry}" >> ${MYSPELL_OOOBASE}/dictionary.lst 160 echo "${entry}" >> ${MYSPELL_OOOBASE}/dictionary.lst
161 for suffix in $(get_myspell_suffixes ${fields[0]}); do 161 for suffix in $(get_myspell_suffixes ${fields[0]}); do
162 filen="${fields[3]}${suffix}" 162 filen="${fields[3]}${suffix}"
163 [[ -h ${MYSPELL_OOOBASE}/${filen} ]] &&
164 rm -f ${MYSPELL_OOOBASE}/${filen}
163 [[ ! -f ${MYSPELL_OOOBASE}/${filen} ]] && 165 [[ ! -f ${MYSPELL_OOOBASE}/${filen} ]] &&
164 ln -s ${MYSPELL_DICTBASE}/${filen} \ 166 ln -s ${MYSPELL_DICTBASE}/${filen} \
165 ${MYSPELL_OOOBASE}/${filen} 167 ${MYSPELL_OOOBASE}/${filen}
166 done 168 done
167 done < ${MYSPELL_DICTBASE}/${dictlst} 169 done < ${MYSPELL_DICTBASE}/${dictlst}
168} 170}
169 171
170 172
171# Remove softlinks and entries in dictionary.lst - uses 173# Remove softlinks and entries in dictionary.lst - uses
172# dictionary.<lang>.lst from /usr/share/myspell so has to 174# dictionary.<lang>.lst from /usr/share/myspell
173# be prerm not postrm. 175# Done in preinst (prerm happens after postinst, which overwrites
176# the dictionary.<lang>.lst file)
174myspell_pkg_prerm() { 177myspell_pkg_preinst() {
175 local filen dictlst entry fields removeentry suffix 178 local filen dictlst entry fields removeentry suffix
176 dictlst="dictionary.lst.$(get_myspell_lang)" 179 dictlst="dictionary.lst.$(get_myspell_lang)"
177 [[ -d ${MYSPELL_OOOBASE} ]] || return 180 [[ -d ${MYSPELL_OOOBASE} ]] || return
181 [[ -f ${MYSPELL_DICTBASE}/${dictlst} ]] || return
178 while read entry; do 182 while read entry; do
179 fields=(${entry}) 183 fields=(${entry})
180 [[ ${fields[0]:0:1} == "#" ]] && continue 184 [[ ${fields[0]:0:1} == "#" ]] && continue
185 [[ ${fields[3]} == "" ]] && continue
181 # Remove entry from dictionary.lst 186 # Remove entry from dictionary.lst
182 sed -i -e "/^${fields[0]} ${fields[1]} ${fields[2]} ${fields[3]}$/ { d }" \ 187 sed -i -e "/^${fields[0]} ${fields[1]} ${fields[2]} ${fields[3]}$/ { d }" \
183 ${MYSPELL_OOOBASE}/dictionary.lst 188 ${MYSPELL_OOOBASE}/dictionary.lst
184 # See if any other entries in dictionary.lst match the current 189 # See if any other entries in dictionary.lst match the current
185 # dictionary type and filename 190 # dictionary type and filename
186 grep "^${fields[0]} .* ${fields[3]}$" ${MYSPELL_OOOBASE}/dictionary.lst \ 191 grep "^${fields[0]} .* ${fields[3]}$" ${MYSPELL_OOOBASE}/dictionary.lst \
187 2>&1 > /dev/null && continue 192 2>&1 > /dev/null && continue
188 # If no other entries match, remove relevant symlinks 193 # If no other entries match, remove relevant symlinks
189 for suffix in $(get_myspell_suffixes ${fields[0]}); do 194 for suffix in $(get_myspell_suffixes ${fields[0]}); do
190 filen="${fields[3]}${suffix}" 195 filen="${fields[3]}${suffix}"
196 ewarn "Removing entry ${MYSPELL_OOOBASE}/${filen}"
191 if [[ -h ${MYSPELL_OOOBASE}/${filen} ]]; then 197 [[ -h ${MYSPELL_OOOBASE}/${filen} ]] &&
192 rm -f ${MYSPELL_OOOBASE}/${filen} 198 rm -f ${MYSPELL_OOOBASE}/${filen}
193 fi
194 done 199 done
195
196 done < ${MYSPELL_DICTBASE}/${dictlst} 200 done < ${MYSPELL_DICTBASE}/${dictlst}
197} 201}
198 202

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.20