[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[tex-common] 04/04: rework dh_installtex to get fmtutil rebuilds triggered



This is an automated email from the git hooks/post-receive script.

preining pushed a commit to branch master
in repository tex-common.

commit e8aafeb5dccbc74ecf1be5ca5c7a4731d944747f
Author: Norbert Preining <preining@debian.org>
Date:   Mon Jun 1 11:03:50 2015 +0900

    rework dh_installtex to get fmtutil rebuilds triggered
---
 scripts/dh_installtex | 23 +++++++++++++----------
 scripts/postinst-tex  |  6 +++---
 scripts/postrm-tex    | 31 ++++++++++++++++---------------
 3 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/scripts/dh_installtex b/scripts/dh_installtex
index 6c0f5f1..30c5121 100755
--- a/scripts/dh_installtex
+++ b/scripts/dh_installtex
@@ -501,13 +501,13 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 			error("This call would create multiple copies of $priority$package.$configfileext{$_}.\nPlease read the man page on how this should be fixed!\n");
 		}
 
-		my $targetdir = "$tmp/var/lib/tex-common/$managedir{$type}/$texmftree";
+		my $target = "/var/lib/tex-common/$managedir{$type}/$texmftree";
 		# only hyphen config files remain in /etc/texmf
 		if ($type eq "hyphen") {
-			$targetdir = "$tmp/etc/texmf/$configdir{$type}";
+			$target = "/etc/texmf/$configdir{$type}";
 		}
-		if ( ! $dh{ONLYSCRIPTS} && ! -d $targetdir) {
-			doit("install", "-d", $targetdir);
+		if ( ! $dh{ONLYSCRIPTS} && ! -d "$tmp$target") {
+			doit("install", "-d", "$tmp$target");
 		};
 		#
 		# the cmd line cfg files
@@ -516,9 +516,9 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 			$bn=basename($_);
 			$pr=$cmdlinefilespriority{$type}{$_};
 			if ($type eq "hyphen") {
-				$dofilen = "$targetdir/$pr$bn";
+				$dofilen = "$tmp$target/$pr$bn";
 			} else {
-				$dofilen = "$targetdir/$bn";
+				$dofilen = "$tmp$target/$bn";
 			}
 			WRITECMDLINECFGFILE: do {
 				-r $dofilen &&
@@ -541,6 +541,9 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 				close(CFGFILE);
 				$bn =~ s/\.$configfileext{$type}$//;
 				push @listlines, "$pr$bn";
+				if ($type eq "format") {
+					push @fmtconffiles, "$target/$bn.cnf";
+				}
 			} unless ($dh{ONLYSCRIPTS});
 		}
 		#
@@ -551,7 +554,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 			my $basefile = "$package.$configfileext{$type}";
 			$basefile = "$priority$package.$configfileext{$type}"
 				if ($type eq "hyphen");
-			$dofilen = "$targetdir/$basefile";
+			$dofilen = "$tmp$target/$basefile";
 			-r $dofilen && 
 				error("The config file $dofilen already exists! Cannot recreate it, please call dh_clean -k!");
 			open(CFGFILE, ">$dofilen") || 
@@ -578,6 +581,9 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 			}
 			close(CFGFILE);
 			push @listlines, "$priority$package";
+			if ($type eq "format") {
+				push @fmtconffiles, "$target/$basefile.cnf";
+			}
 		};
 
 		WRITELISTFILE: do {
@@ -591,9 +597,6 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 			foreach (@listlines) {
 				print LISTFILE "$_\n";
 			}
-			if ($type eq "format") {
-				@fmtconffiles = @listlines;
-			}
 			close(LISTFILE);
 		}  if (($type eq "hyphen") && !$dh{ONLYSCRIPTS});
 	}
diff --git a/scripts/postinst-tex b/scripts/postinst-tex
index 5b01ada..28dcf64 100644
--- a/scripts/postinst-tex
+++ b/scripts/postinst-tex
@@ -150,10 +150,10 @@ case "$1" in
                 fi
                 if [ "$i" = format ] ; then
                     for fmt in #FORMATSFILES# ; do
-                        if [ -r "/etc/texmf/fmt.d/$fmt.cnf" ] ; then
-                            dhit_build_format --all --cnffile "/etc/texmf/fmt.d/$fmt.cnf"
+                        if [ -r "$fmt" ] ; then
+                            dhit_build_format --all --cnffile "$fmt"
                         else
-                            echo "config file /etc/texmf/fmt.d/$fmt.cnf not available"
+                            echo "config file $fmt not available"
                         fi
                     done
                 fi
diff --git a/scripts/postrm-tex b/scripts/postrm-tex
index c9f45d0..18dbff6 100644
--- a/scripts/postrm-tex
+++ b/scripts/postrm-tex
@@ -65,28 +65,29 @@ case "$1" in
         dhit_check_run_without_errors -silent update-language
         dhit_check_run_without_errors -silent update-fmtutil --quiet
         for i in #WHATTODO# ; do
-            if [ "$i" = lsr ] ; then
+            case "$i" in
+            lsr)
                 dhit_call_update_texmf_config lsr
-            fi
-            if [ "$i" = lsrfull ] ; then
+                ;;
+            lsrfull)
                 dhit_call_update_texmf_config lsrfull
-            fi
-            if [ "$i" = map ] ; then
+                ;;
+            map)
                 dhit_call_update_texmf_config map
-            fi
-            if [ "$i" = allformats ] ; then
+                ;;
+            allformats|format)
                 for fmt in #FORMATS# ; do
                     rm -f /var/lib/texmf/web2c/$fmt.*
+                    # try to remove empty directories of format dumps
+                    if [ `dirname $fmt` != "." ] ; then
+                        rmdir --ignore-fail-on-non-empty `dirname $fmt`
+                    fi
                 done
-            fi
-            if [ "$i" = format ] ; then
-                for fmt in #FORMATS# ; do
-                    rm -f /var/lib/texmf/web2c/$fmt.*
-                done
-            fi
-            if [ "$i" = hyphen ] ; then
+                ;;
+            hyphen)
                 dhit_call_update_texmf_config hyphen
-            fi
+                ;;
+            esac
         done
     ;;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-tex/tex-common.git


Reply to: