From f29717b10ff248d33ac3b45c30d712f83af61c582f72bcc2eaf31275778b548b Mon Sep 17 00:00:00 2001 From: Petr Gajdos Date: Wed, 7 May 2014 09:27:23 +0000 Subject: [PATCH] - updated to 20140507 * fdo#73544 update catalan linguistic components - improve dictionary file names OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/myspell-dictionaries?expand=0&rev=15 --- dictionaries.tar.xz | 4 +- myspell-dictionaries.changes | 7 ++++ myspell-dictionaries.spec | 3 +- myspell-dictionaries.spec.in | 1 - update.sh | 75 ++++++++++++++++++++++++------------ 5 files changed, 60 insertions(+), 30 deletions(-) diff --git a/dictionaries.tar.xz b/dictionaries.tar.xz index 440ae09..44de4c8 100644 --- a/dictionaries.tar.xz +++ b/dictionaries.tar.xz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e5870534e61833b3296cd3429643e545edec753e516ce52fe336c96914694bb -size 40905732 +oid sha256:3b82b36bb0d0e0d8df2fc2307f1f6b9b45834a82b57e1a5d9b93c2cfa910651d +size 40909140 diff --git a/myspell-dictionaries.changes b/myspell-dictionaries.changes index 75acdfe..558e033 100644 --- a/myspell-dictionaries.changes +++ b/myspell-dictionaries.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed May 7 09:24:10 UTC 2014 - pgajdos@suse.com + +- updated to 20140507 + * fdo#73544 update catalan linguistic components +- improve dictionary file names + ------------------------------------------------------------------- Tue May 6 15:22:09 UTC 2014 - pgajdos@suse.com diff --git a/myspell-dictionaries.spec b/myspell-dictionaries.spec index 0c30964..d67184a 100644 --- a/myspell-dictionaries.spec +++ b/myspell-dictionaries.spec @@ -21,7 +21,7 @@ ## Generate: sh update.sh ################################################################### Name: myspell-dictionaries -Version: 20140417 +Version: 20140507 Release: 0 Summary: A Source Package for Dictionaries Used by MySpell License: AGPL-3.0 and BSD-2-Clause and BSD-3-Clause and BSD-4-Clause and CC-BY-SA-1.0 and CC-BY-SA-3.0 and GFDL-1.1 and GPL-2.0 and GPL-2.0+ and GPL-3.0 and GPL-3.0+ and LGPL-2.0 and LGPL-2.1 and LGPL-2.1+ and LGPL-3.0 and LGPL-3.0+ and MPL-1.1 @@ -994,7 +994,6 @@ function install_dictionary_files if [ ! -z "$files" ]; then for file in $files; do - echo "LOCALE: $locale_dir SYSTEM_DIR: $system_dir FILE: $file" # install file cp -P $file %{buildroot}%{_datadir}/$system_dir/ # symlink diff --git a/myspell-dictionaries.spec.in b/myspell-dictionaries.spec.in index 7e7c254..5158a42 100644 --- a/myspell-dictionaries.spec.in +++ b/myspell-dictionaries.spec.in @@ -194,7 +194,6 @@ function install_dictionary_files if [ ! -z "$files" ]; then for file in $files; do - echo "LOCALE: $locale_dir SYSTEM_DIR: $system_dir FILE: $file" # install file cp -P $file %{buildroot}%{_datadir}/$system_dir/ # symlink diff --git a/update.sh b/update.sh index 2c969ba..eca3305 100644 --- a/update.sh +++ b/update.sh @@ -51,11 +51,13 @@ declare -A provides_map=( ["myspell-zu_ZA"]="myspell-zulu" ) +# directories under $GIT_DIR, which holds dictionaries function directories() { ls $GIT_DIR/*/dictionaries.xcu | sed -e 's:dictionaries/::' -e 's:/dictionaries.xcu::' | tr '\n' ' ' } +# create central mapping dir <-> locales <-> files function locale_to_file_map() { cd $GIT_DIR @@ -78,18 +80,29 @@ function locale_to_file_map() cd .. } +# for given dir: which locales provides function dir_locales() { dir=$1 grep "^$dir:" $GIT_DIR/locale_to_file_map.txt | sed 's/.*: //' | sed 's/ @.*//' | tr ' ' '\n' | sort -u | tr '\n' ' ' } -function locale_files() +# for given dir: which dictionary relevant files (dic, aff, th*, hyph*) provides +function dir_files() { - loc=$1 - grep $loc $GIT_DIR/locale_to_file_map.txt | sed 's:.*@ ::' | tr ' ' '\n' | sort -u | tr '\n' ' ' + dir=$1 + grep "$dir:" $GIT_DIR/locale_to_file_map.txt | sed 's:.*@ ::' | tr ' ' '\n' | sort -u | tr '\n' ' ' } +# for given dictionary file: which locales provides +function file_locales() +{ + file=$1 + # there should be only one occurence of a file in locale_to_file_map.txt + grep $file $GIT_DIR/locale_to_file_map.txt | sed -e 's/.*: //' -e 's/@.*//' +} + +# for given dir: description of the dictionary function description() { dir=$1 @@ -154,32 +167,44 @@ done echo '--- Creating symlinks' # create symlinks in $GIT_DIR/$dir, e. g. es_GT -> es_ANY for dir in $dirs; do - dir_locs=$(dir_locales $dir) - [ "$VERBOSE" == "yes" ] && echo "DICTIONARY: $dir ($dir_locs)" - for l in $dir_locs; do - loc_files=$(locale_files $l) - [ "$VERBOSE" == "yes" ] && echo " $l: $loc_files" - for f in $loc_files; do - f=`basename $f` - prefix="" - if [[ $f == hyph* ]] || [[ $f == th* ]]; then - # nice collision with th_ for thesaurus - if [ "$f" != "th_TH.aff" ] && [ "$f" != "th_TH.dic" ]; then - prefix=`echo $f | sed 's:_.*:_:'` - fi - fi - ext=`echo $f | sed 's:.*\.::'` - # file or link for this locale/extension exist yet, do not create symlink - if ls $GIT_DIR/$dir/$prefix*$l*.$ext &> /dev/null; then - continue; - fi + files=$(dir_files $dir) + [ "$VERBOSE" == "yes" ] && echo "DICTIONARY: $dir ($files)" + for file in $files; do + locales=$(file_locales $file) + [ "$VERBOSE" == "yes" ] && echo " $file: $locales" + for locale in $locales; do + fname=`basename $file` # work around which is bug imho in dictionaries.xcu. # It references file that doesn't exist. - if [ ! -e "$GIT_DIR/$dir/$f" ]; then + if [ ! -e "$GIT_DIR/$dir/$fname" ]; then + [ "$VERBOSE" == "yes" ] && echo "WARNING: $GIT_DIR/$dir/$f doesn't exist" continue; fi - linkname=$prefix$l.$ext - ln -sf $f $GIT_DIR/$dir/$linkname + + prefix="" + if [[ $fname == th* ]]; then + # nice collision with th_ for thesaurus + if [ "$fname" != "th_TH.aff" ] && [ "$fname" != "th_TH.dic" ]; then + prefix="th_" + fi + fi + if [[ $fname == hyph* ]]; then + prefix="hyph_" + fi + ext=`echo $fname | sed 's:.*\.::'` + linkname=$prefix$locale.$ext + + [ "$VERBOSE" == "yes" ] && echo -n " link: $linkname -> $fname .. " + + # regular file or link for this locale/extension exist yet, + # do not create symlink + if ls $GIT_DIR/$dir/$linkname &> /dev/null; then + echo "regular file or link exists yet" + continue; + fi + + ln -sf $fname $GIT_DIR/$dir/$linkname + echo "created" done done done