[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

dictionaries-common: myspell policy



Hi Agustín,

as promised already here is the patch (against 0.9.51).

Included in the diff is the addition of me to the document at the
beginning and to Uploaders: to be able to to something for the myspell
parts directly if they need some rework/fixing. [1]

If you wonder: I have tried to get the maximal lenth/line <= 80 to
be able to edit the file on a plain console; this increased the diff
somewhat...

I also replaced some occurances of the long forms thorugh IDWP; or
&IDWP;s.

The other changes I did are mentioned in the diff itself (changelog).

If you want me to, I could upload 0.10 if the patch is OK for you...
(I included the changelog so far in the diff; tis version built fine; debs
and the changes are lying on my HD...)

Regards,

René

[1] This then may include being member in the alioth project and having
CVS access...
.
P.S.: I just subscribed to dict-common-*. Would it make sense to make
that List the Maintainer and you, Rafael and me Uploaders:?

--
 .''`.  René Engelhard -- Debian GNU/Linux Developer
 : :' : http://www.debian.org | http://people.debian.org/~rene/
 `. `'  rene@debian.org | GnuPG-Key ID: 248AEB73
   `-   Fingerprint: 41FA F208 28D4 7CA5 19BB  7AD9 F859 90B0 248A EB73
diff -urN dictionaries-common-0.9.51/debian/changelog dictionaries-common-0.10/debian/changelog
--- dictionaries-common-0.9.51/debian/changelog	2003-06-04 11:11:43.000000000 +0200
+++ dictionaries-common-0.10/debian/changelog	2003-06-09 04:10:17.000000000 +0200
@@ -1,3 +1,17 @@
+dictionaries-common (0.10) unstable; urgency=low
+
+  * debian/control:
+    -- add myself to Uploaders:
+    -- add dh_perl call for scripts/system/* and add ${perl:Depends}
+    -- remove dh_shlibdeps since we have no binaries here..
+  * policy/dsdt-policy.xml.in
+    -- add myspell stuff
+  * scripts/system/*:
+    -- add myspell stuff (update-ooo-dictlist)
+  * Standards-Version: 3.5.10 (no changes needed)
+
+ -- Rene Engelhard <rene@debian.org>  Fri,  6 Jun 2003 04:40:55 +0200
+
 dictionaries-common (0.9.51) unstable; urgency=low
  
   * scripts/ispell-autobuildhash:
diff -urN dictionaries-common-0.9.51/debian/control dictionaries-common-0.10/debian/control
--- dictionaries-common-0.9.51/debian/control	2003-04-30 15:48:41.000000000 +0200
+++ dictionaries-common-0.10/debian/control	2003-06-09 04:09:55.000000000 +0200
@@ -2,13 +2,13 @@
 Section: text
 Priority: standard
 Maintainer: Agustin Martin Domingo <agmartin@debian.org>
-Uploaders: Rafael Laboissiere <rafael@debian.org>
+Uploaders: Rafael Laboissiere <rafael@debian.org>, Rene Engelhard <rene@debian.org>
 Build-Depends-Indep: docbook-xml, docbook-dsssl, jade, links, debhelper (>= 4.1.16), slice, autoconf
-Standards-Version: 3.5.7
+Standards-Version: 3.5.10
 
 Package: dictionaries-common
 Architecture: all
-Depends: debconf (>= 0.2.9)
+Depends: ${perl:Depends}, debconf (>= 0.2.9)
 Conflicts: ispell (<= 3.1.20.0-1), miscfiles (<< 1.3-2.1), iamerican (<= 3.1.20.0-1), ibrazilian (<< 2.4-5.1), ibritish (<= 3.1.20.0-1), ibulgarian (<= 2.0-2), icatalan (<= 0.1-4), iczech (<= 20020628-1) , idanish (<< 1.4.22-2.1), idutch (<= 1:0.1e-20), iesperanto (<< 2.1.2000.02.25-6), ifaroese (<= 0.1.16-2), ifinnish (<< 0.7-3.4), ifinnish-large (<< 0.7-3.4), ifinnish-small (<< 0.7-3.4), ifrench (<= 1.4-13), ifrench-gut (<= 1:1.0-9), igerman, ihungarian (<= 0.84-1), iitalian (<< 2.20-1.2), ingerman (<< 20010414-2), inorwegian (<< 2.0-6.1), ipolish (<< 20011004-2.1), iportuguese (<< 19980611-8), irussian (<= 0.99f0-1), ispanish (<< 1.7-5), ispell-ga, iswedish (<= 1.4.2), wbritish (<= 3.1.20.0-1), wbulgarian (<= 2.0-2), wcatalan (<= 0.1-4), wdanish (<< 1.4.22-2.1), wdutch (<= 1:0.1e-20), wenglish (<= 2.0-2), wfaroese (<= 0.1.16-2), wfinnish (<< 0.7-3.4), wfrench (<= 1.0-11), wgerman, witalian (<= 1.6), wnorwegian (<< 2.0-6.1), wngerman (<< 20010414-2), wpolish (<< 20011004-2.1), wspanish (<= 1.0.11.1), wswedish (<= 1.4.2)
 Suggests: ispell, emacsen-common, jed-common
 Description: Common utilities for spelling dictionary tools
diff -urN dictionaries-common-0.9.51/debian/copyright dictionaries-common-0.10/debian/copyright
--- dictionaries-common-0.9.51/debian/copyright	2002-04-02 22:13:19.000000000 +0200
+++ dictionaries-common-0.10/debian/copyright	2003-06-06 06:05:14.000000000 +0200
@@ -2,6 +2,7 @@
 
 Copyright (C) 1999,2000,2001,2002   Rafael Laboissiere <rafael@debian.org>
 Copyright (C) 2001,2002  Agustín Martín Domingo <agmartin@debian.org>
+Copyright (C) 2003 René Engelhard <rene@debian.org>
 
 dictionaries-common is released under the terms of the GNU GPL, version 2,
 or at your option, any later version. (see /usr/share/common-licenses/GPL).
diff -urN dictionaries-common-0.9.51/debian/dictionaries-common.substvars dictionaries-common-0.10/debian/dictionaries-common.substvars
--- dictionaries-common-0.9.51/debian/dictionaries-common.substvars	1970-01-01 01:00:00.000000000 +0100
+++ dictionaries-common-0.10/debian/dictionaries-common.substvars	2003-06-09 04:09:05.000000000 +0200
@@ -0,0 +1 @@
+misc:Depends=debconf (>= 0.5)
diff -urN dictionaries-common-0.9.51/debian/rules dictionaries-common-0.10/debian/rules
--- dictionaries-common-0.9.51/debian/rules	2003-03-20 13:17:14.000000000 +0100
+++ dictionaries-common-0.10/debian/rules	2003-06-09 04:10:06.000000000 +0200
@@ -58,7 +58,7 @@
 	dh_compress
 	dh_installdebconf
 	dh_installdeb
-	dh_shlibdeps
+	dh_perl scripts/system/*
 	dh_gencontrol
 	dh_md5sums
 	dh_builddeb
diff -urN dictionaries-common-0.9.51/Makefile.in dictionaries-common-0.10/Makefile.in
--- dictionaries-common-0.9.51/Makefile.in	2003-06-03 12:02:40.000000000 +0200
+++ dictionaries-common-0.10/Makefile.in	2003-06-06 22:46:21.000000000 +0200
@@ -56,10 +56,13 @@
 ispell_system_scripts := $(addsuffix -ispell,$(base_system_scripts)) 
 aspell_system_scripts := $(addsuffix -aspell, update-dictcommon)
 wordlist_system_scripts := $(addsuffix -wordlist,$(base_system_scripts))
+myspell_system_scripts := update-ooo-dictlist
+
 system_scripts := $(addprefix scripts/system/,\
                   $(ispell_system_scripts) \
                   $(aspell_system_scripts) \
-                  $(wordlist_system_scripts))
+                  $(wordlist_system_scripts) \
+		  $(myspell_system_scripts))
 system_other_scripts := $(addprefix scripts/system/, ispell-autobuildhash)
 
 user_scripts := $(addprefix scripts/system/, \
@@ -115,6 +118,11 @@
 	slice -oUNDEF+W+IW-I-A:$@ $<
 
 
+# ugly hack
+scripts/system/update-ooo-dictlist:
+	cp scripts/system/update-ooo-dictlist.in \
+		scripts/system/update-ooo-dictlist
+
 #########################################################################
 # Installation
 
diff -urN dictionaries-common-0.9.51/policy/dsdt-policy.xml.in dictionaries-common-0.10/policy/dsdt-policy.xml.in
--- dictionaries-common-0.9.51/policy/dsdt-policy.xml.in	2003-03-13 16:19:16.000000000 +0100
+++ dictionaries-common-0.10/policy/dsdt-policy.xml.in	2003-06-08 23:27:53.000000000 +0200
@@ -26,6 +26,9 @@
 <!ENTITY RTSM "<filename>region-to-spelling.map</filename>">
 <!ENTITY IDWP "ispell dictionary or wordlist package">
 <!ENTITY IADWP "ispell or aspell dictionary or wordlist package">
+<!ENTITY IAMDWP "ispell or aspell or myspell dictionary or wordlist package">
+<!ENTITY MDP "myspell dictionary package">
+<!ENTITY IMDWP "ispell or myspell dictionary or wordlist package">
 
 <!ENTITY old-wlist-name "w<replaceable>&lt;language&gt;</replaceable>">
 <!ENTITY new-design SYSTEM "../NEW-DESIGN">
@@ -90,6 +93,20 @@
 	<address><email>agmartin@debian.org</email></address>
       </affiliation>   
     </author>
+    <author>
+      <firstname>
+        Ren&eacute;
+      </firstname>
+      <surname>
+        Engelhard
+      </surname>
+      <affiliation>
+        <orgname>
+	  The Debian Project
+	</orgname>
+	<address><email>rene@debian.org</email></address>
+      </affiliation>
+    </author>
     <releaseinfo>
       Release @RELEASE@ (@DATE@)
     </releaseinfo>
@@ -102,7 +119,7 @@
       </year>
       <holder>
 	Rafael Laboissi&egrave;re, David Coe, &amp; Agust&iacute;n
-	Mart&iacute;n Domingo 
+	Mart&iacute;n Domingo, Ren&eacute; Engelhard
       </holder>
     </copyright>
     <legalnotice><!-- [[should be legalnotice, but that doesn't print]] -->
@@ -135,25 +152,25 @@
     <para>
       This document is intended for Debian maintainers whose packages
       relate in some manner to the ispell program,
-      ispell dictionaries, and/or wordlists (application-independent
-      dictionaries).
+      ispell dictionaries, myspell dictionaries and/or wordlists
+      (application-independent dictionaries).
       It concerns therefore the ispell package itself, the
-      language-specific ispell dictionaries, the language-specific 
-      wordlists, some
+      language-specific ispell dictionaries, the language-specific myspell
+      dictionaries, the language-specific wordlists, some
       editors like (X)Emacs and jed, some of the mail and news user
       agents (MUAs, NUAs), and other tools that give the user a 
       choice of dictionaries for spell checking.
     </para>
-    <para>
+<!--    <para>
       From now on the convention 
       IDWP = "&IDWP;" will be used for
-      that packages when a short generic reference to them is desired. 
-    </para>
+      that packages when a short generic reference to them is desired.
+    </para> -->
     <para>
       The main goal of this Policy is to establish the basic requirements
       for the said packages in a Debian system, allowing a high degree of
       integration among them.  This should yield a coherent behavior of all
-      ispell dictionary and wordlist-related packages, both at
+      ispell/myspell dictionary and wordlist-related packages, both at
       installation and usage time.
     </para>
     <para>
@@ -173,16 +190,6 @@
 	    >http://savannah.gnu.org/download/aspell/manual/user/manual.html</ulink>
 	</para></listitem>
     </itemizedlist>
-    <para>
-      This document also does not affect myspell dictionaries. For the
-      Spellcheck packaging guide for OpenOffice.org please look at
-      <itemizedlist>
-	<listitem><para>
-	    <ulink
-	      url="http://cvs.debian.org/guides/spellcheck-packaging/?cvsroot=debian-openoffice";>http://cvs.debian.org/guides/spellcheck-packaging/?cvsroot=debian-openoffice</ulink>
-	  </para></listitem>
-      </itemizedlist>
-    </para>
     <sect2 renderas="sect3"> <title> Advantages For Debian Users </title>
       <!-- ********************************************************************** -->
       <itemizedlist>
@@ -247,27 +254,32 @@
       <itemizedlist>
 	<listitem>
 	  <para>
-	    If you maintain an ispell dictionary or wordlist package you must 
-	    install package dictionaries-common. This package will conflict with
-	    all old style ispell dictionaries and wordlists packages. Since from
-	    this policy on ispell hash files should be 128 character per string
-	    it will also conflict with older ispell packages. If you use
-	    debhelper and want to use the debhelper like scripts you must also
-	    install package dictionaries-common-dev. 
+	    If you maintain an &IDWP; you must install the package
+	    dictionaries-common. This package will conflict with all old
+	    style &IDWP;s. Since from this policy on ispell hash files should
+	    be 128 character per string it will also conflict with older ispell
+	    packages. If you use debhelper and want to use the debhelper like
+	    scripts you must also install package dictionaries-common-dev. 
 	  </para>
 	</listitem>
 	<listitem>
 	  <para>
-	    There is no need to change the name of your package. 
-	    For ispell dictionary and wordlist packages 
-	    <emphasis>You have however to take care with one thing</emphasis>;
-	    since all such 
-	    packages conforming to this policy will replace the old packages and
-	    pre-depend on the package dictionaries-common, you need to notify the
-	    dictionaries-common maintainer which one will be the last version
-	    of your package(s) not using the new policy. That versioned
-	    conflict will be added to the dictionaries-common package and
-	    after that your new policy compliant package can be used.
+	    There is no need to change the name of your package for &IDWP;s. 
+	    <emphasis>You however have to take care with one thing</emphasis>;
+	    since all such packages conforming to this policy will replace the
+	    old packages and pre-depend on the package dictionaries-common, you
+	    need to notify the dictionaries-common maintainer which one will
+	    be the last version of your package(s) not using the new policy. 
+	    That versioned conflict will be added to the dictionaries-common
+	    package and after that your new policy compliant package can be
+	    used.
+	  </para>
+	  <para>
+	    For &MDP;s however you have to rename your existing package
+	    if it followed the old &quot;OpenOffice.org Spellcheck Packages
+	    Packaging Guide". You have to rename
+	    openoffice.org-spellcheck-&lt;langcode&gt; to
+	    myspell-&lt;langcode&gt;
 	  </para>
 	</listitem>
 	<listitem>
@@ -286,7 +298,8 @@
 	<listitem>
 	  <para>
 	    Be sure that you are installing the correct files and symlinks
-	    in <filename>/usr/lib/ispell/</filename>
+	    in <filename>/usr/lib/ispell/</filename>,
+	    <filename>/usr/share/myspell/</filename>
 	    or <filename>/usr/share/dict/</filename>. (see <xref
 	      linkend="installdir"/>).
 	  </para>
@@ -298,7 +311,8 @@
 	      <listitem>
 		<para>
 		  First of all you need to have an
-		  <filename>info-{ispell,wordlist}</filename> file conforming to
+		  <filename>info-{ispell,wordlist}</filename> or
+		  for myspell just an ooentry file conforming to
 		  the specified in <xref linkend="infofile"/>. 
 		</para>
 		<para>
@@ -309,8 +323,10 @@
 		  You will need to install the dictionaries-common-dev package
 		  first in order to have the new debhelper scripts
 		  available. Unless you need extra features in your maintainer
-		  scripts or extra templates you are done. Otherwise, take a look
-		  at <xref linkend="config"/> or <xref linkend="templates"/>
+		  scripts or extra templates you are done. Otherwise, take a
+		  look at <xref linkend="config"/> or
+		  <xref linkend="templates"/>. There is no script like that
+		  necessary for &MDP;
 		</para>
 	      </listitem>
 	      <listitem>
@@ -410,8 +426,8 @@
       A package dictionaries-common-dev, to which this Policy belongs, is also
       provided. This is a package for maintainers of &IDWP;s. It contains the
       Policy document itself, as well as  
-      debhelper-like scripts to simplify the debianization of ispell 
-      dictionary and wordlist packages (IDWP) for maintainers using debhelper.
+      debhelper-like scripts to simplify the debianization of &IDWP;s for
+      maintainers using debhelper.
       It also (via this policy document) may provide suggestions or
       patches for other related packages.
     </para>
@@ -469,12 +485,13 @@
       <para> 
 	Emacsen, jed and mutt add-on support will be fully auto-generated by the
 	<command>update-default-(ispell|wordlist</command>) script.  Also, links
-	in <filename>/usr/lib/ispell</filename> corresponding to the Emacsen-Name:
-	field will be automatically generated. 
+	in <filename>/usr/lib/ispell</filename> corresponding to the
+	Emacsen-Name: field will be automatically generated. 
       </para>
       <para>
 	Do not add emacs or jed startup files to your package. That will surely
-	interfere with the autogenerated system and be the major source for problems.
+	interfere with the autogenerated system and be the major source for
+	problems.
       </para>
     </sect2>
   </sect1>
@@ -483,12 +500,14 @@
     <!-- ********************************************************************* -->
     <!-- * -->
     <sect2 id="naming" renderas="sect3">
-      <title> Naming of Language-specific ispell dictionary and wordlist Packages</title>
+      <title> Naming of Language-specific ispell dictionary, myspell
+      dictionary and wordlist Packages</title>
       <!-- ********************************************************************** -->
       <para>
 	Language-specific ispell dictionary packages and wordlists must be
 	named the classical way,  
-	like <quote>ifrench</quote>, <quote>wfrench</quote>, <quote>iswedish</quote>, etc.  
+	like <quote>ifrench</quote>, <quote>wfrench</quote>,
+	<quote>iswedish</quote>, etc.  
 	Use of non-English language names is discouraged; for example
 	<quote>ingerman</quote> should <emphasis>not</emphasis> be 
 	named <quote>indeutsch</quote>.  (This is based on existing 
@@ -519,19 +538,29 @@
 	  in the dictionaries-common package.
 	</para>
       </note>
+      <para>
+        &MDP;s must be called myspell-&lt;isocode&gt; (&lt;isocode&gt; being
+        the two-digit isocode of the country). Exceptions can be made for
+        confusing codes (e.g. for uk which is the 2-digit code for Ukrainian).
+      </para>
+      <para>
+        If there are more myspell languages for a language (e.g.
+        de_DE, de_CH, ..) then the packages can be called
+        myspell-&lt;langcode&gt;-&lt;countrycode&gt; too..
+      </para>
     </sect2>
     <!-- * -->
     <sect2 id="relationships" renderas="sect3"><title>Relationships </title>
       <!-- ******************************************************************** -->
       <para>
 	The package relationships declared in the
-	<filename>debian/control</filename> files should be as follows:
+	<filename>debian/control</filename> files should be as follows
+	for &IDWP;s:
       </para> 
       <itemizedlist>
 	<listitem>
 	  <para>
-	    All ispell dictionary and wordlist packages (IDWP) have to
-	    <emphasis>depend</emphasis> on
+	    All &IDWP;s have to <emphasis>depend</emphasis> on
 	    <filename>dictionaries-common</filename> in their 
 	    <filename>debian/control</filename> files.
 	  </para>
@@ -600,6 +629,39 @@
 	  </para>
 	</listitem>
       </itemizedlist>
+      <para>
+      For &MDP;s the relationships in <filename>debian/control</filename>
+      should be as follows:
+      </para>
+      <itemizedlist>
+        <listitem>
+	  <para>
+	    the &MDP;s should depend on dictionaries-common (>= 0.10)
+	    because in that revision the myspell stuff was added.
+	  </para>
+	  <para>
+	    the myspell-&lt;isocode&gt; package should
+	    <emphasis>provide</emphasis> the virtual packages
+	    myspell-dictionary and myspell-dictionary-&lt;isocode&gt;
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	    the packages must declare a <emphasis>Suggests:</emphasis> on
+	    openoffice.org (&gt;= 1.0.3-3) and mozilla-spellchecker
+	    if the latter is available in Debian.
+	    Moreover should it Conflict: against openoffice.org (&lt;= 1.0.3-2)
+	  </para>
+	</listitem>
+	<listitem>
+	  <para>
+	   The myspell packages having an &quot;old&quot; version named
+	   openoffice.org-spellcheck-* should declare the magic
+	   Conflicts: / Provides: / Replaces: combination &quot;against&quot;
+	   the old package.
+	  </para>
+	</listitem>
+      </itemizedlist>
     </sect2>
     <!-- * -->
     <sect2 id="infofile" renderas="sect3"><title>The info file</title>
@@ -629,7 +691,7 @@
 Coding-System: iso-8859-1
       </programlisting>
       <para> 
-        adapted to the corresponding language and IDWP.
+        adapted to the corresponding language and &IDWP;.
       </para>
       <para>
 	Each field in this file must be contained in a single line.  They may
@@ -763,6 +825,21 @@
         Wordlist packages only need to set the <quote>Language</quote> and
 	<quote>Hash-Name</quote> fields. Other fields will silently be ignored.  
       </para>
+      <para>
+      &MDP;s should provide a info file too -- this very
+      different though. &MDP; should provide an entry named as the package
+      which contains the lines which should be added to OpenOffice.org's
+      dictionary.lst; it should be installed into
+      <filename>/usr/share/myspell/infos/ooo</filename>. For example
+      </para>
+      <programlisting>
+# German (Germany)
+de DE de_DE
+      </programlisting>
+      <para>
+      which is the entry for German in Germany... For the exact meaning
+      of the fields see dictionary.lst(5).
+      </para>
       <caution>
 	<title>Note for debhelper users</title>
 	<para>
@@ -812,14 +889,18 @@
 	  as standard is probably right.
 	</quote>
       </para>
+      <para>
+       &MDP;s are <quote>Architecture: all</quote> and have
+       priority <quote>optional</quote>.
+      </para>
     </sect2>
     <!-- * -->
     <sect2 id="installdir" renderas="sect3">
       <title>Installation Directories and Symlinks</title>
       <!-- ********************************************************************* -->
       <para>
-	Ispell dictionary hashed files (<filename>.hash</filename>) and affix table
-	files (<filename>.aff</filename>) must be placed in the directory
+	Ispell dictionary hashed files (<filename>.hash</filename>) and affix
+	table iles (<filename>.aff</filename>) must be placed in the directory
 	<filename>/usr/lib/ispell/</filename>.  
 	Wordlist dictionary files must be placed in the directory
 	<filename>/usr/share/dict/</filename>.
@@ -838,6 +919,15 @@
 	This may be of some help to local users who do not know the
 	language names in English.
       </para>
+      <para>
+        myspell dictionary files (<filename>*.dic</filename> and
+	<filename>*.aff</filename>) should be installed in
+	<filename>/usr/share/myspell/dicts</filename>.
+      </para>
+      <para>
+        If the files are called e.g. de_DE.{dic,aff} then there should be a
+	symlink de-DE.{dic,aff} -> de_DE.{dic,aff} and the other way round...
+      </para>
     </sect2>
     <!-- * -->
     <sect2 id="scripts" renderas="sect3">
@@ -917,7 +1007,52 @@
         in <filename>/usr/share/dict/</filename>, respectively, 
 	taking into account the selections made via debconf (see
 	<xref linkend="debconf"/>).  
-      </para> 
+      </para>
+      <para>
+        &MDP;s must have the following maintainer scripts:
+      </para>
+	<itemizedlist>
+	  <listitem>
+	    <para>
+	    postinst
+	    </para>
+	    <programlisting>
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "configure" ]; then
+	if [ -x /usr/bin/openoffice ]; then
+		update-ooo-dictlist
+	fi
+fi
+
+#DEBHELPER#
+
+exit 0
+	    </programlisting>
+	  </listitem>
+	  <listitem>
+	    <para>
+	    postrm
+	    </para>
+	    <programlisting>
+#!/bin/sh
+
+set -e
+
+if [ "$1" = "remove" ]; then
+	if [ -x /usr/bin/openoffice ]; then
+		update-ooo-dictlist
+	fi
+fi
+
+#DEBHELPER#
+
+exit 0
+            </programlisting>
+	  </listitem>
+	</itemizedlist>
     </sect2>
   </sect1>
   <!-- ************************************************************************** -->
diff -urN dictionaries-common-0.9.51/scripts/system/update-ooo-dictlist.in dictionaries-common-0.10/scripts/system/update-ooo-dictlist.in
--- dictionaries-common-0.9.51/scripts/system/update-ooo-dictlist.in	1970-01-01 01:00:00.000000000 +0100
+++ dictionaries-common-0.10/scripts/system/update-ooo-dictlist.in	2003-06-09 03:25:13.000000000 +0200
@@ -0,0 +1,145 @@
+#!/usr/bin/perl
+
+# update-ooo-dictlist -- update OpenOffice.org's dictionary.lst
+# (c) 2003 René Engelhard <rene@debian.org>
+# Public Domain
+
+use File::Temp qw/ :POSIX /;
+
+sub print_comments() {
+  print DL_TMP "## List of All Dictionaries to be Loaded by OpenOffice.org\n";
+  print DL_TMP "## ---------------------------------------------------\n";
+  print DL_TMP "## Each Entry in the list have the following space delimited";
+  print DL_TMP " fields\n";
+  print DL_TMP "##\n";
+  print DL_TMP "## Field 1: Entry Type \"DICT\" - spellchecking dictionary\n";
+  print DL_TMP "##                     \"HYPH\" - hyphenation dictionary\n";
+  print DL_TMP "##                     \"THES\" - thesaurus files\n";
+  print DL_TMP "##\n";
+  print DL_TMP "## Field 2: Language code from Locale \"en\" or \"de\" or ";
+  print DL_TMP "\"pt\" ...\n";
+  print DL_TMP "##\n";
+  print DL_TMP "## Field 3: Country Code from Locale \"US\" or \"GB\" or ";
+  print DL_TMP "\"PT\"\n";
+  print DL_TMP "##\n";
+  print DL_TMP "## Field 4: Root name of file(s) \"en_US\" or \"hyph_de\" ";
+  print DL_TMP "or \"th_en_US\"\n";
+  print DL_TMP "##          (do not add extensions to the name)\n";
+  print DL_TMP "##\n";
+}
+
+# put all entries not in the automatic section in the new dictionary.lst
+# file (manually added dictionaries by the user)
+sub write_manually_added() {
+  while(<DL_ORIG>) {
+    my $line = $_;
+    chop($line);
+    # if we find the start of the section; set the flag that we are
+    # in the automatic section, ignore the following lines ...
+    if ($line eq "## !!! BEGIN AUTOMATIC SECTION -- DO NOT CHANGE !!!") {
+      $we_are_in_auto=1;
+      next;
+    }
+    # ... until we find the end and set the flag back.
+    if ($line eq "## !!! END AUTOMATIC SECTION -- DO NOT CHANGE !!!" ) {
+      $we_are_in_auto=0;
+      next;
+    }
+    # we are in non-automatic section; copy the user added entries
+    # into the temporary file; but that only if the line is not a ##
+    # comment or no blank line
+    if ($we_are_in_auto eq 0 and not $line =~ /^\#\#/ or not $line =~/./) {
+      print DL_TMP $_;
+    } else { next; }
+  }
+}
+
+# read all files in $entrydir and put their contents verbatim in
+# the new dictionary.lst
+sub write_automatic_section() {
+  print DL_TMP "## !!! BEGIN AUTOMATIC SECTION -- DO NOT CHANGE !!!\n";
+  foreach $file (glob "$entrydir/*") {
+	open(ENTRY,"$file");
+	while (<ENTRY>) {
+		print DL_TMP $_;
+	}
+	close(ENTRY);
+  }
+  print DL_TMP "## !!! END AUTOMATIC SECTION -- DO NOT CHANGE !!!\n";
+}
+
+sub empty_line() {
+  print DL_TMP "\n";
+}
+
+$dictlist_orig="/home/rene/test";
+$dictlist_tmp=tmpnam();
+print STDERR "Temp: $dictlist_tmp";
+$entrydir="/home/rene/la";
+
+if ($ENV{"USER"} ne "root") { 
+	print STDERR "This script needs root privileges...\n";
+	die;
+}
+
+if ( -e $dictlist_orig ) {
+	$we_have_old_file=1;
+	
+	open(DL_ORIG, "$dictlist_orig") # open the existing file for reading...
+		or die("Opening $dictlist_orig failed.\n");
+}
+
+open(DL_TMP, ">$dictlist_tmp") # and the temporary one for writing...
+	or die("Opening temporary file failed.\n");
+
+print STDERR "Updating OpenOffice.org's dictionary list... ";
+print_comments();
+empty_line();
+write_automatic_section();
+empty_line();
+if ($we_have_old_file) {
+	$we_are_in_auto=0;
+	write_manually_added();
+}
+print STDERR "done.\n";
+
+# close both files...
+close(DL_ORIG);
+close(DL_TMP);
+# .. and replace the old file with the new one.
+if ($we_have_old_file) {
+	unlink($dictlist_orig);
+}
+
+# hmm. rename does not work...
+system("mv $dictlist_tmp $dictlist_orig");
+# make sure the file has the right permissions
+chown(0, 0, $dictlist_orig);
+chmod (0644, $dictlist_orig);
+
+__END__
+
+=head1 NAME
+
+update-ooo-dictlist - rebuild /etc/openoffice/dictionary.lst
+
+=head1 SYNOPSIS
+
+update-ooo-dictlist
+
+=head1 DESCRIPTION
+
+This script takes the info files from /usr/share/myspell/infos (which
+are installed by packages and SHOULDN'T be touched and the old
+/etc/openoffice/dictionary.lst if existing and builds a new
+file updating the information.
+
+=head1 SEE ALSO
+
+openoffice(1), dictionary.lst(5)
+
+=head1 AUTHOR
+
+Rene Engelhard
+
+=cut

Attachment: pgpnMzsf0pai5.pgp
Description: PGP signature


Reply to: