From a966a76688af35e8f788ba4cd9a98743c496ae73 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 23 Nov 2017 21:06:47 +0000 Subject: lwarp (23nov17) git-svn-id: svn://tug.org/texlive/trunk@45895 c570f23f-e606-0410-a88d-b1316a301751 --- .../texk/texlive/linked_scripts/lwarp/lwarpmk.lua | 2 +- .../texk/texlive/linked_scripts/texlive/fmtutil.pl | 105 ++++++++++++--------- 2 files changed, 61 insertions(+), 46 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua b/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua index c813ebfe66a..2521fa2524b 100755 --- a/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua +++ b/Build/source/texk/texlive/linked_scripts/lwarp/lwarpmk.lua @@ -4,7 +4,7 @@ -- Print the usage of the lwarpmk command: -printversion = "v0.43" +printversion = "v0.44" function printhelp () print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ; diff --git a/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl b/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl index d351e8d0299..7d848571870 100755 --- a/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl +++ b/Build/source/texk/texlive/linked_scripts/texlive/fmtutil.pl @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# $Id: fmtutil.pl 44190 2017-05-04 21:38:43Z preining $ +# $Id: fmtutil.pl 45872 2017-11-21 07:07:45Z preining $ # fmtutil - utility to maintain format files. # (Maintained in TeX Live:Master/texmf-dist/scripts/texlive.) # @@ -24,11 +24,11 @@ BEGIN { TeX::Update->import(); } -my $svnid = '$Id: fmtutil.pl 44190 2017-05-04 21:38:43Z preining $'; -my $lastchdate = '$Date: 2017-05-04 23:38:43 +0200 (Thu, 04 May 2017) $'; +my $svnid = '$Id: fmtutil.pl 45872 2017-11-21 07:07:45Z preining $'; +my $lastchdate = '$Date: 2017-11-21 08:07:45 +0100 (Tue, 21 Nov 2017) $'; $lastchdate =~ s/^\$Date:\s*//; $lastchdate =~ s/ \(.*$//; -my $svnrev = '$Revision: 44190 $'; +my $svnrev = '$Revision: 45872 $'; $svnrev =~ s/^\$Revision:\s*//; $svnrev =~ s/\s*\$$//; my $version = "r$svnrev ($lastchdate)"; @@ -436,9 +436,12 @@ sub callback_build_formats { } } - # if the user asked to rebuild something, but we did nothing, report. - if ($err + $suc == 0) { - print_info("did not find entry for $what=$whatarg, skipped\n"); + # if the user asked to rebuild something, but we did nothing, report + # unless we tried to rebuild only missing formats. + if ($what ne "missing") { + if ($err + $suc == 0) { + print_info("did not find entry for $what=$whatarg, skipped\n"); + } } my $stdo = ($mktexfmtMode ? \*STDERR : \*STDOUT); for (@deferred_stdout) { print $stdo $_; } @@ -467,12 +470,15 @@ sub select_and_rebuild_format { my ($fmt, $eng, $what, $whatarg) = @_; return $FMT_DISABLED if ($alldata->{'merged'}{$fmt}{$eng}{'status'} eq 'disabled'); + + my ($kpsefmt, $destdir, $fmtfile, $logfile) = compute_format_destination($fmt, $eng); + my $doit = 0; # we just identify 'all', 'refresh', 'missing' # I don't see much point in keeping all of them $doit = 1 if ($what eq 'all'); - $doit = 1 if ($what eq 'refresh'); - $doit = 1 if ($what eq 'missing'); + $doit = 1 if ($what eq 'refresh' && -r "$destdir/$fmtfile"); + $doit = 1 if ($what eq 'missing' && ! -r "$destdir/$fmtfile"); $doit = 1 if ($what eq 'byengine' && $eng eq $whatarg); $doit = 1 if ($what eq 'byfmt' && $fmt eq $whatarg); # TODO @@ -510,18 +516,52 @@ sub select_and_rebuild_format { } } if ($doit) { - return rebuild_one_format($fmt,$eng); + return rebuild_one_format($fmt, $eng, $kpsefmt, $destdir, $fmtfile, $logfile); } else { return $FMT_NOTSELECTED; } } +# 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_* # sub rebuild_one_format { - my ($fmt, $eng) = @_; + my ($fmt, $eng, $kpsefmt, $destdir, $fmtfile, $logfile) = @_; print_info("--- remaking $fmt with $eng\n"); # get variables @@ -529,12 +569,9 @@ 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 = ""; @@ -557,22 +594,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 +704,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 = ; 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"); # -- cgit v1.2.3