Author: preining-guest
Date: 2005-12-09 10:41:38 +0000 (Fri, 09 Dec 2005)
New Revision: 391

Modified:
   tex-common/trunk/debian/changelog
   tex-common/trunk/scripts/dh_installtexfonts
Log:
implementing --flavor


Modified: tex-common/trunk/debian/changelog
===================================================================
--- tex-common/trunk/debian/changelog   2005-12-09 10:39:04 UTC (rev 390)
+++ tex-common/trunk/debian/changelog   2005-12-09 10:41:38 UTC (rev 391)
@@ -2,14 +2,16 @@
 
   * tex-common now provides the symlink /usr/share/texmf/doc -->
     ../doc/texmf, because tetex-doc now puts its files into TEXMFDIST
-    [frank]. 
+    [frank].
   * Do no longer install teTeX's common.* files and dsf-patch.mk, they are
     no longer used.
-  * Translations: 
+  * Translations:
     - Update Czech debconf translation, thanks to Miroslav Kure
       <[EMAIL PROTECTED]> (closes: #341941) [frank]
+  * Implement --flavor for dh_installtexfonts, first flavors are only 
+    for generating config files for maps [preining].
 
- -- Frank Küster <[EMAIL PROTECTED]>  Mon,  5 Dec 2005 16:13:38 +0100
+ -- Norbert Preining <[EMAIL PROTECTED]>  Fri,  9 Dec 2005 11:40:48 +0100
 
 tex-common (0.12) unstable; urgency=low
 

Modified: tex-common/trunk/scripts/dh_installtexfonts
===================================================================
--- tex-common/trunk/scripts/dh_installtexfonts 2005-12-09 10:39:04 UTC (rev 
390)
+++ tex-common/trunk/scripts/dh_installtexfonts 2005-12-09 10:41:38 UTC (rev 
391)
@@ -11,7 +11,8 @@
 
 =head1 SYNOPSIS
 
-B<dh_installtexfonts> [S<I<debhelper options>>] [B<-n>] [B<--priority=>I<n>] 
[S<I<maptype=mapfile ...>>] [S<I<cfg-file[=I<n>] ...>>] 
+B<dh_installtexfonts> [S<I<debhelper options>>] [B<-n>] [B<--priority=>I<n>] 
+    [B<--flavor=>I<flavor>] [S<I<maptype=mapfile ...>>] [S<I<cfg-file[=I<n>] 
...>>] 
 
 =head1 DESCRIPTION
 
@@ -96,6 +97,25 @@
 
 Set the default priority to I<n> instead of 10.
 
+=item B<--flavor=>I<flavor>
+
+This option will be used to switch additional options on. At the moment
+you can select for I<flavor> either B<config_for_active_maps> or 
+B<config_for_all_maps>.
+B<config_for_active_maps> will create a file I<config.bar> for each active
+(i.e. uncommented) map in each of the cfg file generated by one of the
+three methods described above. These files are installed in
+/usr/share/texmf/dvips/config/.
+
+If you select B<config_for_all_maps> the script will generate I<config.bar>
+even for those map files which are present in a cfg file, but deactivated by a 
comment.
+
+The file I<config.bar> is used when called by `dvips -Pbar ...'. Thus it
+allows the activation of single map files even if they are not automatically
+activated via the updmap(-sys) mechanism.
+
+Default is I<not> to generate any config files.
+
 =head1 NOTES
 
 Note that this command is not idempotent. "dh_clean -k" should be called
@@ -110,13 +130,26 @@
 
 init();
 
+sub extract_map {
+       my ($line,$doconfig) = @_;
+       if ($doconfig == 0) { return ""; }
+       if ($_ =~ 
m/^[[:space:]]*([#[:space:]]*)[[:space:]]*(Mixed)?Map[[:space:]]*(.*\.map)[[:space:]]*(#.*)?$/)
 {
+               my $comment = $1;
+               my $map = $3;
+               if (($comment eq "") || ($doconfig == 2)) {
+                       return $map;
+               }
+       }
+       return "";
+}
+
 sub magic_comment_present {
        my ($fname) = @_;
        my @args = ( "grep", "-q", "^# -_- DebPkgProvidedMaps -_-", $fname );
        if (system(@args) == 0) { return 1; }
        return 0;
 }
-               
+
 my $magicheader = "# You can change/add entries to this file and changes will 
be preserved
 # over upgrades, even if you have removed the main package prior
 # (not if you purged it). You should leave the following pseudo comment
@@ -135,10 +168,21 @@
        my @cmdlinecfgs;
        my $pkgfileoncmdline = 0;
        my @listlines;
+       my @mapfiles;
+       my $doconfig = 0;
 
        if (defined($dh{PRIORITY}) && $dh{PRIORITY} ne '') {
                $priority=$dh{PRIORITY};
        }
+       if (defined($dh{FLAVOR})) {
+               if ($dh{FLAVOR} eq "config_for_active_maps") {
+                       $doconfig = 1;
+               } elsif ($dh{FLAVOR} eq "config_for_all_maps") {
+                       $doconfig = 2;
+               } else {
+                       error("Specified flavor $dh{FLAVOR} not 
supported.\nPlease see man page for supported flavors!\n");
+               }
+       }
        if ($file) {
                open(FOO, "<$file") || error("$file cannot be opened.");
                @pkgcfg = <FOO>;
@@ -148,6 +192,7 @@
                foreach my $entry (@ARGV) {
                        if ($entry =~ m/^(Map|MixedMap)=(.*)$/) {
                                push @cmdlinemaps, "$1 $2";
+                               if ($doconfig > 0) { push @mapfiles, $2; }
                        } elsif ($entry =~ m/^(.*\.cfg)(=([[:digit:]]+))?$/) {
                                my $fn=$1;
                                my $pr=$priority;
@@ -194,7 +239,11 @@
                        print CFGFILE $magicheader;
                }
                open(FOO,"<$fn") || error("Cannot open $fn for reading!");
-               while (<FOO>) { print CFGFILE $_; }
+               while (<FOO>) { 
+                       my $m;
+                       print CFGFILE $_; 
+                       if ($m = extract_map($_, $doconfig)) { push @mapfiles, 
$m; }
+               }
                close(FOO);
                close(CFGFILE);
                $bn =~ s/\.cfg$//;
@@ -216,7 +265,9 @@
                        print CFGFILE $magicheader;
                }
                foreach (@pkgcfg) {
+                       my $m;
                        print CFGFILE "$_";
+                       if ($m = extract_map($_, $doconfig)) { push @mapfiles, 
$m; }
                }
                foreach (@cmdlinemaps) {
                        print CFGFILE "$_\n";
@@ -236,6 +287,20 @@
        }
        close(LISTFILE);
 
+       if ($#mapfiles >= 0) {
+               doit("install","-d","$tmp/usr/share/texmf/dvips/config/");
+       }
+       foreach my $m (@mapfiles) {
+               my $f = $m;
+               $f =~ s/\.map$//;
+               -r "$tmp/usr/share/texmf/dvips/config/config.$f" &&
+                       error("The dvips config file 
$tmp/usr/share/texmf/dvips/config/config.$f already exists!\nYou may have to 
call dh_clean -k!\n");
+               open(CNFFILE, ">$tmp/usr/share/texmf/dvips/config/config.$f") ||
+                       error("Cannot open 
$tmp/usr/share/texmf/dvips/config/config.$f for writing!");
+               verbose_print("Writing 
$tmp/usr/share/texmf/dvips/config/config.$f");
+               print CNFFILE "Map +$m\n";
+               close(CNFFILE);
+       }
        if (! $dh{NOSCRIPTS}) {
                autoscript($package, "postinst", "postinst-texfonts", "");
                autoscript($package, "postrm",   "postrm-texfonts",   "");


_______________________________________________
Pkg-tetex-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-tetex-commits

Reply via email to