summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2017-11-21 07:07:26 +0000
committerNorbert Preining <preining@logic.at>2017-11-21 07:07:26 +0000
commit045a2c0fc62e6ff1047f6fd6f8261f26a1dfba3e (patch)
tree1bb4b656eea9e90c8e2aaf09b6379585d2540e99 /Master/texmf-dist
parent84d8025f39cb807a3c6f26a095a6579d799e0abb (diff)
fmtutil missing/refresh part 1: factor out file naming code
git-svn-id: svn://tug.org/texlive/trunk@45870 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/fmtutil.pl79
1 files changed, 45 insertions, 34 deletions
diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl
index 3e73d40849e..259045c8518 100755
--- a/Master/texmf-dist/scripts/texlive/fmtutil.pl
+++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl
@@ -516,6 +516,40 @@ sub select_and_rebuild_format {
}
}
+# compute_format_destination
+# takes fmt/eng and returns the location where format and log files should be saved
+# return value (dump file full path, log file full path)
+sub compute_format_destination {
+ my ($fmt, $eng) = @_;
+ my $enginedir;
+ my $fmtfile = $fmt;
+ my $kpsefmt;
+ my $destdir;
+
+ if ($eng eq "mpost") {
+ $fmtfile .= ".mem" ;
+ $kpsefmt = "mp" ;
+ $enginedir = "metapost"; # the directory, not the executable
+ } elsif ($eng =~ m/^mf(lua(jit)?)?(w|-nowin)?$/) {
+ $fmtfile .= ".base" ;
+ $kpsefmt = "mf" ;
+ $enginedir = "metafont" ;
+ } else {
+ $fmtfile .= ".fmt" ;
+ $kpsefmt = "tex" ;
+ $enginedir = $eng;
+ # strip final -dev from enginedir to support engines like luatex-dev
+ $enginedir =~ s/-dev$//;
+ }
+ if ($opts{'no-engine-subdir'}) {
+ $destdir = $opts{'fmtdir'};
+ } else {
+ $destdir = "$opts{'fmtdir'}/$enginedir";
+ }
+ return($kpsefmt, $destdir, $fmtfile, "$fmt.log");
+}
+
+
# rebuild_one_format
# takes fmt/eng and rebuilds it, irrelevant of any setting
# return value FMT_*
@@ -529,18 +563,17 @@ sub rebuild_one_format {
my $addargs = $alldata->{'merged'}{$fmt}{$eng}{'args'};
# running parameters
- my $enginedir;
my $jobswitch = "-jobname=$fmt";
my $prgswitch = "-progname=" ;
my $recorderswitch = ($opts{'recorder'} ? "-recorder" : "");
- my $fmtfile = $fmt;
- my $kpsefmt;
my $pool;
my $tcx = "";
my $tcxflag = "";
my $localpool=0;
my $texargs;
+ my ($kpsefmt, $destdir, $fmtfile, $logfile) = compute_format_destination($fmt, $eng);
+
unlink glob "*.pool";
# addargs processing:
@@ -557,22 +590,6 @@ sub rebuild_one_format {
elsif ($fmt =~ m/^cont-..$/) { $prgswitch .= "context"; }
else { $prgswitch .= $fmt; }
- if ($eng eq "mpost") {
- $fmtfile .= ".mem" ;
- $kpsefmt = "mp" ;
- $enginedir = "metapost"; # the directory, not the executable
- } elsif ($eng =~ m/^mf(lua(jit)?)?(w|-nowin)?$/) {
- $fmtfile .= ".base" ;
- $kpsefmt = "mf" ;
- $enginedir = "metafont";
- } else {
- $fmtfile .= ".fmt" ;
- $kpsefmt = "tex" ;
- $enginedir = $eng;
- # strip final -dev from enginedir to support engines like luatex-dev
- $enginedir =~ s/-dev$//;
- }
-
# check for existence of ini file before doing anything else
if (system("kpsewhich -progname=$fmt -format=$kpsefmt $inifile >$nul 2>&1") != 0) {
# we didn't find the ini file, skip
@@ -683,41 +700,35 @@ sub rebuild_one_format {
return $FMT_FAILURE;
}
- if (! -f "$fmt.log") {
+ if (! -f $logfile) {
print_deferred_error("no log file generated for $fmt/$eng, strange\n");
return $FMT_FAILURE;
}
- open (LOGFILE, "<$fmt.log")
- || print_deferred_warning("cannot open $fmt.log, strange: $!\n");
+ open (LOGFILE, "<$logfile")
+ || print_deferred_warning("cannot open $logfile, strange: $!\n");
my @logfile = <LOGFILE>;
close LOGFILE;
if (grep(/^!/, @logfile) > 0) {
print_deferred_error("\`$cmdline' had errors.\n");
}
- my $fulldestdir;
- if ($opts{'no-engine-subdir'}) {
- $fulldestdir = $opts{'fmtdir'};
- } else {
- $fulldestdir = "$opts{'fmtdir'}/$enginedir";
- }
- TeXLive::TLUtils::mkdirhier($fulldestdir);
+ TeXLive::TLUtils::mkdirhier($destdir);
- if (!File::Copy::move( "$fmt.log", "$fulldestdir/$fmt.log")) {
- print_deferred_error("Cannot move $fmt.log to $fulldestdir.\n");
+ if (!File::Copy::move( $logfile, "$destdir/$logfile")) {
+ print_deferred_error("Cannot move $logfile to $destdir.\n");
}
if ($opts{'recorder'}) {
# the recorder output is used by check-fmttriggers to determine
# package dependencies for each format. Unfortunately omega-based
# engines gratuitiously changed the extension from .fls to .ofl.
my $recfile = $fmt . ($fmt =~ m/^(aleph|lamed)$/ ? ".ofl" : ".fls");
- if (!File::Copy::move( $recfile, "$fulldestdir/$recfile")) {
- print_deferred_error("Cannot move $recfile to $fulldestdir.\n");
+ if (!File::Copy::move( $recfile, "$destdir/$recfile")) {
+ print_deferred_error("Cannot move $recfile to $destdir.\n");
}
}
- my $destfile = "$fulldestdir/$fmtfile";
+ my $destfile = "$destdir/$fmtfile";
if (File::Copy::move( $fmtfile, $destfile )) {
print_info("$destfile installed.\n");
#