[Pkg-ocaml-maint-commits] r3196 - in
/trunk/packages/polygen/trunk/debian: changelog control
patches/02-search-for-grammars.diff polygen-data.link polyrun rules
enrico at users.alioth.debian.org
enrico at users.alioth.debian.org
Mon Oct 2 09:26:49 UTC 2006
Author: enrico
Date: Mon Oct 2 09:26:48 2006
New Revision: 3196
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/?sc=1&rev=3196
Log:
Don't look for grammars in polygen, but do it in a script shipped with polygen-data
Added:
trunk/packages/polygen/trunk/debian/polygen-data.link
trunk/packages/polygen/trunk/debian/polyrun (with props)
Removed:
trunk/packages/polygen/trunk/debian/patches/02-search-for-grammars.diff
Modified:
trunk/packages/polygen/trunk/debian/changelog
trunk/packages/polygen/trunk/debian/control
trunk/packages/polygen/trunk/debian/rules
Modified: trunk/packages/polygen/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/polygen/trunk/debian/changelog?rev=3196&op=diff
==============================================================================
--- trunk/packages/polygen/trunk/debian/changelog (original)
+++ trunk/packages/polygen/trunk/debian/changelog Mon Oct 2 09:26:48 2006
@@ -1,8 +1,10 @@
polygen (1.0.6.ds2-1) unstable; urgency=low
* Try to find grammars according to locales
+ * Split grammar search into a separate polyrun script packaged in
+ polygen-data
- -- Enrico Zini <enrico at debian.org> Sun, 17 Sep 2006 13:18:29 +0200
+ -- Enrico Zini <enrico at debian.org> Sun, 1 Oct 2006 14:20:31 +0200
polygen (1.0.6.ds1-4) unstable; urgency=low
Modified: trunk/packages/polygen/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/polygen/trunk/debian/control?rev=3196&op=diff
==============================================================================
--- trunk/packages/polygen/trunk/debian/control (original)
+++ trunk/packages/polygen/trunk/debian/control Mon Oct 2 09:26:48 2006
@@ -4,7 +4,7 @@
Maintainer: Enrico Zini <enrico at debian.org>
Build-Depends-Indep: debhelper (>= 4.0.0), ocaml-nox, cdbs
Standards-Version: 3.6.2.0
-XS-X-Vcs-Svn: svn://svn.debian.org/svn/pkg-ocaml-maint/trunk/packages/polygen
+XS-Vcs-Svn: svn://svn.debian.org/pkg-ocaml-maint/trunk/packages/polygen/trunk
Package: polygen
Architecture: all
Added: trunk/packages/polygen/trunk/debian/polygen-data.link
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/polygen/trunk/debian/polygen-data.link?rev=3196&op=file
==============================================================================
--- trunk/packages/polygen/trunk/debian/polygen-data.link (added)
+++ trunk/packages/polygen/trunk/debian/polygen-data.link Mon Oct 2 09:26:48 2006
@@ -1,0 +1,1 @@
+/usr/bin/polyrun /usr/bin/polyfind
Added: trunk/packages/polygen/trunk/debian/polyrun
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/polygen/trunk/debian/polyrun?rev=3196&op=file
==============================================================================
--- trunk/packages/polygen/trunk/debian/polyrun (added)
+++ trunk/packages/polygen/trunk/debian/polyrun Mon Oct 2 09:26:48 2006
@@ -1,0 +1,86 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use File::Find;
+use File::Basename;
+
+
+my $GRMDIR='/usr/share/polygen';
+
+my %langmap = (
+ it => "ita",
+ en => "eng",
+ fr => "fra"
+);
+
+# Get the preferred polygen language directory from the current locale
+sub getlang ()
+{
+ my $lang = $ENV{LC_MESSAGES};
+ $lang = $ENV{LANG} if not $lang;
+ $lang =~ s/_.+$//;
+ return undef if not exists $langmap{$lang};
+ return $langmap{$lang};
+}
+
+# Looks for the best absolute path for the given grammar
+sub grmfind ($)
+{
+ my $name = shift;
+ my @cand = ( $name, "$name.grm" );
+ my $l = getlang();
+ if (defined $l)
+ {
+ push @cand, "$GRMDIR/$l/$name";
+ push @cand, "$GRMDIR/$l/$name.grm";
+ }
+
+ # First try the parameter by itself
+ for my $pn (@cand)
+ {
+ return $pn if -e $pn;
+ }
+
+ my @dirs;
+ find({wanted => sub {
+ push @dirs, $File::Find::name if -d $File::Find::name;
+ },
+ no_chdir => 1,
+ }, '/usr/share/polygen');
+
+ for my $d (@dirs)
+ {
+ return "$d/$name" if -e "$d/$name";
+ return "$d/$name.grm" if -e "$d/$name.grm";
+ }
+ return undef;
+}
+
+my $scriptname = basename($0);
+
+if ($scriptname eq 'polyfind')
+{
+ if (@ARGV) {
+ print grmfind($ARGV[0]), "\n";
+ } else {
+ print STDERR "Usage: $scriptname grammar";
+ }
+}
+else
+{
+ if (@ARGV) {
+ my $grm = grmfind($ARGV[$#ARGV]);
+ if (not defined $grm)
+ {
+ print STDERR $ARGV[$#ARGV], ": grammar not found\n";
+ exit 1;
+ }
+ exec 'polygen', $grm
+
+ } else {
+ exec 'polygen';
+ }
+}
+
+exit 0;
Propchange: trunk/packages/polygen/trunk/debian/polyrun
------------------------------------------------------------------------------
svn:executable = *
Modified: trunk/packages/polygen/trunk/debian/rules
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/polygen/trunk/debian/rules?rev=3196&op=diff
==============================================================================
--- trunk/packages/polygen/trunk/debian/rules (original)
+++ trunk/packages/polygen/trunk/debian/rules Mon Oct 2 09:26:48 2006
@@ -56,6 +56,7 @@
install/polygen-data::
# grammar data files
+ install -o root -g root -m 755 debian/polyrun debian/$(cdbs_curpkg)/usr/bin/
debian/install-grammars $(POLYGEN_BASE)/grm/ita debian/$(cdbs_curpkg)/usr/share/polygen/it
debian/install-grammars $(POLYGEN_BASE)/grm/eng debian/$(cdbs_curpkg)/usr/share/polygen/en
debian/install-grammars $(POLYGEN_BASE)/grm/fra debian/$(cdbs_curpkg)/usr/share/polygen/fr
More information about the Pkg-ocaml-maint-commits
mailing list