diff options
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLMedia.pm | 13 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPOBJ.pm | 41 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPaper.pm | 36 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 50 |
4 files changed, 70 insertions, 70 deletions
diff --git a/Master/tlpkg/TeXLive/TLMedia.pm b/Master/tlpkg/TeXLive/TLMedia.pm index f60462bc82e..773f0550e08 100644 --- a/Master/tlpkg/TeXLive/TLMedia.pm +++ b/Master/tlpkg/TeXLive/TLMedia.pm @@ -224,8 +224,7 @@ sub install_package { $totlpdb->add_tlpobj($tlpobj); $totlpdb->save; # compute the return value - my %ret; - merge_into(\%ret, $tlpobj->make_return_hash_from_executes("enable")); + TeXLive::TLUtils::announce_execute_actions("enable", $tlpobj); if (!$nopostinstall) { # do the postinstallation actions # @@ -235,8 +234,8 @@ sub install_package { $totlpdb->option_desktop_integration, $totlpdb->option_post_code); } - return \%ret; } + return 1; } # @@ -359,13 +358,12 @@ sub remove_package { my ($self, $pkg, $nopostinstall) = @_; my $localtlpdb = $self->tlpdb; my $tlp = $localtlpdb->get_package($pkg); - my %ret; if (!defined($tlp)) { tlwarn ("$pkg: package not present, cannot remove\n"); } else { if ($pkg =~ m/^texlive\.infra/) { log ("Not removing $pkg, it is essential!\n"); - return; + return 0; } # we have to chdir to $localtlpdb->root my $Master = $localtlpdb->root; @@ -439,8 +437,7 @@ sub remove_package { rmdir $d; } $localtlpdb->remove_package($pkg); - merge_into(\%ret, $tlp->make_return_hash_from_executes("disable")); - $ret{'mktexlsr'} = 1; + TeXLive::TLUtils::announce_execute_actions("disable", $tlp); # should we save at each removal??? # advantage: the tlpdb actually reflects what is installed # disadvantage: removing a collection calls the save routine several times @@ -457,7 +454,7 @@ sub remove_package { 0); } } - return \%ret; + return 1; } diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index f86195252ee..10db4ff062a 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -893,47 +893,6 @@ sub allbinfiles { return @ret; } -sub make_return_hash_from_executes { - my $self = shift; - my $type = shift; - if (!defined($type) || (($type ne "enable") && ($type ne "disable"))) { - die "make_return_hash_from_executes: enable or disable, not type $type"; - } - my %ret; - my (@maps, @formats, @dats); - if ($self->runfiles) { - $ret{'mktexlsr'} = 1; - } - if ($self->srcfiles) { - $ret{'mktexlsr'} = 1; - } - if ($self->docfiles) { - $ret{'mktexlsr'} = 1; - } - foreach my $e ($self->executes) { - if ($e =~ m/^add((Mixed)?Map)\s+([^\s]+)\s*$/) { - if ($type eq "enable") { - push @maps, "enable $1=$3"; - } else { - push @maps, "disable $3"; - } - } elsif ($e =~ m/^AddFormat\s+(.*)\s*$/) { - push @formats, $1; - } elsif ($e =~ m/^AddHyphen\s+(.*)\s*$/) { - push @dats, $1; - } else { - tlwarn("Unknown execute $e in ", $self->name, "\n"); - } - } - $ret{'map'} = [ @maps ] if (@maps); - $ret{'format'} = [ @formats ] if (@formats); - $ret{'language'} = [ @dats ] if (@dats); - return(\%ret); -} - - - - # # execute stuff # diff --git a/Master/tlpkg/TeXLive/TLPaper.pm b/Master/tlpkg/TeXLive/TLPaper.pm index 301d6abb65a..66e39adeb07 100644 --- a/Master/tlpkg/TeXLive/TLPaper.pm +++ b/Master/tlpkg/TeXLive/TLPaper.pm @@ -139,8 +139,7 @@ sub get_paper_list { =item C<do_paper($prog,$texmfsysconfig,@args)> -Call the paper subroutine for C<$prog>, passing args. Return hash of -necessary post-install programs for C<handle_ret_hash> to run. +Call the paper subroutine for C<$prog>, passing args. =cut @@ -166,11 +165,9 @@ hashes. =cut sub paper_all { - my %ret; for my $p (sort keys %paper_sub) { - merge_into(\%ret, &{$paper_sub{$p}} (@_)); + &{$paper_sub{$p}} (@_); } - return \%ret; } @@ -212,7 +209,7 @@ sub paper_xdvi { my $newpaper = shift; my $inp = &find_paper_file("xdvi", "other text files", "XDvi"); - return () unless $inp; + return unless $inp; my $outcomp = $paper_config_path_component{"xdvi"} || $default_paper_config_path_component{"xdvi"}; @@ -242,14 +239,13 @@ sub paper_xdvi { sub paper_pdftex { my $outtree = shift; my $newpaper = shift; - my %ret; my $outcomp = $paper_config_path_component{"pdftex"} || $default_paper_config_path_component{"pdftex"}; my $outfile = "$outtree/$outcomp"; my $inp = &find_paper_file("pdftex", "tex", "pdftexconfig.tex"); - return () unless $inp; + return unless $inp; open(FOO, "<$inp") || die "$0: open($inp) failed: $!"; my @lines = <FOO>; @@ -338,15 +334,16 @@ sub paper_pdftex { info("$0: setting paper size for pdftex to $newpaper.\n"); mkdirhier(dirname($outfile)); # if we create the outfile we have to call mktexlsr - $ret{"mktexlsr"} = 1 unless (-r $outfile); + TeXLive::TLUtils::announce_execute_actions("files-changed") + unless (-r $outfile); if (!open(TMP, ">$outfile")) { tlwarn("$0: Cannot write to $outfile: $!\n"); tlwarn("Not setting paper size for pdftex.\n"); - return (); + return; } for (@lines) { print TMP; } close(TMP) || warn "$0: close(>$outfile) failed: $!"; - $ret{"format-regenerate"} = 1; + TeXLive::TLUtils::announce_execute_actions("regenerate-formats"); } else { tlwarn("$0: Not a valid paper size for pdftex: $newpaper\n"); } @@ -354,7 +351,6 @@ sub paper_pdftex { } else { info("Current pdftex paper size (from $inp): $currentpaper\n"); } - return \%ret; } @@ -388,10 +384,9 @@ sub paper_pdftex { sub paper_dvips { my $outtree = shift; my $newpaper = shift; - my %ret; my $inp = &find_paper_file("dvips", "dvips config", "config.ps"); - return () unless $inp; + return unless $inp; my $outcomp = $paper_config_path_component{"dvips"} || $default_paper_config_path_component{"dvips"}; @@ -461,7 +456,8 @@ sub paper_dvips { info("$0: setting paper size for dvips to $newpaper.\n"); mkdirhier(dirname($outfile)); # if we create the outfile we have to call mktexlsr - $ret{"mktexlsr"} = 1 unless (-r $outfile); + TeXLive::TLUtils::announce_execute_actions("files-changed") + unless (-r $outfile); if (!open(TMP, ">$outfile")) { tlwarn("$0: Cannot write to $outfile: $!\n"); tlwarn("Not setting paper size for dvips.\n"); @@ -476,7 +472,6 @@ sub paper_dvips { } else { info("Current dvips paper size (from $inp): $papersizes[0]\n"); } - return \%ret; } @@ -587,8 +582,6 @@ sub paper_context { sub paper_do_simple { my ($inp, $prog, $firstre, $secondre, $bl, $outp, $paplist, $defaultpaper, $defaultline, $newpaper) = @_; - my %ret; - debug("file used for $prog: $inp\n"); open(FOO, "<$inp") or die("cannot open file $inp: $!"); @@ -648,7 +641,8 @@ sub paper_do_simple { info("$0: setting paper size for $prog to $newpaper.\n"); mkdirhier(dirname($outp)); # if we create the outfile we have to call mktexlsr - $ret{"mktexlsr"} = 1 unless (-r $outp); + TeXLive::TLUtils::announce_execute_actions("files-changed") + unless (-r $outp); if (!open(TMP, ">$outp")) { tlwarn("$0: Cannot write to $outp: $!\n"); tlwarn("Not setting paper size for $prog.\n"); @@ -656,7 +650,8 @@ sub paper_do_simple { } for (@newlines) { print TMP; } close(TMP) || warn "$0: close(>$outfile) failed: $!"; - $ret{"format-regenerate"} = 1 if $prog eq "context"; + TeXLive::TLUtils::announce_execute_actions("regenerate-formats") + if ($prog eq "context"); } else { tlwarn("$0: Not a valid paper size for $prog: $newpaper\n"); } @@ -665,7 +660,6 @@ sub paper_do_simple { # return the current value info("Current $prog paper size (from $inp): $currentpaper\n"); } - return \%ret; } 1; diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 78f622506dd..e58eefc7d37 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -60,6 +60,7 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure TeXLive::TLUtils::install_packages($from_tlpdb,$media,$to_tlpdb,$what,$opt_src, $opt_doc)>); TeXLive::TLUtils::install_package($what, $filelistref, $target, $platform); TeXLive::TLUtils::do_postaction($how, $tlpobj); + TeXLive::TLUtils::announce_execute_actions($how, @executes); =head2 Miscellaneous @@ -121,6 +122,7 @@ BEGIN { &tlmd5 &xsystem &run_cmd + &announce_execute_actions ); @EXPORT = qw(setup_programs download_file process_logging_options tlwarn info log debug ddebug dddebug debug_hash @@ -1621,6 +1623,54 @@ sub parse_into_keywords { return($error, %ret); } +=item C<announce_execute_actions($how, $tlpobj)> + +Announces that the actions given in C<$tlpobj> should be executed +after all packages have been unpacked. + +=cut + +sub announce_execute_actions { + my ($type, $tlp) = @_; + if (defined($type) && ($type eq "regenerate-formats")) { + $::regenerate_all_formats = 1; + return; + } + if (defined($type) && ($type eq "files-changed")) { + $::files_changed = 1; + return; + } + if (!defined($type) || (($type ne "enable") && ($type ne "disable"))) { + die "announce_execute_actions: enable or disable, not type $type"; + } + my (@maps, @formats, @dats); + if ($tlp->runfiles || $tlp->srcfiles || $tlp->docfiles) { + $::files_changed = 1; + } + foreach my $e ($tlp->executes) { + if ($e =~ m/^add((Mixed)?Map)\s+([^\s]+)\s*$/) { + $::execute_actions{$type}{'maps'}{$3} = "$1"; + } 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; + } + } 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; + } + } else { + tlwarn("Unknown execute $e in ", $self->name, "\n"); + } + } +} + + =item C<untar($tarfile,$targetdir, $remove_tarfile)> Unpacked C<$tarfile> in C<$targetdir> (changing directories to |