Author: preining-guest
Date: 2005-10-17 11:28:30 +0000 (Mon, 17 Oct 2005)
New Revision: 254

Modified:
   tex-common/trunk/scripts/dh_installtexfonts
Log:
merge maps and debian/package.maps, error on multiple conflicting cfg files


Modified: tex-common/trunk/scripts/dh_installtexfonts
===================================================================
--- tex-common/trunk/scripts/dh_installtexfonts 2005-10-17 11:03:30 UTC (rev 
253)
+++ tex-common/trunk/scripts/dh_installtexfonts 2005-10-17 11:28:30 UTC (rev 
254)
@@ -39,15 +39,16 @@
 if you use -p, -i, or -a flags, it will be the first package specified
 by those flags.
 
-If you mix these variants and the same file 10package.cfg would be created
-several times (by variant 1) if you provide a cfg file with the same name, 
-by 2) and by 3) if debian/package.maps is present), they will get renamed
-to 10package1.cfg and 10package2.cfg.
+The command line maps (Variant 2) are merged into the debian/package.maps 
+file and the merged file is installed as 10package.cfg. If you specify 
+an additional package.cfg (Variant 1) on the cmd line, this will raise
+an error since both files would be installed as 10package.cfg. You can
+only specify package.cfg on the cmd line if no debian/package.maps nor any
+cmd line Map files are present.
 
-The files as installed in variant 1) or 3) will get an additional header
-containing a explanation text and the magic header for correct updmap
-function. Please see the TeX Policy for more information on this
-magic header.
+If the cfg files created do not contain the magic comment, an additional
+header is added with explanation, warning and the magic comment.
+Please see the TeX Policy for more information on this magic comment.
 
 This program automatically generates the postinst and postrm commands needed
 to register TeX fonts.  See L<dh_installdeb(1)> for an explanation of how this
@@ -93,8 +94,7 @@
        my @pkgcfg;
        my @cmdlinemaps;
        my @cmdlinecfgs;
-       my $pkgfilepresent = 0;
-       my $pkgfileext = 0;
+       my $pkgfileoncmdline = 0;
        my @listlines;
 
        if (defined($dh{PRIORITY}) && $dh{PRIORITY} ne '') {
@@ -104,7 +104,6 @@
                open(FOO, "<$file") || error("$file cannot be opened.");
                @pkgcfg = <FOO>;
                close(FOO);
-               $pkgfilepresent = 1;
        }
        if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
                foreach my $entry (@ARGV) {
@@ -113,7 +112,7 @@
                        } elsif ($entry =~ m/\.cfg$/) {
                                my $bn=basename($entry);
                                if ($entry eq "$package.cfg") {
-                                       $pkgfileext++;
+                                       $pkgfileoncmdline = 1;
                                }
                                push @cmdlinecfgs, $entry;
                        } else {
@@ -122,11 +121,15 @@
                }
        }
 
-       if (!$pkgfilepresent && ($#cmdlinemaps < 0) && ($#cmdlinecfgs < 0)) {
+       if (!$file && ($#cmdlinemaps < 0) && ($#cmdlinecfgs < 0)) {
                # we have nothing to do here, skip to the next one!
                next;
        }
 
+       if ($pkgfileoncmdline && ($file || ($#cmdlinemaps >= 0))) {
+               error("This call would create multiple copies of 
$priority$package.cfg.\nPlease read the man page on how this should be 
fixed!\n");
+       }
+
         if ( ! -d "$tmp/etc/texmf/updmap.d/") {
             doit("install","-d","$tmp/etc/texmf/updmap.d/");
         }
@@ -150,38 +153,25 @@
        }
        #
        # now debian/package.maps and/or debian/maps
+       # merge in the cmd line arguments
        #
-       if ($pkgfilepresent) {
-               my $p = $priority + $pkgfileext;
-               $pkgfileext++;
-               open(CFGFILE, ">$tmp/etc/texmf/updmap.d/$p$package.cfg") || 
-                       error("Cannot open 
$tmp/etc/texmf/updmap.d/$p$package.cfg for writing!");
-               if (!magic_comment_present($file)) {
-                       print CFGFILE "# $p$package.cfg\n";
+       if ($file || ($#cmdlinemaps >= 0)) {
+               open(CFGFILE, ">$tmp/etc/texmf/updmap.d/$priority$package.cfg") 
|| 
+                       error("Cannot open 
$tmp/etc/texmf/updmap.d/$priority$package.cfg for writing!");
+               if (($file && !magic_comment_present($file)) ||
+                   (!$file && ($#cmdlinemaps >= 0))) {
+                       print CFGFILE "# $priority$package.cfg\n";
                        print CFGFILE $magicheader;
                }
                foreach (@pkgcfg) {
                        print CFGFILE "$_";
                }
-               close(CFGFILE);
-               push @listlines, "$p$package";
-       }
-       #
-       # finally do the cmdline maps
-       #
-       if ($#cmdlinemaps >= 0) {
-               my $p = $priority + $pkgfileext;
-               open(CFGFILE, ">$tmp/etc/texmf/updmap.d/$p$package.cfg") || 
-                       error("Cannot open 
$tmp/etc/texmf/updmap.d/$p$package.cfg for writing!");
-               print CFGFILE "# $p$package.cfg\n";
-               print CFGFILE $magicheader;
                foreach (@cmdlinemaps) {
                        print CFGFILE "$_\n";
                }
                close(CFGFILE);
-               push @listlines, "$p$package";
+               push @listlines, "$priority$package";
        }
-
        
         if ( ! -d "$tmp/var/lib/tex-common/fontmap-cfg/") {
             doit("install","-d","$tmp/var/lib/tex-common/fontmap-cfg/");


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

Reply via email to