diff options
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 33 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 19 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPOBJ.pm | 20 |
3 files changed, 70 insertions, 2 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 581ac3aff1f..10fa01371a7 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -478,17 +478,26 @@ sub handle_execute_actions { chomp(my $TEXMFLOCAL = `kpsewhich -var-value=TEXMFLOCAL`); - # format means create missing formats (because a new one was added). # format-regenerate is used when the paper size changes. In that # case, if option_create_formats is set, we simply want to generate - # all formats; if not, then we only want to refresh existing ones. # { + my %done_formats; + my %updated_engines; my %do_enable; my $do_full = 0; for my $m (keys %{$::execute_actions{'enable'}{'formats'}}) { $do_full = 1; $do_enable{$m} = 1; + # here we check whether an engine is updated + my %foo = %{$::execute_actions{'enable'}{'formats'}{$m}}; + if (!defined($foo{'name'}) || !defined($foo{'engine'})) { + tlwarn("Very strange error, please report " . %foo); + } else { + if ($foo{'name'} eq $foo{'engine'}) { + $updated_engines{$m} = 1; + } + } } for my $m (keys %{$::execute_actions{'disable'}{'formats'}}) { $do_full = 1; @@ -504,6 +513,26 @@ sub handle_execute_actions { for my $f (keys %do_enable) { info ("(re)creating format dump $f\n"); $errors += do_cmd_and_check("fmtutil-sys --byfmt $f"); + $done_formats{$f} = 1; + } + + # check that if an engine is updated that all formats that are based on + # that engine are also updated + my @upen = keys %updated_engines; + if (@upen) { + for my $d ($localtlpdb->format_definitions) { + my %def = %$d; + if (defined($def{'engine'})) { + next if defined($done_formats{$def{'name'}}); + for my $e (@upen) { + if ($def{'engine'} eq $e) { + info("updating format $def{'name'} (engine $e updated)\n"); + $errors += do_cmd_and_check("fmtutil-sys --byfmt $def{'name'}"); + $done_formats{$def{'name'}} = 1; + } + } + } + } } } } diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 9e245dcf71b..b826db38e73 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -1275,6 +1275,25 @@ sub option_platform { =pod +=item C<< $tlpdb->format_definitions >> + +This function returns a list of references to hashes where each hash +represents a parsed AddFormat line. + + +=cut + +sub format_definitions { + my $self = shift; + my @ret; + foreach my $p ($self->list_packages) { + my $obj = $self->get_package ($p); + die "$0: No TeX Live package named $p, strange" if ! $obj; + push @ret, $obj->format_definitions; + } + return(@ret); +} + =item C<< $tlpdb->fmtutil_cnf_lines >> The function C<fmtutil_cnf_lines> returns the list of a fmtutil.cnf file diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index 10db4ff062a..80ba30d23d9 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -893,6 +893,21 @@ sub allbinfiles { return @ret; } +sub format_definitions { + my $self = shift; + my @ret; + for my $e ($self->executes) { + if ($e =~ m/AddFormat\s+(.*)\s*/) { + my %r = TeXLive::TLUtils::parse_AddFormat_line("$1"); + if (defined($r{"error"})) { + die "$r{'error'}, package $pkg, execute $e"; + } + push @ret, \%r; + } + } + return @ret; +} + # # execute stuff # @@ -1529,6 +1544,11 @@ returns a list of all files of all types. returns a list of all binary files. +=item C<< $tlpobj->format_definitions >> + +The function C<format_definitions> returns a list of references to hashes +where each hash is a format definition. + =item C<< $tlpobj->fmtutil_cnf_lines >> The function C<fmtutil_cnf_lines> returns the lines for fmtutil.cnf |