--- installdeb-aspell	2014-02-03 12:07:59.891375755 +0100
+++ scripts/debhelper/dh_aspell	2014-02-02 23:55:52.517677541 +0100
@@ -1,6 +1,8 @@
 #!/usr/bin/perl -w
 #
 # Registration with aspell dictionary
+#
+# PROMISE: DH NOOP WITHOUT info-aspell
 
 use strict;
 
@@ -54,6 +56,9 @@
 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 $infofile;
 
   # Process the debian/info-aspell file
@@ -70,6 +75,22 @@
   doit ("install", "-d", $lib_dir);
   doit ("install", "-m644", $infofile, "$lib_dir/$package");
 
+  # Move *.cwl to /usr/share/aspell
+  my @cwls = glob("$usr_lib_dir/*.cwl");
+  if (scalar @cwls) {
+    doit ("install", "-d", $usr_share_dir);
+    doit ("mv", @cwls, $usr_share_dir);
+  }
+
+  # Compress *.cwl
+  @cwls = glob("$usr_share_dir/*.cwl");
+  doit ("gzip", "-9nf", @cwls) if scalar @cwls;
+
+  # Remove *.rws files
+  foreach my $rws (glob("$usr_lib_dir/*.rws")) {
+    doit ("rm", "-f", $rws) if (-f $rws && ! -l $rws);
+  }
+
   # Install debhelper and debhelper-like auto-scripts
   unless ( $dh{NOSCRIPTS} or $no_pre_post) {
     if ( $class ne "wordlist" ){
@@ -125,12 +146,12 @@
 		if $debug;
 	      $contents_file = $tmp_contents_file;
 	    } else {
-	      print STDERR "installdeb-$class: Warning:\n"
+	      print STDERR "dh_$class: Warning:\n"
 		. "\"$tmp_contents_file\" found, but no associated 'auto-compat' entry in info file.\n"
 		. "Ignoring \"$tmp_contents_file\"...\n";
 	    }
 	  } elsif ( defined $auto_contents_basenames{$base_name} ){
-	    die "installdeb-$class error: No matching \"$tmp_contents_file\" for 'auto-compat' entry \"$base_name\". Aborting ...\n";
+	    die "dh_$class error: No matching \"$tmp_contents_file\" for 'auto-compat' entry \"$base_name\". Aborting ...\n";
 	  }
 	}
 	# Parse aspell contents file if enabled and present.
@@ -175,18 +196,16 @@
 		    "s/#VARLIBRM#/$varlibrm/");
 
 	# Make sure /var/lib/{a,i}spell directory is available.
-	my $var_lib_dir = tmpdir($package) . "/var/lib/$class";
 	doit ("install", "-d", $var_lib_dir);
 
 	# Automatically provide symlinks for the different hashes
-	my $usr_lib_dir = tmpdir($package) . "/usr/lib/$class";
 	doit ("install", "-d", $usr_lib_dir);
 	foreach my $hash ( sort keys %auto_hash_basenames ){
 	  # Not for extra hashes only for the clean list
 	  next if ( defined $auto_extra_hash_basenames{$hash} );
 	  $hash = $hash . '.' .$hash_extension{$class};
 	  unless ( -e "$usr_lib_dir/$hash" ){
-	    print STDERR "installdeb-$class: Setting \"$usr_lib_dir/$hash\" symlink.\n" if $debug;
+	    print STDERR "dh_$class: Setting \"$usr_lib_dir/$hash\" symlink.\n" if $debug;
 	    doit ("ln", "-sf", "/var/lib/$class/$hash", "$usr_lib_dir/$hash");
 	  }
 	}
@@ -196,6 +215,8 @@
 		"s/#PACKAGE#/$package/");
     autoscript ($package, "postrm", "postrm-$class",
 		"s/#PACKAGE#/$package/");
+    addsubstvar ($package, "$class:Depends", "aspell");  # >= 0.60.3-3, satisfied in squeeze
+    addsubstvar ($package, "$class:Depends", "dictionaries-common", ">= 1.10");
   }
   # -- No debconf handling needed for aspell or hunspell --
 }
@@ -205,16 +226,16 @@
 
 =head1 NAME
 
-B<installdeb-aspell> - debhelper-like utility for
+B<dh_aspell> - debhelper-like utility for
 maintainers of aspell dictionary Debian packages
 
 =head1 SYNOPSIS
 
- installdeb-aspell [debhelper options] 
+ dh_aspell [debhelper options] 
 
 =head1 DESCRIPTION
 
-B<installdeb-aspell> is a debhelper like program that is
+B<dh_aspell> is a debhelper like program that is
 responsible for installing appropriate debhelper snippets in
 an aspell dictionary package,
 according to the Debian Spell Dictionaries and Tools Policy.
@@ -222,19 +243,19 @@
 For more details, see
  /usr/share/doc/dictionaries-common-dev/dsdt-policy.txt.gz
 
-The actions executed by B<installdeb-aspell> are the
+The actions executed by B<dh_aspell> are the
 following:
 
 =over
 
 =item * Maintainer Scripts
 
-B<installdeb-aspell> installs the necessary
+B<dh_aspell> installs the necessary
 scraps of code in the F<postinst> and F<postrm> scripts.
 
 =item * Language info file
 
-B<installdeb-aspell> also checks a file containing
+B<dh_aspell> also checks a file containing
 aspell dictionary information, called
 F<debian/info-aspell> or
 F<debian/package.info-aspell>.  If this file is
@@ -243,7 +264,7 @@
 
 =item * Debconf files
 
-As opposed to B<installdeb-ispell> and B<installdeb-wordlist>, neither B<installdeb-aspell>
+As opposed to B<installdeb-ispell> and B<installdeb-wordlist>, neither B<dh_aspell>
 nor B<installdeb-hunspell> do anything related to debconf files, since both aspell and
 hunspell rely on the environment variable C<LANG> for default dictionary selection
 instead of using symlinks set after a debconf question on dictionary
@@ -252,10 +273,10 @@
 dh_installdebconf(1) as for any other package.
 
 
-=item * Extra installdeb-aspell options in Language info file
+=item * Extra dh_aspell options in Language info file
 
 For benefit of aspell dictionaries using B<aspell-autobuildhash>,
-B<installdeb-aspell> script will look for C<'auto-compat'> and
+B<dh_aspell> script will look for C<'auto-compat'> and
 C<'auto-contents'> fields in F<$lang.info-aspell>, containing base
 name(s) of your compat and, if needed, contents file(s).  If
 C<'auto-compat'> entry is found two debhelper snippets are added, one
