From 07cad2fc45f4a912a54f83a624242d71b4ca5a7e Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Fri, 7 Mar 2008 07:30:56 +0000 Subject: [PATCH] Now Dictd dictionary collection works to full extent. svn path=/nixpkgs/trunk/; revision=11007 --- pkgs/servers/dict/dictd-db-collector.nix | 38 +++++++++++++----------- pkgs/servers/dict/dictd-db.nix | 35 ++++++++++++++++++++-- 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/pkgs/servers/dict/dictd-db-collector.nix b/pkgs/servers/dict/dictd-db-collector.nix index 91cebac5c475..299bfc8ac2f7 100644 --- a/pkgs/servers/dict/dictd-db-collector.nix +++ b/pkgs/servers/dict/dictd-db-collector.nix @@ -15,14 +15,7 @@ let (x: '' "${x.filename}" '') dictlist; databases = lib.concatStrings (map (x : - " - database ${x.name} { - data ${x.filename}.dict.dz - index ${x.filename}.index - index_word ${x.filename}.word - index_suffix ${x.filename}.suffix - } - ") dictlist); + "${x.name} ${x.filename}\n") dictlist); allow = lib.concatStrings (map (x: "allow ${x}\n") allowList); deny = lib.concatStrings (map (x: "deny ${x}\n") denyList); accessSection = " @@ -34,34 +27,45 @@ let installPhase = '' ensureDir $out/share/dictd cd $out/share/dictd + echo "${databases}" >databases.names + echo "${accessSection}" > dictd.conf for j in ${toString link_arguments}; do + name="$(egrep ' '"$j"\$ databases.names)" + name=''${name% $j} if test -d "$j"; then if test -d "$j"/share/dictd ; then echo "Got store path $j" j="$j"/share/dictd fi echo "Directory reference: $j" - i=$(ls "$j"/*.index) + i=$(ls "$j""/"*.index) i="''${i%.index}"; else i="$j"; fi echo "Basename is $i" + locale=$(cat "$(dirname "$i")"/locale) + base="$(basename "$i")" + echo "Locale is $locale" + export LC_ALL=$locale + export LANG=$locale if test -e "$i".dict.dz; then ln -s "$i".dict.dz else cp "$i".dict . - dictzip "$(basename "$i")".dict + dictzip "$base".dict fi ln -s "$i".index . - locale=$(cat "$(dirname "$i")"/locale) - LC_ALL=$locale dictfmt_index2word < "$(basename "$i")".index > "$(basename "$i")".word || true - LC_ALL=$locale dictfmt_index2suffix < "$(basename "$i")".index > "$(basename "$i")".suffix || true + dictfmt_index2word --locale $locale < "$base".index > "$base".word || true + dictfmt_index2suffix --locale $locale < "$base".index > "$base".suffix || true + + echo "database $name {" >> dictd.conf + echo " data $out/share/dictd/$base.dict.dz" >> dictd.conf + echo " index $out/share/dictd/$base.index" >> dictd.conf + echo " index_word $out/share/dictd/$base.word" >> dictd.conf + echo " index_suffix $out/share/dictd/$base.suffix" >> dictd.conf + echo "}" >> dictd.conf done - echo "${accessSection}" > dictd.conf - cat <> dictd.conf -${databases} -EOF ''; in diff --git a/pkgs/servers/dict/dictd-db.nix b/pkgs/servers/dict/dictd-db.nix index a93e0629f2e5..15503e448123 100644 --- a/pkgs/servers/dict/dictd-db.nix +++ b/pkgs/servers/dict/dictd-db.nix @@ -36,7 +36,7 @@ fetchurl = (builderDefs {src="";} null).fetchurl; in -{ +rec { nld2eng = makeDictdDBFreedict (fetchurl { url = http://prdownloads.sourceforge.net/freedict/nld-eng.tar.gz; sha256 = "1vhw81pphb64fzsjvpzsnnyr34ka2fxizfwilnxyjcmpn9360h07"; @@ -57,9 +57,38 @@ in url = http://downloads.sourceforge.net/freedict/eng-fra.tar.gz; sha256 = "0fi6rrnbqnhc6lq8d0nmn30zdqkibrah0mxfg27hsn9z7alwbj3m"; }) "eng-fra" "en_UK"; - mueller_eng2rus = makeDictdDB (fetchurl { + mueller_eng2rus_pkg = makeDictdDB (fetchurl { url = http://downloads.sourceforge.net/mueller-dict/mueller-dict-3.1.tar.gz; sha256 = "04r5xxznvmcb8hkxqbjgfh2gxvbdd87jnhqn5gmgvxxw53zpwfmq"; }) "mueller-eng-rus" "mueller-dict-*/dict" "en_UK"; - + mueller_enru_abbr = { + outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-abbrev"; + name = "mueller-abbr"; + dbName = "mueller-abbr"; + locale = "en_UK"; + }; + mueller_enru_base = { + outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-base"; + name = "mueller-base"; + dbName = "mueller-base"; + locale = "en_UK"; + }; + mueller_enru_dict = { + outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-dict"; + name = "mueller-dict"; + dbName = "mueller-dict"; + locale = "en_UK"; + }; + mueller_enru_geo = { + outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-geo"; + name = "mueller-geo"; + dbName = "mueller-geo"; + locale = "en_UK"; + }; + mueller_enru_names = { + outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-names"; + name = "mueller-names"; + dbName = "mueller-names"; + locale = "en_UK"; + }; }