Author: preining-guest
Date: 2005-10-17 10:50:33 +0000 (Mon, 17 Oct 2005)
New Revision: 252

Modified:
   tex-common/trunk/debian/rules
   tex-common/trunk/scripts/dh_installtexfonts
   tex-common/trunk/scripts/postinst-texfonts
   tex-common/trunk/scripts/postrm-texfonts
Log:
if magic comment is already present, do not add the header.
strip of all comments from post(inst|rm)-texfonts prior to installation


Modified: tex-common/trunk/debian/rules
===================================================================
--- tex-common/trunk/debian/rules       2005-10-17 00:16:20 UTC (rev 251)
+++ tex-common/trunk/debian/rules       2005-10-17 10:50:33 UTC (rev 252)
@@ -81,8 +81,10 @@
 
        # debhelper stuff
        # dh_installtexfonts(.1) is already installed via the bin_scripts
-       cp scripts/postrm-texfonts $(INSTDIR)/usr/share/debhelper/autoscripts
-       cp scripts/postinst-texfonts $(INSTDIR)/usr/share/debhelper/autoscripts
+       #cp scripts/postrm-texfonts $(INSTDIR)/usr/share/debhelper/autoscripts
+       #cp scripts/postinst-texfonts $(INSTDIR)/usr/share/debhelper/autoscripts
+       grep -v '^[ \t]*#' scripts/postrm-texfonts > 
$(INSTDIR)/usr/share/debhelper/autoscripts
+       grep -v '^[ \t]*#' scripts/postinst-texfonts > 
$(INSTDIR)/usr/share/debhelper/autoscripts
 
        # ship /var/cache/fonts with proper permissions
        mkdir --mode=1777 $(INSTDIR)/var/cache/fonts/pk

Modified: tex-common/trunk/scripts/dh_installtexfonts
===================================================================
--- tex-common/trunk/scripts/dh_installtexfonts 2005-10-17 00:16:20 UTC (rev 
251)
+++ tex-common/trunk/scripts/dh_installtexfonts 2005-10-17 10:50:33 UTC (rev 
252)
@@ -18,7 +18,7 @@
 dh_installtexfonts is a debhelper program that is responsible for
 registering type1 fonts for TeX.
 
-Your package should depend on tex-common (>= 0.9) so that the
+Your package should depend on tex-common so that the
 update-* commands are available. (This program adds that dependency to
 ${misc:Depends}.)
 
@@ -71,6 +71,21 @@
 
 init();
 
+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
+# present in the file!
+# -_- DebPkgProvidedMaps -_-
+#
+";
+
 foreach my $package (@{$dh{DOPACKAGES}}) {
        my $tmp=tmpdir($package);
        my $file=pkgfile($package,"maps");
@@ -122,15 +137,10 @@
                my $bn=basename($cfg);
                open(CFGFILE, ">$tmp/etc/texmf/updmap.d/$priority$bn") ||
                        error("Cannot open $tmp/etc/texmf/updmap.d/$priority$bn 
for writing!");
-               print CFGFILE <<EOF;
-# $priority$bn
-# 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
-# present in the file!
-# -_- DebPkgProvidedMaps -_-
-#
-EOF
+               if (!magic_comment_present($cfg)) {
+                       print CFGFILE "# $priority$bn\n";
+                       print CFGFILE $magicheader;
+               }
                open(FOO,"<$cfg") || error("Cannot open $cfg for reading!");
                while (<FOO>) { print CFGFILE $_; }
                close(FOO);
@@ -146,15 +156,10 @@
                $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 <<EOF;
-# $p$package.cfg
-# 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
-# present in the file!
-# -_- DebPkgProvidedMaps -_-
-#
-EOF
+               if (!magic_comment_present($file)) {
+                       print CFGFILE "# $p$package.cfg\n";
+                       print CFGFILE $magicheader;
+               }
                foreach (@pkgcfg) {
                        print CFGFILE "$_";
                }
@@ -168,15 +173,8 @@
                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 <<EOF;
-# $p$package.cfg
-# 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
-# present in the file!
-# -_- DebPkgProvidedMaps -_-
-#
-EOF
+               print CFGFILE "# $p$package.cfg\n";
+               print CFGFILE $magicheader;
                foreach (@cmdlinemaps) {
                        print CFGFILE "$_\n";
                }

Modified: tex-common/trunk/scripts/postinst-texfonts
===================================================================
--- tex-common/trunk/scripts/postinst-texfonts  2005-10-17 00:16:20 UTC (rev 
251)
+++ tex-common/trunk/scripts/postinst-texfonts  2005-10-17 10:50:33 UTC (rev 
252)
@@ -5,6 +5,8 @@
 #
 # Author: Florent Rougon <[EMAIL PROTECTED]>
 #
+# comments are stripped from this file before installation!
+
 update_fontmaps()
 {
     update-updmap --quiet

Modified: tex-common/trunk/scripts/postrm-texfonts
===================================================================
--- tex-common/trunk/scripts/postrm-texfonts    2005-10-17 00:16:20 UTC (rev 
251)
+++ tex-common/trunk/scripts/postrm-texfonts    2005-10-17 10:50:33 UTC (rev 
252)
@@ -5,6 +5,8 @@
 #
 # Author: Florent Rougon <[EMAIL PROTECTED]>
 #
+# comments are stripped from this file before installation!
+
 tell_that_errors_are_ok()
 {
     # Cheap option handling...


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

Reply via email to