- generate and package *.idx files
OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/myspell-dictionaries?expand=0&rev=14
This commit is contained in:
parent
6fd35deeda
commit
6a6fd4fe8e
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6f4e8dd76fa8e8d1e8352ef460960416765bc6989e7260fb169f9f3423659a3e
|
||||
size 37328488
|
||||
oid sha256:8e5870534e61833b3296cd3429643e545edec753e516ce52fe336c96914694bb
|
||||
size 40905732
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue May 6 15:22:09 UTC 2014 - pgajdos@suse.com
|
||||
|
||||
- generate and package *.idx files
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon May 5 14:21:37 UTC 2014 - pgajdos@suse.com
|
||||
|
||||
|
@ -1025,7 +1025,7 @@ for locale_dir in af_ZA an_ES ar be_BY bg_BG bn_BD br_FR bs_BA ca cs_CZ da_DK de
|
||||
pushd $locale_dir
|
||||
dic_files=`find -maxdepth 1 -name '*.dic' -a ! -name 'hyph*' -o -name '*.aff'`
|
||||
hyph_files=`find -maxdepth 1 -name 'hyph*.dic'`
|
||||
th_files=`find -maxdepth 1 -name 'th*.dat'`
|
||||
th_files=`find -maxdepth 1 -name 'th*.dat' -o -name 'th*.idx'`
|
||||
doc_files=`find -maxdepth 1 -type f | grep '.txt\|.xcu\|.xml\|.png\|.tex\|^[^.]*$' || true`
|
||||
# install dictionary files
|
||||
echo '%%defattr(-,root,root,-)' > $locale_dir.list
|
||||
|
@ -225,7 +225,7 @@ for locale_dir in @LANG_DIRS@ ; do
|
||||
pushd $locale_dir
|
||||
dic_files=`find -maxdepth 1 -name '*.dic' -a ! -name 'hyph*' -o -name '*.aff'`
|
||||
hyph_files=`find -maxdepth 1 -name 'hyph*.dic'`
|
||||
th_files=`find -maxdepth 1 -name 'th*.dat'`
|
||||
th_files=`find -maxdepth 1 -name 'th*.dat' -o -name 'th*.idx'`
|
||||
doc_files=`find -maxdepth 1 -type f | grep '.txt\|.xcu\|.xml\|.png\|.tex\|^[^.]*$' || true`
|
||||
# install dictionary files
|
||||
echo '%%defattr(-,root,root,-)' > $locale_dir.list
|
||||
|
50
update.sh
50
update.sh
@ -72,6 +72,9 @@ function locale_to_file_map()
|
||||
echo $dir: $locs @ $files | tr '-' '_' >> locale_to_file_map.txt
|
||||
done
|
||||
done
|
||||
# add idx files for every dat (where doesn't exist)
|
||||
# we will generate them
|
||||
sed -i '/\.idx/!s/\([^ ]*\)\.dat/\1.dat \1.idx/g' locale_to_file_map.txt
|
||||
cd ..
|
||||
}
|
||||
|
||||
@ -93,11 +96,26 @@ function description()
|
||||
grep '<name lang="en.*">' dictionaries/$dir/description.xml | sed -e 's:.*<name lang="en.*">::' -e 's:</name>.*::' | tr '\n' ' ' | sed 's:[ \t]*$::'
|
||||
}
|
||||
|
||||
# all thesaurus dat files
|
||||
function dat_files()
|
||||
{
|
||||
grep '\.dat' $GIT_DIR/locale_to_file_map.txt | sed 's:.* \([^ ]\+\.dat\).*:\1:'
|
||||
}
|
||||
|
||||
# for dat file return corresponding idx file name
|
||||
function idx_file()
|
||||
{
|
||||
dat_file=$1
|
||||
grep "$dat_file" $GIT_DIR/locale_to_file_map.txt | sed 's:.* \([^ ]\+\.idx\).*:\1:'
|
||||
}
|
||||
|
||||
#
|
||||
# prepare 'dictionaries' directory
|
||||
#
|
||||
|
||||
# download present git version, remove .git, unify layout
|
||||
# and create locale symlinks
|
||||
#
|
||||
if [ $DOWNLOAD == "yes" ]; then
|
||||
echo '--- Download current git version'
|
||||
rm -rf $GIT_DIR
|
||||
git clone git://anongit.freedesktop.org/libreoffice/$GIT_DIR
|
||||
rm -rf $GIT_DIR/.git
|
||||
@ -111,17 +129,29 @@ elif [ ! -e $GIT_DIR ]; then
|
||||
echo "Run quilt setup or so."
|
||||
exit 1
|
||||
else
|
||||
echo "--- Do not download, using '$GIT_DIR'"
|
||||
date=`rpmspec -q --qf "%{VERSION}\n" *.spec | head -n 1`
|
||||
fi
|
||||
|
||||
#
|
||||
# create dir <-> locales <-> files mapping
|
||||
# in $GIT_DIR/locale_to_file_map.txt
|
||||
#
|
||||
dirs=$(directories)
|
||||
[ "$VERBOSE" == "yes" ] && echo directiories: $dirs
|
||||
locale_to_file_map
|
||||
|
||||
# create *.idx files from *.dat files
|
||||
echo '--- Creating idx files'
|
||||
for datf in $(dat_files); do
|
||||
idxf=$(idx_file $datf)
|
||||
echo "th_gen_idx.pl < $GIT_DIR/$datf > $GIT_DIR/$idxf"
|
||||
th_gen_idx.pl < $GIT_DIR/$datf > $GIT_DIR/$idxf
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: failed th_gen_idx.pl -o $GIT_DIR/$idxf < $GIT_DIR/$datf"
|
||||
exit 1
|
||||
fi
|
||||
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)
|
||||
@ -138,7 +168,6 @@ for dir in $dirs; do
|
||||
prefix=`echo $f | sed 's:_.*:_:'`
|
||||
fi
|
||||
fi
|
||||
#echo FILE: $f
|
||||
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
|
||||
@ -154,9 +183,11 @@ for dir in $dirs; do
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
#
|
||||
# generate myspell-dictionaries.spec
|
||||
#
|
||||
echo '--- Generating spec file'
|
||||
cp myspell-dictionaries.spec.in myspell-dictionaries.spec
|
||||
|
||||
sed -i "s:@DO_NOT_EDIT_COMMENT@:DO NOT EDIT THIS SPEC FILE:" myspell-dictionaries.spec
|
||||
@ -196,10 +227,13 @@ sed -i "s:@FILES@::" myspell-dictionaries.spec
|
||||
#
|
||||
# creating source archive
|
||||
#
|
||||
[ $DOWNLOAD == "yes" ] && tar cJf dictionaries.tar.xz dictionaries
|
||||
[ $DOWNLOAD == "yes" ] && rm -r dictionaries
|
||||
if [ $DOWNLOAD == "yes" ]; then
|
||||
echo '--- Creating archive'
|
||||
tar cJf dictionaries.tar.xz dictionaries
|
||||
rm -r dictionaries
|
||||
fi
|
||||
|
||||
echo OK
|
||||
echo --- Done
|
||||
|
||||
#
|
||||
# advice at the end ..
|
||||
|
Loading…
Reference in New Issue
Block a user