D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
bin
/
Filename :
installdeb-ispell
back
Copy
#!/usr/bin/perl -w # # Registration with ispell dictionary use strict; my $class = "ispell"; my $program = "installdeb-$class"; my $debug; # ======================================================= # Main part # ======================================================= use Text::Wrap; $Text::Wrap::columns = 72; use Debian::Debhelper::Dh_Lib; use Debian::DictionariesCommon q(:all); use Devel::DictionariesCommon q(:all); if ( "$class" eq "wordlist" or "$class" eq "ispell" ){ init( options => { 'write-elanguages' => \$dh{WRITE_ELANGUAGES}, 'no-elanguages' => \$dh{DISABLE_ELANGUAGES}, 'no-pre-post' => \$dh{DISABLE_PREPOST}, 'no-installdebconf' => \$dh{NO_INSTALLDEBCONF} }); } elsif ( $class eq "aspell" ){ init(options => { 'aspell-simple' => \$dh{ASPELL_SIMPLE} }); } else { init(); } if ( $dh{NOSCRIPTS} ){ $dh{DISABLE_PREPOST}++; $dh{NO_INSTALLDEBCONF}++; }; delete $dh{WRITE_ELANGUAGES} if ( $dh{DISABLE_ELANGUAGES} ); foreach my $package (@{$dh{DOPACKAGES}}) { my $lib_dir = tmpdir($package) . getlibdir($class); my $usr_lib_dir = tmpdir($package) . "/usr/lib/$class"; my $var_lib_dir = tmpdir($package) . "/var/lib/$class"; my $usr_share_dir = tmpdir($package) . "/usr/share/$class"; my %options = ('class' => $class, 'program' => $program, 'package' => $package, 'lib_dir' => $lib_dir, 'usr_lib_dir' => $usr_lib_dir, 'var_lib_dir' => $var_lib_dir, 'usr_share_dir' => $usr_share_dir ); # "cdbs" snippets call installdeb-* scripts unconditionally in # case there is something for them. # Do not trigger an error if not found, just exit. my $dicts = dico_process_infofile(\%options) or exit; # # Install debhelper and debhelper-like auto-scripts unless ( $dh{NOSCRIPTS} or $dh{DISABLE_PREPOST}) { # Install normal autoscripts. While called earlier than autocompat # autoscripts, will be placed later in maintainer scripts. autoscript ($package, "postinst", "postinst-$class", "s/#PACKAGE#/$package/"); autoscript ($package, "postrm", "postrm-$class", "s/#PACKAGE#/$package/"); if ( $class eq "ispell" || $class eq "aspell" ){ my %hash_extension = ("ispell" => "hash", "aspell" => "rws"); my $autocompat_info = dico_process_autocompat($dicts,\%options); # if ( %{$autocompat_info->{'auto-compat'}} ){ verbose_print("$program info:"); if ( defined $autocompat_info->{'auto-contents'} && %{$autocompat_info->{'auto-contents'}} ){ verbose_print(" auto-contents: \"",join(', ',sort keys %{$autocompat_info->{'auto-contents'}}),"\""); } verbose_print(" auto-compat: \"",join(', ',sort keys %{$autocompat_info->{'auto-compat'}}),"\""); verbose_print(" auto-hash: \"", join(', ',sort keys %{$autocompat_info->{'auto-hash'}}), "\""); } # Install autocompat autoscripts if ( %{$autocompat_info->{'auto-compat'}} ){ dico_install_autocompat($autocompat_info,\%options); } } # Populate substvars $class:Depends dico_populate_substvars(\%options); } # -- Handle debconf stuff for this package unless ( $dh{NOSCRIPTS} ){ dico_create_debconf_files($class,$package,$dicts); dico_installcleandebconf($package) unless ( $dh{NO_INSTALLDEBCONF} ) } # } __END__ =head1 NAME B<installdeb-ispell> - debhelper-like utility for maintainers of ispell dictionary Debian packages =head1 SYNOPSIS installdeb-ispell [debhelper options] [options] =head1 DESCRIPTION B<installdeb-ispell> is a debhelper like program that is responsible for installing appropriate debconf config and templates files and debhelper snippets in an ispell dictionary package, according to the Debian Spell Dictionaries and Tools Policy. For more details, see /usr/share/doc/dictionaries-common-dev/dsdt-policy.txt.gz The actions executed by B<installdeb-ispell> are the following: =over =item * Maintainer Scripts B<installdeb-ispell> installs the necessary scraps of code in the F<postinst> and F<postrm> scripts. =item * Language info file B<installdeb-ispell> also checks a file containing ispell dictionary information, called F<debian/info-ispell> or F<debian/package.info-ispell>. If this file is successfully parsed, it is installed in the F</var/lib/dictionaries-common/ispell> directory. =item * Substvars substitutions This script will populate a F<substvars> file, so Depends line in control file can contain ${ispell:Depends} to automatically care for dictionaries-common dependencies. This requires C<Build-Depends> on at least dictionaries-common-dev 1.23.0 and is highly recommended. =item * Debconf files =over =item o templates and config files B<installdeb-ispell> installs the Policy compliant Debconf files from the information contained in the F<info-ispell> file. These files are created as F<debian/config> (or F<debian/package.config>) and F<debian/templates> (or F<debian/package.templates>). No intervention is needed here, since B<installdeb-ispell> will make a call to dh_installdebconf(1). If the package needs to have special code in the F<config> file, the maintainer should supply files called F<debian/config.in> (or F<debian/package.config.in>). In the F<config.in> file, the string C<#DEBHELPER#> must appear alone in one line and start at the first column. B<installdeb-ispell> will replace that token with the necessary Policy compliant code (this works with F<config.in> is either a Bourne shell or Perl script). If the package needs to define its own questions via the F<templates> file the maintainer should either supply files F<debian/po-master.templates> (or F<debian/package.po-master.templates>) together with the appropriate po files if the package handles template localization through po-debconf, or F<debian/templates.in> (or F<debian/package.templates.in>) otherwise. See the po-debconf(7) manual page for more details and remember that the master templates name is now different. The templates defined in the F<templates.in> or F<po-master.templates> files are merged into the Policy compliant templates by installdeb-ispell and a call to dh_installdebconf(1) is internally done. =item o The elanguages template field This field is useful if you want to override the debconf languages string with something different (since the master string remains the same, this will not trigger a new debconf call) or if you really think that the languages string should be internationalized for your package. Note that for most packages the poor man default localization should be enough, and translators should have another priorities. installdeb-ispell default behavior is not adding an C<elanguages> field to the templates file. If you want it added you have to call the script with the explicit B<--write-elanguages> option. This field will be added with value taken from the C<Elanguage> entry in the info file if present, or after the C<Language> value otherwise. Note that this is useful only if: =over =item - You want to fix a buggy entry In this case just fill the C<Elanguage> field in the info file with the new value. This will be shown at the debconf prompt. =item - You want to fully internationalize your entries In this case some black magic is needed at first time for smooth use, =over =item (a) Run B<installdeb-{ispell,wordlist} --no-installdebconf --write-elanguages> for every package whose string should be internationalized. Edit the created F<.templates> files and remove the leading underscores in the elanguages entry if present. =item (b) Run B<debconf-gettextize templates_to_be_internationalized>. Check that all the desired F<.templates> files are in F<debian/po/POTFILES.in> and remove old F<.config> and F<.templates> files. =item (c) Run again B<installdeb-{ispell,wordlist} --no-installdebconf --write-elanguages> and B<debconf-updatepo> (no edit here) to remove references to non-translatable strings. Check that the desired strings are in the po master file (F<debian/po/templates.pot>) and remove F<.config> and F<.templates> files. You are done. If the master C<Elanguages> string is changed, repeat (c) afterward. =back =back =back =item * Extra installdeb-ispell options in Language info file For benefit of ispell dictionaries using B<ispell-autobuildhash>, B<installdeb-ispell> script will look for C<'auto-compat'> fields in F<$dict.info-ispell>, containing base name(s) of your compat file(s). If C<'auto-compat'> entry is found two debhelper snippets are added, one to create/reset compatfile(s) in postinst and the other to remove files in a removal list from postrm. Removal list will contain compat file(s) and associated hash(es) with the same basename. F</usr/lib/ispell/$dict.hash -E<gt> /var/lib/ispell/$dict.hash> symlinks are no longer created automatically by this script. They are now created by new ispell-autobuildhash together with the relevant hashes. Make sure to depend on at least dictionaries-common 1.23 (See F<dictionaries-common.checklist>). =back =head1 OPTIONS The usual dephelper(1) options are accepted. Options below are specific to B<installdeb-ispell> =over =item B<--no-installdebconf> Do not run B<dh_installdebconf> nor remove templates and config file. =item B<--no-pre-post> Do not install {pre,post}{inst,rm} snippets. =item B<--write-elanguages> Create the elanguages stuff. =item B<--debug> Show some extra info. =back =head1 NOTES This program is not part of debhelper, although it is intended to be used in ispell dictionary packages using debhelper in its building. =head1 SEE ALSO debhelper(1), dictionaries-common.checklist, dsdt-policy.txt This program is part of the dictionaries-common-dev package. It is intended to be used by maintainers of ispell dictionary packages for Debian. See the documentation under /usr/share/doc/dictionaries-common-dev. =head1 AUTHORS Rafael Laboissiere, Agustin Martin =cut # Local Variables: # mode: perl # mode: flyspell-prog # ispell-local-dictionary: "american" # End: # LocalWords: aspell ispell wordlist debconf debhelper Debian config postrm # LocalWords: debian elanguages installdeb dephelper installdebconf Elanguage # LocalWords: Laboissiere