[Dict-common-dev] openoffice.org: dictionary.lst is gone

Agustin Martin agmartin at debian.org
Mon Dec 29 22:28:36 UTC 2008


On Tue, Dec 23, 2008 at 08:54:03PM +0100, Rene Engelhard wrote:
> Agustin Martin wrote:
> > For the other, symlinks may be added at maintainer will. My main concern is 
> 
> Or --with-external-dict-dir=/usr/share/hunspell
> 
> > I would not remove /etc/openoffice/dictionary.lst from dictionaries-common
> > preinst, nor remove update-openoffice-dicts call from dictionaries-common
> > postinst. First may be run before ooo stuff, so having no effect, or called
> > in an ooo<3 environment and then miss local changes. Second may be called
> 
> People who had local changes in dictionary.lst loose their config anyway
> *unless* OOo3 finds them. But you're right.
> 
> the files are called a way to that OOo3 finds them.
> 
> For the first, we could wrap the rm.
> 
> > from a ooo <3 site, having a wrong effect. I am more for handling all that
> 
> ? In a OOo2 env OOo will also run the script and all dicts do too in lenny.
> Resulting in the file properly written.

Sorry for the delay, I had less spare time than expected,

The reason to have that calls in dictionaries-common is that any change
introduced by the different scripts dictionaries-common provides get
automatically propagated to the generated files just by installing new
dictionaries-common. 

The real impact in the ooo2->ooo3 transition is null, but there is a minor
impact regarding use in lenny. If e.g. we put a big warning about obsolescence
in front of /etc/openoffice/dictionary.lst for use with ooo2, and only a new
dictionaries-common is installed for whatever reason (like better emacs stuff)
the header will not be changed. While not a huge argument, that is why I think
is better to keep that call there.

> > Regarding the developers stuff, I only had a quick look at installdeb-myspell
> > (so please fix me), and I am unclear about what the new version will do. I
> > think we can keep old installdeb-myspell to create a backwards compatible
> > structure, so maintainers wanting to have an hunspell only package can
> > ignore it and use plain install for new only hunspell stuff.e
> > installdeb-myspell will then install stuff in the new locations and set
> > symlinks if appropriate. If, in the meantime, something good for
> > hunspell+emacs/jed/whatever is prepared, we can consider how to put it here.
> 
> If we go this way, yes - my initial plan was simply not to care about
> 1:1 working of squeezes packages in lenny, so...

I am attaching a first cut of an installdeb-myspell using the new locations
and setting compatibility symlinks. There is plenty of room for improvement,
and pod part is still unchanged, but seems to work in its current state.

I think we can leave the installdeb-myspell/update-openoffice-dicts just as
a compatibility tool and, if something is done for emacs/whatever, put in in
new installdeb-hunspell/update-dictcommon-hunspell scripts, tailored in a
similar way as the aspell stuff.
 
> > While speaking about this, I do not know where the ice* (aka mozilla*) look
> > for the dicts. We may need to do something special for them.
> 
> They have a symlink, currently pointing to /usr/share/myspell/dicts. That
> symlink needs to be changed.

Any recent change known regarding en_US vs en-US notations in the list of
mozilla* known language names?

Regards,

-- 
Agustin
-------------- next part --------------
#!/usr/bin/perl -w
#
# Registration with Openoffice.org dictionary list.

use Text::Wrap;
$Text::Wrap::columns = 72;

use Debian::Debhelper::Dh_Lib;

my $srcdir_flag = "srcdir";
my $srcdir      = ".";
my $language    = '';
my $hyphenation = '';
my $thesaurus   = '';

# Hijacks the --${srcdir_flag} option from the command line, before
# debhelper's parseopt can see it.

if ( my @tmp = reverse grep {/^--$srcdir_flag=/} @ARGV ){
  $srcdir = shift @tmp;
  $srcdir =~ s/--$srcdir_flag=//;
  @ARGV = grep {!/^--$srcdir_flag=/} @ARGV;
  #print STDERR "*OPTS*: [" . join(', ', at ARGV) . "]\n";
}

init();

my $class          = "myspell";
my $oooinfodir     = "/usr/share/myspell/infos/ooo";
my $old_installdir = "/usr/share/myspell/dicts";
my %installdir     = ( "hunspell"    => "/usr/share/hunspell",
		       "hyphenation" => "/usr/share/hyphen",
		       "thesauri"    => "/usr/share/mythes");

sub mydie {
  my $msg = shift;
  my $see = shift;
  die "$msg\nPlease see $see.\n";
}

sub mywarn {
  my $msg = shift;
  my $see = shift;
  warn "$msg\nPlease see $see.\n";
  exit 0;
}

foreach $package (@{$dh{DOPACKAGES}}) {

  my $do_mozlinks = "yes";

  # Process the debian/info-myspell file
  my $infofile = "";
  if (not ($infofile = pkgfile ($package, "info-$class"))) {
    mywarn ("There is no debian/info-$class file for package $package.",
	    "the dictionaries-common Policy");
  }

  if (! $dh{NOSCRIPTS}) {
    autoscript ($package, "postinst", "postinst-$class",
		"s/#PACKAGE#/$package/");
    autoscript ($package, "postrm", "postrm-$class",
		"s/#PACKAGE#/$package/");
  }

  # Skip setting automatic mozilla links if debian/$package.links exists
  if ( pkgfile($package, "links") ){
    $do_mozlinks = '';
    print STDERR "[installdeb-myspell] " .
      pkgfile($package, "links") .
      " exists: Will not automatically set mozilla links\n";
  }

  # Install the info file in the openoffice info dir.
  my $old_libdir = tmpdir ($package) . $oooinfodir;
  doit ("install", "-d", $old_libdir);
  doit ("install", "-m644", $infofile, "$old_libdir/$package");

  # Get language, hyphenation and thesaurus names from info file
  # if corresponding entries are present
  open INFOFILE, $infofile;
  while (<INFOFILE>){
    chomp;
    #print STDERR "** " . $_ . "\n";
    if ( m/^DICT.*/ ){
      next if $language;
      $language    = ( reverse split (/[\s\t]+/,$_))[0];
    } elsif ( m/^HYPH.*/ ){
      next if $hyphenation;
      $hyphenation = ( reverse split (/[\s\t]+/,$_))[0];
    } elsif ( m/^THES.*/ ){
      next if $thesaurus;
      $thesaurus = ( reverse split (/[\s\t]+/,$_))[0];
    }
    last if ( $language and $hyphenation and $thesaurus );
  }
  close INFOFILE;

  # Make sure the old myspell dict/hyphen/thesauri dir exists
  $old_libdir = tmpdir ($package) . $old_installdir;
  doit ("install", "-d", $old_libdir);

  # Install .aff and .dic in dicts dir, as well all the symlinks if
  # the language name contains an underscore
  if ( $language ){
    my $destdir  = tmpdir ($package) . $installdir{"hunspell"};
    doit ("install", "-d", $destdir);
    for my $ext ("aff", "dic") {
      my $basefile = "$language.$ext";
      my $srcfile  = "$srcdir/$basefile";
      my $ltarget  = $installdir{"hunspell"} . "/$basefile";
      die ("There is no $srcfile file here\n")
	if not -f "$srcfile";
      doit ("install", "-m644", "$srcfile", $destdir);
      doit ("ln", "-fs", "$ltarget", "$old_libdir/$basefile");

      if ( $do_mozlinks && $file =~ /_/) {
	my $link = $file;
	$link    =~ tr/_/-/;
	doit ("ln", "-fs", $basefile, "$destdir/$link");
	doit ("ln", "-fs", $basefile, "$old_libdir/$link");
      }
    }
  }

  # Install Openoffice hyphenation files, if present in info file
  if ( $hyphenation ){
    my $basefile = "$hyphenation.dic";
    my $srcfile  = "$srcdir/$basefile";
    my $destdir  = tmpdir ($package) . $installdir{"hyphenation"};
    my $ltarget  = $installdir{"hyphenation"} . "/$basefile";
    die ("There is no $srcfile file here\n")
      if not -f "$srcfile";
    doit ("install", "-d", $destdir);
    doit ("install", "-m644", "$srcfile", $destdir);
    doit ("ln", "-fs", "$ltarget", "$old_libdir/$basefile");
  }

  # Install Openoffice thesaurus files, if present in info file
  if ( $thesaurus ){
    my $destdir = tmpdir ($package) . $installdir{"thesauri"};
    doit ("install", "-d", $destdir);
    foreach $ext ("dat","idx"){
      my $basefile = "$thesaurus.$ext";
      my $srcfile  = "$srcdir/$basefile";
      my $ltarget  = $installdir{"thesauri"} . "/$basefile";
      die ("There is no $srcfile file here\n")
	if not -f "$srcfile";
      doit ("install", "-m644", "$srcfile", $destdir);
      doit ("ln", "-fs", "$ltarget", "$old_libdir/$basefile");
    }
  }
}

__END__

=head1 NAME

B<installdeb-myspell> - debhelper-like utility for
maintainers of Openoffice.org myspell dictionary Debian packages

=head1 SYNOPSIS

 installdeb-myspell [--srcdir=dir] [debhelper options]

=head1 DESCRIPTION

B<installdeb-myspell> is a debhelper like program that is
responsible for installing appropriate debhelper snippets in
an myspell dictionary package for use under Openoffice.org,
according to the Debian Spell Dictionaries and Tools Policy.

I will also install Openoffice.org hyphenation or thesaurus
files if so requested when used from a Openoffice.org
hyphenation or thesaurus package and add appropriate debhelper
snippets so they are added to the dictionary.lst file.

For more details, see
 /usr/share/doc/dictionaries-common/dsdt-policy.txt.

The actions executed by B<installdeb-myspell> are the
following:

=over

=item Maintainer Scripts

B<installdeb-myspell> installs the necessary
scraps of code in the F<postinst> and F<postrm> scripts.

=item Language info file

B<installdeb-myspell> will look for a file containing
myspell dictionary information, called
F<debian/info-myspell> or
F<debian/package.info-myspell>.  If this file is
successfully parsed, it is installed in the
F<[tmpdir]/usr/share/myspell/infos/ooo> directory.

A typical info-myspell file for a myspell dictionary will
contain something like (all variants must refer to the same dict)

 # Spanish variants
 DICT es ES es_ES
 DICT es AR es_ES
 ...

while will, for a typical hyphenation file, be something like

 # Danish hyphenation
 HYPH da DK hyph_da_DK

or for a sample thesaurus,

 THES en US th_en_US

all with no leading whitespaces.

=item Mozilla spellchecker compatibility

B<installdeb-myspell> will set appropriate symlinks in
destination directory for mozilla spellchecker compatibility unless
debian/$package.links exists. If so, symlink creation is expected
to be handled through debhelper. This will be needed for some languages
(like eo) where mozilla expects the plain isolang code instead of the
lang-COUNTRY one.

=item Dictionary files installation

If the B<--srcdir=dir> option is set B<installdeb-myspell> will look for
the F<.aff/.dic> files in the directory specified by dir and install them
in the default target directory (F<[tmpdir]/usr/share/myspell/dicts>).
Base name will be extracted from the F<info-myspell> file. Same for
hyphenation and thesaurus files.

=item Debconf files

As opposed to B<installdeb-ispell> and B<installdeb-wordlist>, B<installdeb-myspell>
does nothing related to debconf files, that are not needed for myspell. For that
reason if you need to add debconf stuff with debhelper
to your myspell dictionary package do it in the usual way and call
dh_installdebconf(1) as for any other package.

=back

=head1 OPTIONS

--srcdir=dir  Will look for .aff/.dic files in the specified directory
              for myspell dict packages, for .dat files in
              Openoffice.org hyphenation packages and for {.dat,.idx}
              files in Openoffice.org thesaurus packages, installing
              them if present in the default target directory. Base
              name will be extracted from the info-myspell file. If
              this option is specified and files are not present an
              error will appear.

The usual debhelper(1) options are accepted.

=head1 NOTES

This program is not part of debhelper, although it is intended to be used
in Openoffice.org myspell dictionary packages using debhelper in its
building.

=head1 SEE ALSO

debhelper(1)

This program is part of the dictionaries-common-dev package.  It is
intended to be used by maintainers of Openoffice.org myspell dictionaries.
See the documentation under /usr/share/doc/dictionaries-common-dev.

=head1 AUTHORS

Rafael Laboissiere

=cut

#  LocalWords:  debhelper Debian myspell Openoffice


More information about the Dict-common-dev mailing list