[Dict-common-dev] myspell support

Rafael Laboissiere Rafael Laboissiere <rafael@debian.org>
Sat, 18 Oct 2003 10:21:05 +0200


--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

* Rafael Laboissiere <laboissiere@psy.mpg.de> [2003-10-17 23:17]:

> I made the assumption that the upstream aff and dic files are located at
> the top dir.  We might introduce an option to allow overrideing of the
> location of the files in the build tree.

There is a new patch (against the version in CVS) attached below that
addresses this issue.  The patch makes the installdeb-myspell script accept
now an argument indicating the directory (relative to the top dir) where the
aff and dic files are to be found.  For instance:

    installdeb-myspell --package=myspell-pt-br some/dir

I tried to implement this with an option, like "--srcdir=some/dir", but it
is not possible, since debhelper hijacks all the options when init() is run.

The symlinks are done with options "-fs" now, such that the program does not
abort when the links already exist.  

-- 
Rafael

--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="installdeb-myspell.patch"

--- installdeb-myspell	2003-10-17 22:35:14.000000000 +0200
+++ installdeb-myspell-new	2003-10-18 10:11:34.000000000 +0200
@@ -10,6 +10,7 @@
 
 my $class = "myspell";
 my $oooinfodir="/usr/share/myspell/infos/ooo";
+my $dictdir = "/usr/share/myspell/dicts";
 
 sub mydie {
     my $msg = shift;
@@ -37,6 +38,28 @@
     my $lib_dir = tmpdir ($package) . $oooinfodir;
     doit ("install", "-d", $lib_dir);
     doit ("install", "-m644", $infofile, "$lib_dir/$package");  
+    
+    # Get language name from info file
+    my $language = (reverse (split (/\s+/, `cat $infofile`)))[0];
+    
+    # Install .aff and .dic in dicts dir, as well all the symlinks if 
+    # the language name contains an underscore
+    $lib_dir = tmpdir ($package) . $dictdir;
+    doit ("install", "-d", $lib_dir);
+    
+    for my $ext ("aff", "dic") {
+	my $srcdir = exists $ARGV[0] ? $ARGV[0] : ".";
+	my $file = "$language.$ext";
+	mydie ("There is no $file file here")
+            if not -f $file;
+	doit ("install", "-m644", "$srcdir/$file", $lib_dir);
+	if ($file =~ /_/) {
+	    my $link = $file;
+	    $link =~ tr/_/-/;
+	    doit ("ln", "-fs", $file, "$lib_dir/$link");
+	}
+    }
+
 }
 
 __END__

--2fHTh5uZTiUOsy+g--