/usr/bin/installdeb-myspell is in dictionaries-common-dev 1.27.2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | #!/usr/bin/perl -w
#
# Libreoffice/ooo dict/thesauri/hyphenation file installation.
use strict;
use Text::Wrap;
$Text::Wrap::columns = 72;
use Debian::Debhelper::Dh_Lib;
use Devel::DictionariesCommon q(:all);
my $srcdir;
my $do_altlinks = 1;
# Initialize debhelper with extra installdeb-myspell specific options
init(options => { 'dico-debug' => \$dh{VERBOSE},
'dico-alt-links' => \$do_altlinks,
'dico-no-alt-links' => sub { $do_altlinks = undef },
'o2compat' => sub { warning("Ignoring obsolete \"--o2compat\" option. o2compat support has been removed.") },
'no-o2compat' => sub { warning("Ignoring obsolete \"--no-o2compat\" option. o2compat support has been removed.") },
'srcdir=s' => \$srcdir
});
# and do the real work
my $old_destdir;
my $class = "myspell";
my %installdir = ( "hunspell" => "/usr/share/hunspell",
"hyphenation" => "/usr/share/hyphen",
"thesauri" => "/usr/share/mythes");
foreach my $package (@{$dh{DOPACKAGES}}) {
my %datahash = ();
# Process the debian/info-myspell file. This is not the same kind of
# info file as info-{wordlist,ispell,aspell,hunspell}.
# dico_process_infofile cannot be used here.
my $infofile = "";
unless( $infofile = pkgfile ($package, "info-$class")) {
dico_warning ("There is no debian/info-$class file for package $package.",
"the dictionaries-common Policy");
exit;
}
# Parse info file for dict, hyphen, thesauri, lang and country data..
my $INFOFILE;
open $INFOFILE, $infofile;
while (<$INFOFILE>){
chomp;
next if m/^\s*$/; # Skip empty lines
next if m/^\s*\#/; # Skip comment lines
s/\#.*$//; # Remove comments after dict info
verbose_print("info line: $_");
my ( $type, $lang, $country, $file) = split(' ',$_);
$datahash{$type}{$file}{"$lang\_$country"}++;
}
close $INFOFILE;
# If --srcdir is passed, install .aff and .dic in dicts dir as
# well as mozilla symlinks if it contains an underscore.
if ( $srcdir && defined $datahash{'DICT'} ){
foreach my $dictionary ( keys %{$datahash{'DICT'}} ) {
my $dictdir = $installdir{"hunspell"};
my $destdir = tmpdir ($package) . $dictdir;
my @alternatives = keys %{$datahash{'DICT'}{$dictionary}};
print STDERR "Installing DICT $dictionary files in $destdir\n";
verbose_print(" Alternatives: " . join(', ',@alternatives));
doit ("install", "-d", $destdir);
$dictdir =~ s/.*\///;
for my $ext ("aff", "dic") {
my $basefrom = my $basedest = "$dictionary.$ext";
my $srcfile = "$srcdir/$basefrom";
error("There is no $srcfile file here\n")
unless ( -f "$srcfile" );
# Install base dict in destination directory.
$basedest =~ tr/-/_/;
if ( $basefrom ne $basedest ){
warning("$basefrom renamed to $basedest");
}
doit ("install", "-m644", "$srcfile", "$destdir/$basedest");
# Install normal and Mozilla symlinks for alternative names if needed.
if ( $do_altlinks ){
foreach my $altlink ( @alternatives) {
my $newlink = "$altlink.$ext";
unless ( $newlink eq $basedest ){
verbose_print("Installing alternative symlink $newlink to $basedest");
doit ("ln", "-fs", $basedest, "$destdir/$newlink");
}
}
}
}
}
}
# If --srcdir is passed, install Openoffice hyphenation files
# after data in info file
if ( $srcdir && defined $datahash{'HYPH'} ){
foreach my $hyphenation ( keys %{$datahash{'HYPH'}} ) {
my $hyphdir = $installdir{"hyphenation"};
my $destdir = tmpdir ($package) . $hyphdir;
print STDERR "Installing HYPH $hyphenation files in $destdir\n";
my $basefile = "$hyphenation.dic";
my $srcfile = "$srcdir/$basefile";
$hyphdir =~ s/.*\///;
my $ltarget = "../../$hyphdir/$basefile";
error("There is no $srcfile file here\n")
unless ( -f "$srcfile" );
doit ("install", "-d", $destdir);
doit ("install", "-m644", "$srcfile", $destdir);
}
}
# If --srcdir is passed, install Openoffice thesaurus files
# after data in info file
if ( $srcdir && defined $datahash{'THES'} ){
foreach my $thesaurus ( keys %{$datahash{'THES'}} ) {
my $thesdir = $installdir{"thesauri"};
my $destdir = tmpdir ($package) . $thesdir;
print STDERR "Installing THES $thesaurus files in $destdir\n";
$thesdir =~ s/.*\///;
doit ("install", "-d", $destdir);
foreach my $ext ("dat","idx"){
my $basefile = "$thesaurus.$ext";
my $srcfile = "$srcdir/$basefile";
my $ltarget = "../../$thesdir/$basefile";
error("There is no $srcfile file here\n")
unless ( -f "$srcfile" );
doit ("install", "-m644", "$srcfile", $destdir);
}
}
}
}
__END__
=head1 NAME
B<installdeb-myspell> - debhelper-like helper for Debian packages
containing myspell/hunspell dictionaries or Openoffice.org
thesauri/hyphenation files.
=head1 SYNOPSIS
installdeb-myspell [--srcdir=dir] [--dico-debug] [debhelper options]
=head1 DESCRIPTION
B<installdeb-myspell> is a debhelper like program to help
installing myspell/hunspell dicts as well as Openoffice.org
thesauri or hyphenation files, after contents of an
F<info-myspell> file whose format is that for old
Openoffice.org 2. This needs the B<--srcdir> option enabled.
Note that unless B<--srcdir> option this program will do nothing.
For more details, see
/usr/share/doc/dictionaries-common/dsdt-policy.txt.
The actions executed by B<installdeb-myspell> are the
following (only some of them are done if not in o2
compatibility mode):
=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 named F<debian/info-myspell>
or F<debian/package.info-myspell>. That file contains myspell/hunspell
dictionary, OOO thesauri or hyphenation information with lines like
TYPE LANG COUNTRY NAME
A typical F<info-myspell> file for a myspell/hunspell dictionary will
contain something like
# 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 whitespace. Commented lines are allowed.
=item Dictionary, thesaurus and hyphenation 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/hunspell>).
Base name will be extracted from the F<info-myspell> file (last string in
the line). If target dict uses the ancient Mozilla hyphen form, it will
be renamed to the lowbar form on installation.
Same (but the renaming) for hyphenation and thesaurus files, to be installed in
F<[tmpdir]/usr/share/hyphen> and F<[tmpdir]/usr/share/mythes>.
=item Dictionaries alternative symlinks creation
B<installdeb-myspell> will, according to info extracted from the F<info-myspell>,
automatically set B<lang_COUNTRY> symlinks to the dict files installed by
B<installdeb-myspell>. This will only be done when the B<--srcdir> option is
used.
If B<--srcdir> option is used and the F<info-myspell> file contains something
like
# Spanish variants
DICT es ES es
DICT es AR es
...
B<installdeb-myspell> will automatically set B<es_ES> and B<es_AR> symlinks
=item Mozilla spellchecker compatibility
For myspell/hunspell dictionaries, Mozilla had a B<lang{,-COUNTRY}> to names
translation table using hyphens as separators (and for some languages not using
country part at all) instead of lowbars.
Shortly, that will no longer be the case. Mozilla will also accept
B<lang_COUNTRY> format for that translation table, no special things
will be needed. In particular, do not duplicate entries in both lowbar
and hyphen forms. Use lowbar.
=item Debconf files
As opposed to B<installdeb-ispell> and B<installdeb-wordlist>, B<installdeb-myspell>
does nothing related to debconf files, not needed for myspell/hunspell dicts and
OOO thesauri and hyphenation files. If you need to add debconf stuff with debhelper
proceed in the usual way and call dh_installdebconf(1) as for any other package.
=back
=head1 OPTIONS
--dico-debug Show some B<installdeb-myspell> specific debugging info.
Does not enable debhelper debug, you need to enable
it separately.
--srcdir=dir Will look for F<.aff/.dic> files in the specified directory
for myspell/hunspell dict packages, for F<.dic> files in
Openoffice.org hyphenation packages and for F<.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.
--dico-{no-}alt-links {Process/Do not process} alternative symlinks
according to info found in the myspell info file.
The usual debhelper(7) options are accepted.
=head1 NOTES
This program is not part of debhelper, although depends on and is
intended to work together with it.
=head1 SEE ALSO
debhelper(7)
This program is part of the dictionaries-common-dev package. It is
intended for use by maintainers of packages containing myspell/hunspell
dictionaries or Openoffice.org thesauri/hyphenation files.
See the documentation under /usr/share/doc/dictionaries-common-dev.
=head1 AUTHORS
Rafael Laboissiere <rafael@debian.org>,
Agustin Martin <agmartin@debian.org>
=cut
# LocalWords: debhelper Debian myspell Openoffice
|