summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-11-26 19:31:48 +0000
committerKarl Berry <karl@freefriends.org>2009-11-26 19:31:48 +0000
commitde7b76c392abe4463c6a765f01b58096a8ebd040 (patch)
tree3b2fbc1421f3037068addd66954095a24d042963 /Build/source/texk
parentcee29d1652d5add426ac3aae626f1700ed9e7458 (diff)
perltex 2.0 (24nov09)
git-svn-id: svn://tug.org/texlive/trunk@16180 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/texlive/linked_scripts/ChangeLog4
-rw-r--r--Build/source/texk/texlive/linked_scripts/Makefile.am2
-rw-r--r--Build/source/texk/texlive/linked_scripts/Makefile.in2
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/perltex/perltex.pl (renamed from Build/source/texk/texlive/linked_scripts/perltex/perltex)68
4 files changed, 53 insertions, 23 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/ChangeLog b/Build/source/texk/texlive/linked_scripts/ChangeLog
index 74232f61e5e..7856e8f2cc0 100644
--- a/Build/source/texk/texlive/linked_scripts/ChangeLog
+++ b/Build/source/texk/texlive/linked_scripts/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-26 Karl Berry <karl@tug.org>
+
+ * Makefile.am (nobase_dist_script_SCRIPTS): perltex is now perltex.pl
+
2009-11-26 Peter Breitenlohner <peb@mppmu.mpg.de>
* Makefile.am (bin_links): Remove getnonfreefonts-sys.
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am
index d611ec90cb6..f766cab4756 100644
--- a/Build/source/texk/texlive/linked_scripts/Makefile.am
+++ b/Build/source/texk/texlive/linked_scripts/Makefile.am
@@ -72,7 +72,7 @@ nobase_dist_script_SCRIPTS = \
oberdiek/pdfatfi.pl \
pax/pdfannotextractor.pl \
pdfcrop/pdfcrop.pl \
- perltex/perltex \
+ perltex/perltex.pl \
pkfix/pkfix.pl \
pkfix-helper/pkfix-helper \
ppower4/pdfthumb.tlu \
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in
index feb56d2fb38..5a7875c7749 100644
--- a/Build/source/texk/texlive/linked_scripts/Makefile.in
+++ b/Build/source/texk/texlive/linked_scripts/Makefile.in
@@ -221,7 +221,7 @@ nobase_dist_script_SCRIPTS = \
oberdiek/pdfatfi.pl \
pax/pdfannotextractor.pl \
pdfcrop/pdfcrop.pl \
- perltex/perltex \
+ perltex/perltex.pl \
pkfix/pkfix.pl \
pkfix-helper/pkfix-helper \
ppower4/pdfthumb.tlu \
diff --git a/Build/source/texk/texlive/linked_scripts/perltex/perltex b/Build/source/texk/texlive/linked_scripts/perltex/perltex.pl
index 892cf07ffc8..64309cc1926 100755
--- a/Build/source/texk/texlive/linked_scripts/perltex/perltex
+++ b/Build/source/texk/texlive/linked_scripts/perltex/perltex.pl
@@ -39,6 +39,8 @@ use Pod::Usage;
use File::Basename;
use Fcntl;
use POSIX;
+use Cwd qw(abs_path);
+use IO::Handle;
use warnings;
use strict;
my $latexprog;
@@ -103,15 +105,49 @@ $latexcmdline[$firstcmd] =
'\plmac@doneflag', $doneflag,
'\plmac@pipe', $pipe,
$latexcmdline[$firstcmd];
-foreach my $file ($toperl, $fromperl, $toflag, $fromflag, $doneflag, $pipe) {
- unlink $file while -e $file;
+$toperl = abs_path $toperl;
+$fromperl = abs_path $fromperl;
+$toflag = abs_path $toflag;
+$fromflag = abs_path $fromflag;
+$doneflag = abs_path $doneflag;
+$logfile = abs_path $logfile;
+$pipe = abs_path $pipe;
+$SIG{"ALRM"} = sub {
+ undef $latexpid;
+ exit 0;
+};
+$SIG{"PIPE"} = "IGNORE";
+sub delete_files (@)
+{
+ foreach my $filename (@_) {
+ unlink $filename;
+ while (-e $filename) {
+ unlink $filename;
+ sleep 0;
+ }
+ }
}
+sub awaitexists ($)
+{
+ while (!-e $_[0]) {
+ sleep 0;
+ if (waitpid($latexpid, &WNOHANG)==-1) {
+ delete_files($toperl, $fromperl, $toflag,
+ $fromflag, $doneflag, $pipe);
+ undef $latexpid;
+ exit 0;
+ }
+ }
+}
+delete_files($toperl, $fromperl, $toflag, $fromflag, $doneflag, $pipe);
open (LOGFILE, ">$logfile") || die "open(\"$logfile\"): $!\n";
+autoflush LOGFILE 1;
if (defined $styfile) {
open (STYFILE, ">$styfile") || die "open(\"$styfile\"): $!\n";
}
if (!$usepipe || !eval {mkfifo($pipe, 0600)}) {
sysopen PIPE, $pipe, O_WRONLY|O_CREAT, 0755;
+ autoflush PIPE 1;
print PIPE $pipestring;
close PIPE;
$usepipe = 0;
@@ -131,20 +167,7 @@ else {
$sandbox_eval = \&top_level_eval;
}
while (1) {
- my $awaitexists = sub {
- while (!-e $_[0]) {
- sleep 0;
- if (waitpid($latexpid, &WNOHANG)==-1) {
- foreach my $file ($toperl, $fromperl, $toflag,
- $fromflag, $doneflag, $pipe) {
- unlink $file while -e $file;
- }
- undef $latexpid;
- exit 0;
- }
- }
- };
- $awaitexists->($toflag);
+ awaitexists($toflag);
my $entirefile;
{
local $/ = undef;
@@ -197,6 +220,7 @@ while (1) {
if ($@) {
my $msg = $@;
$msg =~ s/at \(eval \d+\) line \d+\W+//;
+ $msg =~ s/\n/\\MessageBreak\n/g;
$msg =~ s/\s+/ /;
$result = "\\PackageError{perltex}{$msg}";
my @helpstring;
@@ -229,23 +253,25 @@ while (1) {
open (FROMPERL, ">$fromperl") || die "open($fromperl): $!\n";
syswrite FROMPERL, $result;
close FROMPERL;
- unlink $toflag while -e $toflag;
- unlink $toperl while -e $toperl;
- unlink $doneflag while -e $doneflag;
+ delete_files($toflag, $toperl, $doneflag);
open (FROMFLAG, ">$fromflag") || die "open($fromflag): $!\n";
close FROMFLAG;
if (open (PIPE, ">$pipe")) {
+ autoflush PIPE 1;
print PIPE $pipestring;
close PIPE;
}
- $awaitexists->($toperl);
- unlink $fromflag while -e $fromflag;
+ awaitexists($toperl);
+ delete_files($fromflag);
open (DONEFLAG, ">$doneflag") || die "open($doneflag): $!\n";
close DONEFLAG;
+ alarm 1;
if (open (PIPE, ">$pipe")) {
+ autoflush PIPE 1;
print PIPE $pipestring;
close PIPE;
}
+ alarm 0;
}
END {
close LOGFILE;