From 08d74423c54b4d5f76dd5a34e46395e7070863fa Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 5 Aug 2011 00:09:21 +0000 Subject: update depending formats based on dependencies, currently only for latex and tex git-svn-id: svn://tug.org/texlive/trunk@23411 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/tlmgr.pl | 25 ++++++++++++++++++++++ Master/tlpkg/TeXLive/TLUtils.pm | 40 +++++++++++++++++++++++++++++------ 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 2c60072fa3f..9465942d9ac 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -665,6 +665,25 @@ sub handle_execute_actions } } + # + # check if *depending* formats have been changed + # we are currently only caring for package "latex" and "tex". If + # one of these has changed, we search for all packages *depending* + # on latex/tex and regenerate all formats in these packages. + my @check_indirect_formats; + push @check_indirect_formats, $localtlpdb->needed_by("latex") + if ($::latex_updated); + push @check_indirect_formats, $localtlpdb->needed_by("tex") + if ($::tex_updated); + for my $p (@check_indirect_formats) { + my $tlp = $localtlpdb->get_package($p); + if (!defined($tlp)) { + tlwarn("$p mentioned but not found in local tlpdb, strange!\n"); + next; + } + TeXLive::TLUtils::announce_execute_actions("enable", $tlp, "format"); + } + # 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 @@ -2832,6 +2851,12 @@ sub action_update { } } + # + # special check for depending format updates: + # if one of latex or tex has been updated, we rebuild the formats + # defined in packages *depending* on these packages. + TeXLive::TLUtils::announce_execute_actions("latex-updated") if ($updated{"latex"}); + TeXLive::TLUtils::announce_execute_actions("tex-updated") if ($updated{"tex"}); print "end-of-updates\n" if $::machinereadable; diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index b0a5055faa8..50a41ff3098 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -167,6 +167,7 @@ BEGIN { &give_ctan_mirror &give_ctan_mirror_base &create_mirror_list + &extract_mirror_entry &tlmd5 &xsystem &run_cmd @@ -1826,7 +1827,7 @@ after all packages have been unpacked. =cut sub announce_execute_actions { - my ($type, $tlp) = @_; + my ($type, $tlp, $what) = @_; # do simply return immediately if execute actions are suppressed return if $::no_execute_actions; @@ -1838,6 +1839,14 @@ sub announce_execute_actions { $::files_changed = 1; return; } + if (defined($type) && ($type eq "latex-updated")) { + $::latex_updated = 1; + return; + } + if (defined($type) && ($type eq "tex-updated")) { + $::tex_updated = 1; + return; + } if (!defined($type) || (($type ne "enable") && ($type ne "disable"))) { die "announce_execute_actions: enable or disable, not type $type"; } @@ -1845,22 +1854,26 @@ sub announce_execute_actions { if ($tlp->runfiles || $tlp->srcfiles || $tlp->docfiles) { $::files_changed = 1; } + $what = "map format hyphen" if (!defined($what)); foreach my $e ($tlp->executes) { if ($e =~ m/^add((Mixed)?Map)\s+([^\s]+)\s*$/) { - $::execute_actions{$type}{'maps'}{$3} = "$1"; + $::execute_actions{$type}{'maps'}{$3} = "$1" + if ($what =~ m/map/); } elsif ($e =~ m/^AddFormat\s+(.*)\s*$/) { my %r = TeXLive::TLUtils::parse_AddFormat_line("$1"); if (defined($r{"error"})) { tlwarn ("$r{'error'} in parsing $e for return hash\n"); } else { - $::execute_actions{$type}{'formats'}{$r{'name'}} = \%r; + $::execute_actions{$type}{'formats'}{$r{'name'}} = \%r + if ($what =~ m/format/); } } elsif ($e =~ m/^AddHyphen\s+(.*)\s*$/) { my %r = TeXLive::TLUtils::parse_AddHyphen_line("$1"); if (defined($r{"error"})) { tlwarn ("$r{'error'} in parsing $e for return hash\n"); } else { - $::execute_actions{$type}{'hyphens'}{$r{'name'}} = \%r; + $::execute_actions{$type}{'hyphens'}{$r{'name'}} = \%r + if ($what =~ m/hyphen/); } } else { tlwarn("Unknown execute $e in ", $tlp->name, "\n"); @@ -3429,8 +3442,15 @@ sub give_ctan_mirror =item C -Returns the lists of viable mirrors according to mirrors.pl, in -a list which also contains continents, and country headers. +=item C + +C returns the lists of viable mirrors according to +mirrors.pl, in a list which also contains continents, and country headers. + +C extracts the actual repository data from one +of these entries. + +# KEEP THESE TWO FUNCTIONS IN SYNC!!! =cut @@ -3462,6 +3482,14 @@ sub create_mirror_list { return @ret; } +# extract_mirror_entry is not very intelligent, it assumes that +# the last "word" is the URL +sub extract_mirror_entry { + my $ent = shift; + my @foo = split ' ', $ent; + return $foo[$#foo]; +} + sub tlmd5 { my ($file) = @_; if (-r $file) { -- cgit v1.2.3