diff options
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/glossaries/makeglossaries | 462 | ||||
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/luaotfload/mkluatexfontdb.lua | 19 | ||||
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/oberdiek/pdfatfi.pl | 70 | ||||
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/pax/pdfannotextractor.pl | 8 | ||||
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/pkfix/pkfix.pl | 13 | ||||
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/ppower4/pdfthumb.tlu | 2 | ||||
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/ppower4/ppower4.tlu | 2 | ||||
-rwxr-xr-x | Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl | 477 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/tex4ht/mk4ht.pl | 16 | ||||
-rwxr-xr-x | Master/texmf/scripts/tetex/updmap-sys.sh | 30 | ||||
-rwxr-xr-x[-rw-r--r--] | Master/texmf/scripts/tetex/updmap.pl | 888 |
11 files changed, 1141 insertions, 846 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/glossaries/makeglossaries b/Build/source/texk/texlive/linked_scripts/glossaries/makeglossaries index fcb3dfef031..df289eb8a39 100755 --- a/Build/source/texk/texlive/linked_scripts/glossaries/makeglossaries +++ b/Build/source/texk/texlive/linked_scripts/glossaries/makeglossaries @@ -2,7 +2,7 @@ # File : makeglossaries # Author : Nicola Talbot -# Version : 1.9 (2010/06/14) +# Version : 2.03 (2011/12/02) # Description: simple Perl script that calls makeindex or xindy. # Intended for use with "glossaries.sty" (saves having to remember # all the various switches) @@ -27,9 +27,16 @@ # glossary-super.sty, glossaries.perl. # Also makeglossaries and makeglossaries. -my $version="2.0 (2010-06-30)"; +my $version="2.03 (2011-12-02)"; # History: +# v2.03 (2011-04-12): +# * added warning about possibly needing 'nomain' package option +# v2.02 (2011-04-2): +# * Prints version number at start of run unless -q +# * Added more diagnostics. +# v2.01 (2010-09-29): +# * Added 'use warnings' # v2.0 (2010-06-30) : # * Made file handle local in &scan_aux # v1.9 (2010-06-14) : @@ -65,6 +72,8 @@ my $version="2.0 (2010-06-30)"; use Getopt::Std; use strict; +# v2.01 added the following line +use warnings; use vars qw($opt_q $opt_t $opt_o $opt_s $opt_p $opt_g $opt_c $opt_r $opt_l $opt_i $opt_L $opt_n $opt_C); @@ -79,9 +88,17 @@ getopts('s:o:t:p:L:C:ilqrcgn'); unless ($#ARGV == 0) { - die "makeglossaries: Need exactly one file argument.\nUse `makeglossaries --help' for help.\n"; + die "makeglossaries: Need exactly one file argument.\n", + "Use `makeglossaries --help' for help.\n"; } +# v2.02: added: +print "makeglossaries version $version\n" unless ($opt_q); + +# v2.02: added: +my $xdynotist = 1; +my $needcompatibilitymode=2; + # define known extensions # v1.6: removed adding main glossary here as there's no guarantee @@ -116,6 +133,13 @@ if (length($ARGV[0]) > 3 and substr($ARGV[0],-4,1) eq ".") } } +# v2.01 add check to see if aux file exists + +unless (-e "$name.aux") +{ + die "Auxiliary file '$name.aux' doesn't exist. Have you run LaTeX?\n"; +} + my $istfile = ""; # should letter ordering be used? (v1.5 added) @@ -140,7 +164,8 @@ unless ($istfile) my $xdyopts = ''; -unless ($opt_L eq "") +# v2.01 replaced 'unless ($opt_L eq "")' with 'if ($opt_L)' +if ($opt_L) { $xdyopts .= " -L $opt_L"; } @@ -162,8 +187,10 @@ if ($letterordering) if ($opt_q) { - $mkidxopts .= " -q"; - $xdyopts .= " -q"; +# v2.01 removed following lines. (This script now deals with +# printing messages to STDOUT.) + #$mkidxopts .= " -q"; + #$xdyopts .= " -q"; } if ($opt_r) @@ -181,21 +208,52 @@ if ($opt_g) $mkidxopts .= " -g"; } -unless ($opt_p eq "") +# v2.01 replaced 'unless ($opt_p eq "")' with 'if ($opt_p)' +if ($opt_p) { $mkidxopts .= " -p $opt_p"; } -unless ($opt_s eq "") +# v2.01 replaced 'unless ($opt_s eq "")' with 'if ($opt_s)' +if ($opt_s) { + # v2.01 check if user has specified -s <file>.ist but aux file + # indicates .xdy ought to be used and vice-versa. Also check if + # requested style file exists + + unless (-e $opt_s) + { + die "\n", + "Requested style file '$opt_s' doesn't exist.\n\n"; + } + + if ($istfile=~/\.xdy$/ and $opt_s!~/\.xdy$/) + { + die "\n", + "The auxiliary file indicates that you should be using xindy,\n", + "but you have specified makeindex style file '$opt_s'\n", + "Make sure you don't specify 'xindy' as a package option if\n", + "you want to use makeindex.\n\n", + "\\usepackage[makeindex]{glossaries}\n\n"; + } + elsif ($istfile!~/\.xdy$/ and $opt_s=~/\.xdy$/) + { + die "\n", + "The auxiliary file indicates that you should be using\n", + "makeindex, but you have specified xindy style file '$opt_s'.\n", + "Make sure you specify 'xindy' as a package option if you\n", + "want to use xindy.\n\n", + "\\usepackage[xindy]{glossaries}\n\n"; + } + $istfile = $opt_s; } # Use xindy if style file ends with .xdy otherwise use makeindex -my $usexindy = $istfile=~m/\.xdy\Z/; +my $usexindy = ($istfile=~m/\.xdy\Z/); -if ($ext ne '') +if ($ext) { # an extension has been specified, so only process # the specified file @@ -223,7 +281,8 @@ if ($ext ne '') # v1.6 If %thistype hasn't been defined, then the given # extension doesn't correspond to any known glossary type - unless (defined %thistype) + # v2.01 replaced deprecated 'defined(%thistype)' with %thistype + unless (%thistype) { die "The file extension '$ext' doesn't correspond to any\n", "known glossary extension. Try running makeglossaries\n", @@ -232,7 +291,8 @@ if ($ext ne '') my $outfile; - if ($opt_o eq "") +# v2.01 replaced 'if ($opt_o eq "")' with 'unless ($opt_o)' + unless ($opt_o) { $outfile = "$name.$thistype{out}"; } @@ -243,7 +303,8 @@ if ($ext ne '') my $transcript; - if ($opt_t eq "") +# v2.01 replaced 'if ($opt_t eq "")' with 'unless ($opt_t)' + unless ($opt_t) { $transcript = "$name.$thistype{'log'}"; } @@ -252,6 +313,13 @@ if ($ext ne '') $transcript = $opt_t; } +# v2.01 remove old transcript file + + unless ($opt_n) + { + unlink($transcript); + } + if ($usexindy) { &xindy("$name.$ext", $outfile, $transcript,$istfile, @@ -275,7 +343,8 @@ else my $outfile; - if ($opt_o eq "") +# v2.01 changed 'if ($opt_o eq "")' with 'unless ($opt_o)' + unless ($opt_o) { $outfile = "$name.$thistype{out}"; } @@ -301,12 +370,42 @@ else next; } + my $transcript; + +# v2.01 changed 'if ($opt_t eq "")' with 'unless ($opt)' + unless ($opt_t) + { + $transcript = "$name.$thistype{'log'}"; + } + else + { + $transcript = $opt_t; + } + # v1.6 added file empty test if (-z $inputfile) { - print "Warning: File '$inputfile' is empty.\n", + my $message = + "Warning: File '$inputfile' is empty.\n". "Have you used any entries defined in glossary '$type'?\n"; + if ($type eq 'main') + { + $message .= + "Remember to use package option 'nomain' if you\n". + "don't want to use the main glossary.\n"; + } + + warn $message; + + # Write warning to transcript file. + + if (open TRANSFD, ">$transcript") + { + print TRANSFD $message; + close TRANSFD; + } + # create an empty output file and move on to the next glossary if (open OFD, ">$outfile") @@ -322,15 +421,11 @@ else next; } - my $transcript; +# v2.01 remove old transcript file - if ($opt_t eq "") - { - $transcript = "$name.$thistype{'log'}"; - } - else + unless ($opt_n) { - $transcript = $opt_t; + unlink($transcript); } if ($usexindy) @@ -414,7 +509,7 @@ sub scan_aux{ else { print STDERR - "Unknown ordering '$letterordering'\n", + "Unknown ordering '$ordering'\n", "Assuming word ordering\n"; $letterordering = 0; } @@ -430,62 +525,138 @@ sub scan_aux{ } } -sub makeindex{ - my($in,$out,$trans,$ist,$rest,$quiet,$dontexec) = @_; - my($name,$cmdstr,$buffer,$n,$i,$j); - my(@stuff,@item); +# v2.01 new subroutine run_app added +sub run_app{ + my($appname, $appargs, $trans, $quiet, $dontexec) = @_; - $cmdstr = "$rest -s \"$ist\" -t \"$trans\" -o \"$out\" \"$in\""; + local(*STATUS); - unless ($quiet) - { - print "makeindex $cmdstr\n"; - } + my $status = ''; + my $warnings = ''; + my $errno = 0; + my $log = ''; - unless ($dontexec) - { - open STATUS, "makeindex $cmdstr 2>&1 |" - or die "Can't fork: $!\n"; + print "$appname $appargs\n" if ($dontexec or not $quiet); - my $status = ''; + return if ($dontexec); + if (open (STATUS, "$appname $appargs 2>&1 |")) + { while (<STATUS>) { - $status .= $_; + print unless ($quiet); + + $warnings .= $_ if (/WARNING:/); + + $status .= $_ unless (/^[\w]+ing/ or /^Finished/ or /^Usage:/); + + $log .= $_; } close STATUS; + } + else + { + $warnings = "WARNING: Unable to fork $appname: $!\n"; + + print STDERR $warnings, "Retrying without redirection.\n"; - if ($?) + $status = `$appname $appargs`; + + $log = $status; + + print $status unless ($quiet); + } + + if ($?) + { + $errno = $?; + + if (open LOGFILE, ">>$trans") + { + print LOGFILE "\n\n*** Unable to execute: '$appname $appargs' ***\n\n"; + print LOGFILE "Status report:\n\n"; + print LOGFILE "$log"; + close LOGFILE; + } + else { - my $errno = $?; + print STDERR "Unable to open '$trans' $!\n"; + } + } - if (open LOGFILE, ">>$trans") - { - print LOGFILE "\n$status"; - close LOGFILE; - } - else + if ($log=~/\(0 entries accepted,/) + { + # Attempt to diagnose what's gone wrong + + if (open TRANS, $trans) + { + while (<TRANS>) { - print STDERR "Unable to open '$trans' $!\n"; + if (/Unknown specifier ;/) + { + $errno = $xdynotist; + + last; + } } - die "Call to makeindex failed (errno=$errno):\n", $status; + close TRANS; + } + + } + + return ($status, $warnings, $errno); +} + +sub makeindex{ + my($in,$out,$trans,$ist,$rest,$quiet,$dontexec) = @_; + + my $args = "$rest -s \"$ist\" -t \"$trans\" -o \"$out\" \"$in\""; + +# v2.01 replaced code with call to &run_app + + my ($status, $warnings, $errno) + = &run_app('makeindex', $args, $trans, $quiet, $dontexec); + + return if ($dontexec); + + if ($errno) + { + my $diagnostic = ''; + + if ($errno = $xdynotist) + { + $diagnostic = + "Style name indicates makeindex, but may be in xindy format.\n" + . "Remember to use \\setStyleFile to specify the name\n" + . "of the style file rather than redefining \\istfilename\n" + . "explicitly."; } - print $status; + die "\n***Call to makeindex failed***\n", + ($diagnostic ? + "\nPossible cause of problem:\n\n". $diagnostic . "\n\n": + "\n" + ), + "Check '$trans' for details\n"; } } sub xindy{ my($in,$out,$trans,$ist,$language,$codepage,$rest,$quiet, $dontexec) = @_; - my($cmdstr, $langparam, $main); + my($args, $langparam, $main, $retry); my($module); $module = $ist; $module=~s/\.xdy\Z//; + unless (defined($language)) + { + $language = ''; + } + # map babel names to xindy names if ($language eq "frenchb") { @@ -543,7 +714,8 @@ sub xindy{ # and supply a default. (For all other cases, it's up to the # user to supply a codepage.) - if ($codepage eq '') +# v2.01 changed 'if ($codepage eq "")' to 'unless ($codepage)' + unless ($codepage) { if ($language eq 'dutch') { @@ -601,121 +773,138 @@ sub xindy{ "-o \"$out\"", "\"$in\""); - $cmdstr = join(' ', $rest, $langparam, $codepageparam, $main); + $args = join(' ', $rest, $langparam, $codepageparam, $main); - unless ($quiet) - { - print "xindy $cmdstr\n"; - } +# v2.01 replaced code with call to &run_app - unless ($dontexec) - { - open STATUS, "xindy $cmdstr 2>&1 |" or die "Can't fork: $!\n"; + my ($status, $warnings, $errno) + = &run_app('xindy', $args, $trans, $quiet, $dontexec); - my $status = ''; - my $warnings = ""; - my $retry =""; + return if ($dontexec); - while (<STATUS>) + if ($status=~/Cannot locate xindy module for language ([^\s]+) in codepage ([^\s]+)/) + { + $args = join(' ', $rest, $langparam, $main); + + unless ($quiet) { - $status .= $_; + my $message = "$&\nRetrying using default codepage.\n"; - $warnings .= $_ if /WARNING:/; + print STDERR $message; + + $retry .= $message; } - close STATUS; + ($status, $warnings, $errno) + = &run_app('xindy', $args, $trans, $quiet, $dontexec); - if ($status=~/Cannot locate xindy module for language ([^\s]+) in codepage ([^\s]+)/) - { - $cmdstr = join(' ', $rest, $langparam, $main); + } - unless ($quiet) - { - my $message = "$&\nRetrying using default codepage.\n"; + if ($status=~/Cannot locate xindy module for language ([^\s]+)/ + and $1 ne 'general') + { + $args = join(' ', $rest, "-L general", $main); - print STDERR $message; + unless ($quiet) + { + my $message = "$&\nRetrying with -L general\n"; - $retry .= $message; + print STDERR $message; + $retry .= $message; + } - print "xindy $cmdstr\n"; - } + ($status, $warnings, $errno) + = &run_app('xindy', $args, $trans, $quiet, $dontexec); - open STATUS, "xindy $cmdstr 2>&1 |" - or die "Can't fork: $!\n"; + } - $status = ''; + if ($errno) + { + # attempt further diagnostic - while (<STATUS>) - { - $status .= $_; - } + my $diagnostic = ''; - close STATUS; + if ($status=~/index 0 should be less than the length of the string/m) + { + $diagnostic = + "Sort key required for entries only containing command names"; } - - if ($status=~/Cannot locate xindy module for language ([^\s]+)/ - and $1 ne 'general') + elsif ($status=~/variable % has no value/m) { - $cmdstr = join(' ', $rest, "-L general", $main); - - unless ($quiet) - { - my $message = "$&\nRetrying with -L general\n"; - - print STDERR $message; - $retry .= $message; + $diagnostic = + "Style name has xdy extension, but may be in makeindex format.\n" + . "Remember to use \\setStyleFile to specify the name\n" + . "of the style file rather than redefining \\istfilename\n" + . "explicitly."; + } + elsif ($status=~/Possible read-error due to ill-formed string " :sep/m) + { + $diagnostic = + "You may have missed a \" character in a command such as \\GlsAddXdyLocation"; + } + elsif (not $language) + { + # If the language hasn't been set, then it may be + # because the document doesn't contain + # \printglossaries/\printglossary or it may be + # because the user has a customized style file that + # contains the language settings. + + $diagnostic = + "No language detected.". + "\nHave you remembered to use \\printglossary\n". + "or \\printglossaries in your document?"; + + if ($in eq 'glo') + { + # or it may be that the user doesn't want to use the main + # glossary and has forgotten to suppress it with the + # "nomain" package option + + $diagnostic .= + "\nRemember to use package option 'nomain' if you don't\n". + "want to use the main glossary."; + } + } - print "xindy $cmdstr\n"; - } + die "\n***Call to xindy failed***\n", + ($diagnostic ? + "\nPossible cause of problem:\n\n". $diagnostic . "\n\n": + "\n"), + "Check '$trans' for details\n"; + } - open STATUS, "xindy $cmdstr 2>&1 |" - or die "Can't fork: $!\n"; + # Check xindy warnings - $status = ''; + if ($status=~/^WARNING:/m) + { + my $diagwarn = ''; - while (<STATUS>) - { - $status .= $_; - } + if ($status=~/did not match any location-class/m) + { + $diagwarn = "You may have forgotten to add a location \n" + . "class with \\GlsAddLocation or you may have \n" + . "the format incorrect.\n"; - close STATUS; } - if ($?) + if ($status=~/unknown attribute `pageglsnumberformat'/m) { - my $errno = $?; + $diagwarn .= "You may need to add 'compatible-2.07' package " + . "option.\n"; + } - if (open LOGFILE, ">>$trans") - { - print LOGFILE "\n$status"; - close LOGFILE; - } - else - { - print STDERR "Unable to open '$trans' $!\n"; - } + if ($diagwarn) + { + warn "\n**Warning:**\n\n", $diagwarn, "\n"; - if ($language) - { - die "Call to xindy failed (errno=$errno):\n", $status; - } - else - { - # If the language hasn't been set, then it may be - # because the document doesn't contain - # \printglossaries/\printglossary or it may be - # because the user has a customized style file that - # contains the language settings. - - die "Call to xindy failed (errno=$errno):\n", $status, - "\n\nNo language detected.", - "\nHave you remembered to use \\printglossary\n", - "or \\printglossaries in your document?\n\n"; - } + $warnings .= "\nmakeglossaries diagnostic messages:\n\n" + . $diagwarn; } + } - print $status; - + if ($retry or $warnings) + { if (open LOGFILE, ">>$trans") { print LOGFILE "\n$warnings"; @@ -731,7 +920,6 @@ sub xindy{ { print STDERR "Unable to open '$trans' $!\n"; } - } } @@ -747,6 +935,8 @@ sub HELP_MESSAGE{ print "-q\t\tQuiet mode\n"; print "-s <sty>\tEmploy <sty> as the style file\n"; print "-t <log>\tEmploy <log> as the transcript file\n"; + print "-n\tPrint the command that would normally be executed,\n", + "\tbut don't execute it\n"; print "\n Xindy Options:\n"; print "-L <language>\tUse <language>.\n"; diff --git a/Build/source/texk/texlive/linked_scripts/luaotfload/mkluatexfontdb.lua b/Build/source/texk/texlive/linked_scripts/luaotfload/mkluatexfontdb.lua index dc46ac09c22..553332d4c7a 100755 --- a/Build/source/texk/texlive/linked_scripts/luaotfload/mkluatexfontdb.lua +++ b/Build/source/texk/texlive/linked_scripts/luaotfload/mkluatexfontdb.lua @@ -33,25 +33,6 @@ Valid options: -V --version print version and exit -h --help print this message -Fonts are searched in directories on Windows or Linux that have been -searched with fontconfig. - -On Mac OS X, only fonts located in the following standard font locations are -included in the font database: - ~/Library/Fonts /Library/Fonts - /System/Library/Fonts /Network/Library/Fonts -In particular, fonts installed in other locations with "Font Book" will not -be available. - -Rather than using the fontconfig locations or, in Mac OS X, searching the -default system font locations, you may specify where fonts are located by -setting the OSFONTDIR environment variable. Doing so will override the use of -fontconfig or scanning the system font locations. If you wish to continue to -include them while also including other font locations, simply include them in -the list. For example (using a bash shell), - - export OSFONTDIR='/path/to/other/fonts:/Users/will/Library/Fonts:...' - The output database file is named otfl-fonts.lua and is placed under: %s" diff --git a/Build/source/texk/texlive/linked_scripts/oberdiek/pdfatfi.pl b/Build/source/texk/texlive/linked_scripts/oberdiek/pdfatfi.pl index e33859ce598..cd93fa66ddb 100755 --- a/Build/source/texk/texlive/linked_scripts/oberdiek/pdfatfi.pl +++ b/Build/source/texk/texlive/linked_scripts/oberdiek/pdfatfi.pl @@ -1,39 +1,42 @@ -eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' - if 0; +#!/usr/bin/env perl use strict; $^W=1; # turn warning on # # pdfatfi.pl # -# Copyright (C) 2005, 2006 Heiko Oberdiek. +# Copyright (C) 2005-2010 Heiko Oberdiek. # # This work may be distributed and/or modified under the -# conditions of the LaTeX Project Public License, either version 1.3 -# of this license or (at your option) any later version. -# The latest version of this license is in -# http://www.latex-project.org/lppl.txt -# and version 1.3 or later is part of all distributions of LaTeX -# version 2005/12/01 or later. +# conditions of the LaTeX Project Public License, either +# version 1.3c of this license or (at your option) any later +# version. This version of this license is in +# http://www.latex-project.org/lppl/lppl-1-3c.txt +# and the latest version of this license is in +# http://www.latex-project.org/lppl.txt +# and version 1.3 or later is part of all distributions of +# LaTeX version 2005/12/01 or later. # # This work has the LPPL maintenance status "maintained". # # This Current Maintainer of this work is Heiko Oberdiek. # -# See file "attachfile2.pdf" for a list of files that belong to this project. +# See file "attachfile2.pdf" for a list of files that belong to +# this project. # # This file "pdfatfi.pl" may be renamed to "pdfatfi" # for installation purposes. # my $file = "pdfatfi.pl"; my $program = uc($&) if $file =~ /^\w+/; -my $version = "2.5"; -my $date = "2009/09/25"; +my $version = "2.6"; +my $date = "2010/09/27"; my $author = "Heiko Oberdiek"; -my $copyright = "Copyright (c) 2005, 2006 by $author."; +my $copyright = "Copyright (c) 2005-2010 by $author."; # # History: # 2005/05/21 v1.0: First release. # 2006/08/16 v2.2: Included in DTX file of attachfile2.dtx. +# 2010/09/27 v2.6: Keys ModDateTZ and CreationDateTZ added. # use POSIX qw(strftime); # %z is used (GNU) @@ -58,11 +61,11 @@ $::opt_verbose = 0; my $usage = <<"END_OF_USAGE"; ${title}Syntax: \L$program\E [options] <file[.atfi]> Function: Help program for LaTeX package "attachfile2". -Options: (defaults:) +Options: (defaults:) --help print usage - --(no)quiet suppress messages ($bool[$::opt_quiet]) - --(no)verbose verbose printing ($bool[$::opt_verbose]) - --(no)debug debug informations ($bool[$::opt_debug]) + --(no)quiet suppress messages ($bool[$::opt_quiet]) + --(no)verbose verbose printing ($bool[$::opt_verbose]) + --(no)debug debug informations ($bool[$::opt_debug]) END_OF_USAGE ### process options @@ -101,7 +104,15 @@ END_DEB my $tmpfile = $atfifile . ".tmp"; my $timezone = strftime "%z", localtime; -$timezone =~ s/^([+\-]\d\d)(\d\d)$/$1'$2'/; + +sub gettz ($) { + my $time = shift; + my $tz = strftime "%z", localtime($time); + return '' unless $tz; + return 'Z' if $tz eq '+0000'; + $tz =~ s/^([+\-]\d\d)(\d\d)$/$1'$2'/; + return $tz; +} open(IN, $atfifile) or die "$Error Cannot open `$atfifile'!\n"; open(OUT, ">$tmpfile") or die "$Error Cannot write `$tmpfile'!\n"; @@ -125,20 +136,26 @@ while(<IN>) { my $mtime = @s[9]; my $ctime = @s[10]; # inode change time - my ($sec, $min, $hour, $mday, $mon, $year) = localtime($mtime); + my ($sec, $min, $hour, $mday, $mon, $year) = + localtime($mtime); my $moddate = sprintf("%04d%02d%02d%02d%02d%02d", $year + 1900, $mon + 1, $mday, $hour, $min, $sec); + my $moddatetz = 'D:' . $moddate . gettz($mtime); # Manual page "perlport" says that "ctime" is creation # time instead of inode change time for "Win32" and # "Mac OS", but it is unsupported for "Mac OS X". my $creationdate = ""; + my $creationdatetz = ""; if ($^O eq 'MSWin32') { # cygwin? - ($sec, $min, $hour, $mday, $mon, $year) = localtime($ctime); + ($sec, $min, $hour, $mday, $mon, $year) = + localtime($ctime); $creationdate = sprintf("%04d%02d%02d%02d%02d%02d", $year + 1900, $mon + 1, $mday, $hour, $min, $sec); + $creationdatetz = + 'D:' . $creationdate . gettz($ctime); } # md5 checksum @@ -155,15 +172,20 @@ while(<IN>) { } $_ = "\\attachfile\@file[" - . "ModDate=$moddate,Size=$size" - . (($checksum) ? ",CheckSum=$checksum" : "") - . (($creationdate) ? ",CreationDate=$creationdate" : "") + . "ModDateTZ=$moddatetz" + . ",Size=$size" + . ($checksum ? ",CheckSum=$checksum" : "") + . ($creationdatetz ? + ",CreationDateTZ=$creationdatetz" : + ($creationdate ? + ",CreationDate=$creationdate" : "")) . "]{$hexfile}\n"; if ($::opt_verbose) { print "* file entry = $file\n"; print " size = $size\n"; print " moddate = $moddate\n"; - print " creationdate = $creationdate\n" if $creationdate; + print " creationdate = $creationdate\n" + if $creationdate; print " checksum = $checksum\n" if $checksum; } } diff --git a/Build/source/texk/texlive/linked_scripts/pax/pdfannotextractor.pl b/Build/source/texk/texlive/linked_scripts/pax/pdfannotextractor.pl index 716da9b7bba..d111a305150 100755 --- a/Build/source/texk/texlive/linked_scripts/pax/pdfannotextractor.pl +++ b/Build/source/texk/texlive/linked_scripts/pax/pdfannotextractor.pl @@ -2,7 +2,7 @@ use strict; $^W=1; -# Copyright (C) 2008 Heiko Oberdiek +# Copyright (C) 2008, 2011 Heiko Oberdiek # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,10 +24,10 @@ $^W=1; my $name = 'PDFAnnotExtractor'; my $program = "\L$name\E"; my $file = "$program.pl"; -my $version = "0.1i"; -my $date = "2008/10/01"; +my $version = "0.1j"; +my $date = "2011/04/22"; my $author = "Heiko Oberdiek"; -my $copyright = "Copyright (c) 2008 by $author."; +my $copyright = "Copyright (c) 2008, 2011 by $author."; # History: # 2008/10/01 v0.1i: First version of the wrapper script. diff --git a/Build/source/texk/texlive/linked_scripts/pkfix/pkfix.pl b/Build/source/texk/texlive/linked_scripts/pkfix/pkfix.pl index 52e4d7698e8..9a983f0a272 100755 --- a/Build/source/texk/texlive/linked_scripts/pkfix/pkfix.pl +++ b/Build/source/texk/texlive/linked_scripts/pkfix/pkfix.pl @@ -5,7 +5,7 @@ $^W=1; # turn warning on # # pkfix.pl # -# Copyright (C) 2001, 2005, 2007, 2009 Heiko Oberdiek. +# Copyright (C) 2001, 2005, 2007, 2009, 2011 Heiko Oberdiek. # # This work may be distributed and/or modified under the # conditions of the LaTeX Project Public License, either version 1.3 @@ -25,10 +25,10 @@ $^W=1; # turn warning on my $file = "pkfix.pl"; my $program = uc($&) if $file =~ /^\w+/; my $project = lc($program); -my $version = "1.5"; -my $date = "2009/03/18"; +my $version = "1.6"; +my $date = "2011/04/22"; my $author = "Heiko Oberdiek"; -my $copyright = "Copyright (c) 2001, 2005, 2007, 2009 by $author."; +my $copyright = "Copyright (c) 2001, 2005, 2007, 2009, 2011 by $author."; # # Reqirements: Perl5, dvips # History: @@ -77,6 +77,9 @@ my $copyright = "Copyright (c) 2001, 2005, 2007, 2009 by $author."; # * Deprecation warning of perl 5.8.8 fixed. # 2009/03/18 v1.5: # * Patch to support dvips 5.399 (submitted by Melissa O'Neill). +# 2011/04/22 v1.6: +# * Bug fix: input and output files are read and written in +# binary mode (thanks M.S. Dousti for bug report). # ### program identification my $title = "$program $version, $date - $copyright\n"; @@ -204,7 +207,9 @@ my $encoding_string = ""; ### open input and output files open(IN, $infile) or die "$Error Cannot open `$infile'!\n"; +binmode(IN); open(OUT, ">$outfile") or die "$Error Cannot write `$outfile'!\n"; +binmode(OUT); ################################## # expected format: diff --git a/Build/source/texk/texlive/linked_scripts/ppower4/pdfthumb.tlu b/Build/source/texk/texlive/linked_scripts/ppower4/pdfthumb.tlu index d9567a4dae7..a388953737b 100755 --- a/Build/source/texk/texlive/linked_scripts/ppower4/pdfthumb.tlu +++ b/Build/source/texk/texlive/linked_scripts/ppower4/pdfthumb.tlu @@ -1,6 +1,6 @@ #!/usr/bin/env texlua --*-Lua-*- --- $Id: pdfthumb.tlu 21563 2011-03-01 09:20:55Z peter $ +-- $Id: pdfthumb.tlu 15926 2009-11-01 18:08:08Z reinhardk $ -- Copyright (C) 2008 Reinhard Kotucha. -- You may freely use, modify and/or distribute this file. diff --git a/Build/source/texk/texlive/linked_scripts/ppower4/ppower4.tlu b/Build/source/texk/texlive/linked_scripts/ppower4/ppower4.tlu index 1ec431d6eb0..c914952fcf7 100755 --- a/Build/source/texk/texlive/linked_scripts/ppower4/ppower4.tlu +++ b/Build/source/texk/texlive/linked_scripts/ppower4/ppower4.tlu @@ -1,6 +1,6 @@ #!/usr/bin/env texlua --*-Lua-*- --- $Id: ppower4.tlu 21563 2011-03-01 09:20:55Z peter $ +-- $Id: ppower4.tlu 15926 2009-11-01 18:08:08Z reinhardk $ -- Copyright (C) 2008 Reinhard Kotucha. -- You may freely use, modify and/or distribute this file. diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl index 257c1d98fd2..8d8553aa83a 100755 --- a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl +++ b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl @@ -1,12 +1,12 @@ #!/usr/bin/env perl -# $Id: tlmgr.pl 22010 2011-04-07 12:49:51Z siepo $ +# $Id: tlmgr.pl 22448 2011-05-12 23:59:31Z karl $ # # Copyright 2008, 2009, 2010, 2011 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. -my $svnrev = '$Revision: 22010 $'; -my $datrev = '$Date: 2011-04-07 14:49:51 +0200 (Thu, 07 Apr 2011) $'; +my $svnrev = '$Revision: 22448 $'; +my $datrev = '$Date: 2011-05-13 01:59:31 +0200 (Fri, 13 May 2011) $'; my $tlmgrrevision; if ($svnrev =~ m/: ([0-9]+) /) { $tlmgrrevision = $1; @@ -77,7 +77,6 @@ use Getopt::Long qw(:config no_autoabbrev permute); use strict; use TeXLive::TLConfig; -use TeXLive::TLMedia; use TeXLive::TLPDB; use TeXLive::TLPOBJ; use TeXLive::TLUtils; @@ -92,10 +91,8 @@ binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); our %config; # hash of config settings from config file -our $tlmediasrc; # media from which we install/update -our $tlmediatlpdb; +our $remotetlpdb; our $location; # location from which the new packages come -our $localtlmedia; # local installation which we are munging our $localtlpdb; # local installation which we are munging # flags for machine-readable form @@ -375,9 +372,10 @@ sub main { if (!defined($do_persistent)) { $do_persistent = 1; } - debug("tlmgr:main: persistent download are $do_persistent\n"); - TeXLive::TLUtils::setup_persistent_downloads() - if $do_persistent; + ddebug("tlmgr:main: do persistent downloads = $do_persistent\n"); + if ($do_persistent) { + TeXLive::TLUtils::setup_persistent_downloads() ; + } if (!defined($::tldownload_server)) { debug("tlmgr:main: ::tldownload_server not defined\n"); } else { @@ -412,7 +410,6 @@ sub give_version { $::version_string .= "\nTLUtils: " . TeXLive::TLUtils->module_revision(); $::version_string .= "\nTLPOBJ: " . TeXLive::TLPOBJ->module_revision(); $::version_string .= "\nTLPDB: " . TeXLive::TLPDB->module_revision(); - $::version_string .= "\nTLMedia: " . TeXLive::TLMedia->module_revision(); $::version_string .= "\nTLPaper: " . TeXLive::TLPaper->module_revision(); $::version_string .= "\nTLWinGoo: " . TeXLive::TLWinGoo->module_revision(); $::version_string .= "\n"; @@ -499,6 +496,7 @@ sub execute_action { action_restore(); } elsif ($action =~ m/^path$/i) { action_path(); + finish(0); } elsif ($action =~ m/^search$/i) { action_search(); finish(0); @@ -830,7 +828,7 @@ sub action_remove { my $foo = 0; info ("remove $pkg\n"); if (!$opts{"dry-run"}) { - $foo = $localtlmedia->remove_package($pkg); + $foo = $localtlpdb->remove_package($pkg); logpackage("remove: $pkg"); } if ($foo) { @@ -851,7 +849,7 @@ sub action_remove { if (!defined($already_removed{$pkg})) { info ("remove $pkg\n"); if (!$opts{"dry-run"}) { - if ($localtlmedia->remove_package($pkg)) { + if ($localtlpdb->remove_package($pkg)) { # removal was successful logpackage("remove: $pkg"); $already_removed{$pkg} = 1; @@ -925,6 +923,110 @@ sub action_paper { } +# PATH +# +sub action_path { + my $what = shift @ARGV; + if (!defined($what) || ($what !~ m/^(add|remove)$/i)) { + $what = "" if ! $what; + tlwarn("tlmgr: action path requires add or remove, not: $what\n"); + return; + } + init_local_db(); + my $winadminmode = 0; + if (win32()) { + # + # for w32 we do system wide vs user setting detection as follows: + # - if --w32mode is NOT given, + # - if admin + # --> honor opt_w32_multi_user setting in tlpdb + # - if not admin + # - if opt_w32_multi_user == NO + # --> do user path adjustment + # - if opt_w32_multi_user == YES + # --> do nothing, warn that the setting is on, suggest --w32mode user + # - if --w32mode admin + # - if admin + # --> ignore opt_w32_multi_user and do system path adjustment + # - if non-admin + # --> do nothing but warn that user does not have privileges + # - if --w32mode user + # - if admin + # --> ignore opt_w32_multi_user and do user path adjustment + # - if non-admin + # --> ignore opt_w32_multi_user and do user path adjustment + if (!$opts{"w32mode"}) { + $winadminmode = $localtlpdb->option("w32_multi_user"); + if (!TeXLive::TLWinGoo::admin()) { + if ($winadminmode) { + tlwarn("The TLPDB specifies system wide path adjustments\nbut you don't have admin privileges.\nFor user path adjustment please use\n\t--w32mode user\n"); + # and do nothing + return; + } + } + } else { + # we are in the block where a --w32mode argument is given + # we reverse the tests: + if (TeXLive::TLWinGoo::admin()) { + # in admin mode we simply use what is given on the cmd line + if ($opts{"w32mode"} eq "user") { + $winadminmode = 0; + } elsif ($opts{"w32mode"} eq "admin") { + $winadminmode = 1; + } else { + tlwarn("Unknown --w32admin mode: $opts{w32mode}, should be 'admin' or 'user'\n"); + return; + } + } else { + # we are non-admin + if ($opts{"w32mode"} eq "user") { + $winadminmode = 0; + } elsif ($opts{"w32mode"} eq "admin") { + tlwarn("You don't have the privileges to work in --w32mode admin\n"); + return; + } else { + tlwarn("Unknown --w32admin mode: $opts{w32mode}, should be 'admin' or 'user'\n"); + return; + } + } + } + } + if ($what =~ m/^add$/i) { + if (win32()) { + TeXLive::TLUtils::w32_add_to_path( + $localtlpdb->root . "/bin/win32", + $winadminmode); + TeXLive::TLWinGoo::broadcast_env(); + } else { + TeXLive::TLUtils::add_symlinks($localtlpdb->root, + $localtlpdb->platform(), + $localtlpdb->option("sys_bin"), + $localtlpdb->option("sys_man"), + $localtlpdb->option("sys_info")); + } + } elsif ($what =~ m/^remove$/i) { + if (win32()) { + TeXLive::TLUtils::w32_remove_from_path( + $localtlpdb->root . "/bin/win32", + $winadminmode); + TeXLive::TLWinGoo::broadcast_env(); + } else { + # remove symlinks + TeXLive::TLUtils::remove_symlinks($localtlpdb->root, + $localtlpdb->platform(), + $localtlpdb->option("sys_bin"), + $localtlpdb->option("sys_man"), + $localtlpdb->option("sys_info")); + } + } else { + # that should not happen + tlwarn("\nShould not happen, action_path what=$what"); + exit 1; + } + return; +} + + # SHOW # sub action_show { @@ -942,11 +1044,11 @@ sub action_show { my $tlp = $localtlpdb->get_package($pkg); my $installed = 0; if (!$tlp) { - if (!$tlmediatlpdb) { + if (!$remotetlpdb) { init_tlmedia(); } - $tlp = $tlmediatlpdb->get_package($pkg); - $tlpdb = $tlmediatlpdb; + $tlp = $remotetlpdb->get_package($pkg); + $tlpdb = $remotetlpdb; } else { $installed = 1; } @@ -956,10 +1058,10 @@ sub action_show { @colls = $localtlpdb->needed_by($pkg); if (!@colls) { # not referenced in the local tlpdb, so try the remote here, too - if (!$tlmediatlpdb) { + if (!$remotetlpdb) { init_tlmedia(); } - @colls = $tlmediatlpdb->needed_by($pkg); + @colls = $remotetlpdb->needed_by($pkg); } } # some packages might depend on other packages, so do not @@ -1069,107 +1171,6 @@ sub action_show { return; } -# PATH -# -sub action_path { - my $what = shift @ARGV; - if (!defined($what) || ($what !~ m/^(add|remove)$/i)) { - tlwarn("tlmgr: action path needs one argument, either add or remove\n"); - return; - } - init_local_db(); - my $winadminmode = 0; - if (win32()) { - # - # for w32 we do system wide vs user setting detection as follows: - # - if --w32mode is NOT given, - # - if admin - # --> honor opt_w32_multi_user setting in tlpdb - # - if not admin - # - if opt_w32_multi_user == NO - # --> do user path adjustment - # - if opt_w32_multi_user == YES - # --> do nothing, warn that the setting is on, suggest --w32mode user - # - if --w32mode admin - # - if admin - # --> ignore opt_w32_multi_user and do system path adjustment - # - if non-admin - # --> do nothing but warn that user does not have privileges - # - if --w32mode user - # - if admin - # --> ignore opt_w32_multi_user and do user path adjustment - # - if non-admin - # --> ignore opt_w32_multi_user and do user path adjustment - if (!$opts{"w32mode"}) { - $winadminmode = $localtlmedia->tlpdb->option("w32_multi_user"); - if (!TeXLive::TLWinGoo::admin()) { - if ($winadminmode) { - tlwarn("The TLPDB specifies system wide path adjustments\nbut you don't have admin privileges.\nFor user path adjustment please use\n\t--w32mode user\n"); - # and do nothing - return; - } - } - } else { - # we are in the block where a --w32mode argument is given - # we reverse the tests: - if (TeXLive::TLWinGoo::admin()) { - # in admin mode we simply use what is given on the cmd line - if ($opts{"w32mode"} eq "user") { - $winadminmode = 0; - } elsif ($opts{"w32mode"} eq "admin") { - $winadminmode = 1; - } else { - tlwarn("Unknown --w32admin mode: $opts{w32mode}, should be 'admin' or 'user'\n"); - return; - } - } else { - # we are non-admin - if ($opts{"w32mode"} eq "user") { - $winadminmode = 0; - } elsif ($opts{"w32mode"} eq "admin") { - tlwarn("You don't have the privileges to work in --w32mode admin\n"); - return; - } else { - tlwarn("Unknown --w32admin mode: $opts{w32mode}, should be 'admin' or 'user'\n"); - return; - } - } - } - } - if ($what =~ m/^add$/i) { - if (win32()) { - TeXLive::TLUtils::w32_add_to_path( - $localtlmedia->location . "/bin/win32", - $winadminmode); - TeXLive::TLWinGoo::broadcast_env(); - } else { - TeXLive::TLUtils::add_symlinks($localtlmedia->tlpdb->root, - $localtlmedia->platform(), - $localtlmedia->tlpdb->option("sys_bin"), - $localtlmedia->tlpdb->option("sys_man"), - $localtlmedia->tlpdb->option("sys_info")); - } - } elsif ($what =~ m/^remove$/i) { - if (win32()) { - TeXLive::TLUtils::w32_remove_from_path( - $localtlmedia->location . "/bin/win32", - $winadminmode); - TeXLive::TLWinGoo::broadcast_env(); - } else { - # remove symlinks - TeXLive::TLUtils::remove_symlinks($localtlmedia->tlpdb->root, - $localtlmedia->platform(), - $localtlmedia->tlpdb->option("sys_bin"), - $localtlmedia->tlpdb->option("sys_man"), - $localtlmedia->tlpdb->option("sys_info")); - } - } else { - # that should not happen - tlwarn("\nShould not happen, action_path what=$what"); - exit 1; - } - return; -} # taxonomy subroutines @@ -1251,7 +1252,7 @@ sub action_search { init_local_db(); if ($opts{"global"}) { init_tlmedia(); - $tlpdb = $tlmediasrc->tlpdb; + $tlpdb = $remotetlpdb; } else { $tlpdb = $localtlpdb; } @@ -1409,8 +1410,8 @@ sub restore_one_package { tlwarn("Cannot read $restore_file, no action taken\n"); return; } - $localtlmedia->remove_package($pkg); - TeXLive::TLMedia->_install_package($restore_file , 0, [] ,$localtlpdb); + $localtlpdb->remove_package($pkg); + TeXLive::TLPDB->_install_package($restore_file , 0, [] ,$localtlpdb); logpackage("restore: $pkg ($rev)"); # now we have to read the .tlpobj file and add it to the DB my $tlpobj = TeXLive::TLPOBJ->new; @@ -1713,18 +1714,17 @@ sub write_w32_updater { my ($restart_tlmgr, $ref_files_to_be_removed, @w32_updated) = @_; my @infra_files_to_be_removed = @$ref_files_to_be_removed; # TODO do something with these files TODO - my $media = $tlmediasrc->media; - my $mediatlpdb = $tlmediasrc->tlpdb; + my $media = $remotetlpdb->media; # we have to download/copy also the src/doc files if necessary! - my $container_src_split = $mediatlpdb->config_src_container; - my $container_doc_split = $mediatlpdb->config_doc_container; + my $container_src_split = $remotetlpdb->config_src_container; + my $container_doc_split = $remotetlpdb->config_doc_container; # get options about src/doc splitting from $totlpdb # TT: should we use local options to decide about install of doc & src? my $opt_src = $localtlpdb->option("install_srcfiles"); my $opt_doc = $localtlpdb->option("install_docfiles"); my $root = $localtlpdb->root; my $temp = "$root/temp"; - my $repo = $mediatlpdb->root . "/$Archive"; + my $repo = $remotetlpdb->root . "/$Archive"; TeXLive::TLUtils::mkdirhier($temp); tlwarn("Backup option not implemented for infrastructure update.\n") if ($opts{"backup"}); if ($media eq 'local_uncompressed') { @@ -1734,7 +1734,7 @@ sub write_w32_updater { } my (@upd_tar, @upd_tlpobj, @upd_info, @rst_tar, @rst_tlpobj, @rst_info); foreach my $pkg (@w32_updated) { - my $mediatlp = $mediatlpdb->get_package($pkg); + my $mediatlp = $remotetlpdb->get_package($pkg); my $localtlp = $localtlpdb->get_package($pkg); my $oldrev = $localtlp->revision; my $newrev = $mediatlp->revision; @@ -1913,15 +1913,15 @@ sub auto_remove_install_force_packages { # my @all_schmscolls = (); for my $p ($localtlpdb->schemes) { - push (@all_schmscolls, $p) if defined($tlmediatlpdb->get_package($p)); + push (@all_schmscolls, $p) if defined($remotetlpdb->get_package($p)); } for my $p ($localtlpdb->collections) { - push (@all_schmscolls, $p) if defined($tlmediatlpdb->get_package($p)); + push (@all_schmscolls, $p) if defined($remotetlpdb->get_package($p)); } my @localexpansion_full = $localtlpdb->expand_dependencies($localtlpdb, @all_schmscolls); my @remoteexpansion_full = - $tlmediatlpdb->expand_dependencies($localtlpdb, @all_schmscolls); + $remotetlpdb->expand_dependencies($localtlpdb, @all_schmscolls); # compute new/remove/forcerm based on the full expansions for my $p (@remoteexpansion_full) { @@ -1942,7 +1942,7 @@ sub auto_remove_install_force_packages { # intersection, don't check A\B and B\A next if $newpkgs_full{$p}; next if $removals_full{$p}; - next if ($tlmediatlpdb->get_package($p)->category ne "Collection"); + next if ($remotetlpdb->get_package($p)->category ne "Collection"); my $tlp = $localtlpdb->get_package($p); if (!defined($tlp)) { if ($opts{"reinstall-forcibly-removed"}) { @@ -1956,7 +1956,7 @@ sub auto_remove_install_force_packages { # forcibly removed. Again, expand those against the remote tlpdb # and remove the expanded packages from the list of localexpansion. my @pkgs_from_forcerm_colls = - $tlmediatlpdb->expand_dependencies($localtlpdb, keys %forcermpkgs_full); + $remotetlpdb->expand_dependencies($localtlpdb, keys %forcermpkgs_full); # # the package in @pkgs_from_forcerm_colls would be auto-installed, so # check for that: @@ -2033,7 +2033,7 @@ sub auto_remove_install_force_packages { # tlmgr update --no-depends-at-all foo # will absolutely only update foo not even taking .ARCH into account # -# TLMedia->install_package INSTALLS ONLY ONE PACKAGE, no deps whatsoever +# TLPDB->install_package INSTALLS ONLY ONE PACKAGE, no deps whatsoever # anymore. That has all to be done by hand. # sub machine_line { @@ -2083,7 +2083,7 @@ sub action_update { # check for updates to tlmgr and die unless either --force or --list or --self # is given - my @critical = check_for_critical_updates($localtlpdb, $tlmediatlpdb); + my @critical = check_for_critical_updates($localtlpdb, $remotetlpdb); my $dry_run_cont = $opts{"dry-run"} && ($opts{"dry-run"} < 0); if ( !$dry_run_cont && !$opts{"self"} && @critical) { critical_updates_warning(); @@ -2185,11 +2185,11 @@ sub action_update { if (!($opts{"self"} && @critical) || ($opts{"self"} && $opts{"list"})) { # update all .ARCH dependencies, too, unless $opts{"no-depends-at-all"}: - @todo = $tlmediatlpdb->expand_dependencies("-only-arch", $localtlpdb, @todo) + @todo = $remotetlpdb->expand_dependencies("-only-arch", $localtlpdb, @todo) unless $opts{"no-depends-at-all"}; # # update general deps unless $opts{"no-depends"}: - @todo = $tlmediatlpdb->expand_dependencies("-no-collections",$localtlpdb,@todo) + @todo = $remotetlpdb->expand_dependencies("-no-collections",$localtlpdb,@todo) unless $opts{"no-depends"}; # # filter out critical packages @@ -2208,7 +2208,7 @@ sub action_update { # options --no-auto-remove, --no-auto-install, --reinstall-forcibly-removed my @option_conflict_lines = (); my $in_conflict = 0; - if (!$opts{"no-auto-remove"}) { + if (!$opts{"no-auto-remove"} && $config{"auto-remove"}) { for my $pkg (keys %removals) { for my $ep (@excluded_pkgs) { if ($pkg eq $ep || $pkg =~ m/^$ep\./) { @@ -2298,7 +2298,7 @@ sub action_update { next; } # install new packages - my $mediatlp = $tlmediatlpdb->get_package($pkg); + my $mediatlp = $remotetlpdb->get_package($pkg); if (!defined($mediatlp)) { tlwarn("\nShould not happen: $pkg not found in $location"); next; @@ -2308,7 +2308,7 @@ sub action_update { next; } my $rev = $tlp->revision; - my $mediatlp = $tlmediatlpdb->get_package($pkg); + my $mediatlp = $remotetlpdb->get_package($pkg); if (!defined($mediatlp)) { debug("$pkg cannot be found in $location\n"); next; @@ -2346,7 +2346,7 @@ sub action_update { # remove the packages that have disappeared: # we add that only to the list of total packages do be worked on # when --all is given, because we remove packages only on --all - if (!$opts{"no-auto-remove"}) { + if (!$opts{"no-auto-remove"} && $config{"auto-remove"}) { my @foo = keys %removals; $totalnr += $#foo + 1; } @@ -2360,7 +2360,7 @@ sub action_update { # get something wrong back, namely the total size of all packages my %sizes; if (@alltodo) { - %sizes = %{$tlmediatlpdb->sizes_of_packages( + %sizes = %{$remotetlpdb->sizes_of_packages( $localtlpdb->option("install_srcfiles"), $localtlpdb->option("install_docfiles"), @alltodo)}; } else { @@ -2394,7 +2394,7 @@ sub action_update { } } for my $p (@updated, @new) { - my $pkg = $tlmediatlpdb->get_package($p); + my $pkg = $remotetlpdb->get_package($p); tlwarn("Should not happen: $p not found in $location\n") if (!$pkg); next; for my $f ($pkg->all_files) { @@ -2434,11 +2434,11 @@ sub action_update { # REMOVALS # for my $p (keys %removals) { - if ($opts{"no-auto-remove"}) { - info("not removing $p due to -no-auto-remove (removed on server)\n"); + if ($opts{"no-auto-remove"} || !$config{"auto-remove"}) { + info("not removing $p due to -no-auto-remove or config file option (removed on server)\n"); } else { &ddebug("removing package $p\n"); - my $pkg = $localtlmedia->tlpdb->get_package($p); + my $pkg = $localtlpdb->get_package($p); if (! $pkg) { # This happened when a collection was removed by the user, # and then renamed on the server, e.g., collection-langarab -> @@ -2476,7 +2476,7 @@ sub action_update { clear_old_backups($p, $opts{"backupdir"}, $autobackup); } } - $localtlmedia->remove_package($p); + $localtlpdb->remove_package($p); logpackage("remove: $p"); } $currnr++; @@ -2572,7 +2572,7 @@ sub action_update { my $unwind_package; my $remove_unwind_container = 0; my $rev = $tlp->revision; - my $mediatlp = $tlmediatlpdb->get_package($pkg); + my $mediatlp = $remotetlpdb->get_package($pkg); if (!defined($mediatlp)) { debug("$pkg cannot be found in $location\n"); next; @@ -2666,10 +2666,10 @@ sub action_update { if ($pkg =~ m/$CriticalPackagesRegexp/) { debug("Not removing critical package $pkg\n"); } else { - $localtlmedia->remove_package($pkg, + $localtlpdb->remove_package($pkg, "remove-warn-files" => \%do_warn_on_move); } - if ($tlmediasrc->install_package($pkg, $localtlpdb)) { + if ($remotetlpdb->install_package($pkg, $localtlpdb)) { # installation succeeded because we got a reference logpackage("update: $pkg ($rev -> $mediarev)"); unlink($unwind_package) if $remove_unwind_container; @@ -2713,8 +2713,8 @@ sub action_update { $remove_unwind_container = 1; $unwind_package = $newname; } - my $instret = TeXLive::TLMedia->_install_package("$unwind_package", 0, - [], $localtlpdb); + my $instret = TeXLive::TLPDB->_install_package("$unwind_package", 0, + [], $localtlpdb); if ($instret) { # now we have to include the tlpobj my $tlpobj = TeXLive::TLPOBJ->new; @@ -2740,7 +2740,7 @@ sub action_update { unless $::machinereadable; } else { # install new packages - my $mediatlp = $tlmediatlpdb->get_package($pkg); + my $mediatlp = $remotetlpdb->get_package($pkg); if (!defined($mediatlp)) { tlwarn("\nShould not happen: $pkg not found in $location"); next; @@ -2768,7 +2768,7 @@ sub action_update { $currnr++; $donesize += $sizes{$pkg}; next if ($opts{"dry-run"} || $opts{"list"}); - if ($tlmediasrc->install_package($pkg, $localtlpdb)) { + if ($remotetlpdb->install_package($pkg, $localtlpdb)) { # installation succeeded because we got a reference logpackage("auto-install new: $pkg ($mediarev)"); $nrupdated++; @@ -2797,11 +2797,11 @@ sub action_update { my $newtlp; if ($updated{$pkg}) { $oldtlp = $localtlpdb->get_package($pkg); - $newtlp = $tlmediatlpdb->get_package($pkg); + $newtlp = $remotetlpdb->get_package($pkg); } else { # update failed but we could introduce new files, that # should be removed now as a part of restoring backup - $oldtlp = $tlmediatlpdb->get_package($pkg); + $oldtlp = $remotetlpdb->get_package($pkg); $newtlp = $localtlpdb->get_package($pkg); } die ("That shouldn't happen: $pkg not found in tlpdb") if !defined($newtlp); @@ -2897,8 +2897,8 @@ sub action_update { if ($opts{"dry-run"} && !$opts{"list"} && $restart_tlmgr) { $opts{"self"} = 0; $opts{"dry-run"} = -1; - $localtlmedia = undef; - $tlmediatlpdb = undef; + $localtlpdb = undef; + $remotetlpdb = undef; info ("Restarting tlmgr to complete update ...\n"); action_update(); return; @@ -2908,7 +2908,7 @@ sub action_update { # warn if nothing is updated. if (!(@new || @updated)) { info("tlmgr: no updates available\n"); - if ($tlmediasrc->media ne "NET" + if ($remotetlpdb->media ne "NET" && !$opts{"dry-run"} && !$opts{"repository"} ) { @@ -2948,18 +2948,18 @@ sub action_update { # . it does not care for whether a package seems to be installed or # not (that is the --reinstall) # -# TLMedia->install_package does ONLY INSTALL ONE PACKAGE, no deps whatsoever +# TLPDB->install_package does ONLY INSTALL ONE PACKAGE, no deps whatsoever # anymore! That has all to be done by hand. # sub action_install { init_local_db(1); return if !check_on_writable(); - # initialize the TLMedia from $location + # initialize the TLPDB from $location $opts{"no-depends"} = 1 if $opts{"no-depends-at-all"}; init_tlmedia(); # check for updates to tlmgr itself, and die unless --force is given - if (check_for_critical_updates( $localtlpdb, $tlmediatlpdb)) { + if (check_for_critical_updates( $localtlpdb, $remotetlpdb)) { critical_updates_warning(); if ($opts{"force"}) { tlwarn("Continuing due to --force\n"); @@ -2978,13 +2978,13 @@ sub action_install { my @packs = @ARGV; # first expand the .ARCH dependencies unless $opts{"no-depends-at-all"} - @packs = $tlmediatlpdb->expand_dependencies("-only-arch", $localtlpdb, @ARGV) unless $opts{"no-depends-at-all"}; + @packs = $remotetlpdb->expand_dependencies("-only-arch", $localtlpdb, @ARGV) unless $opts{"no-depends-at-all"}; # now expand all others unless $opts{"no-depends"} # if $opts{"reinstall"} do not collection->collection dependencies if ($opts{"reinstall"}) { - @packs = $tlmediatlpdb->expand_dependencies("-no-collections", $localtlpdb, @packs) unless $opts{"no-depends"}; + @packs = $remotetlpdb->expand_dependencies("-no-collections", $localtlpdb, @packs) unless $opts{"no-depends"}; } else { - @packs = $tlmediatlpdb->expand_dependencies($localtlpdb, @packs) unless $opts{"no-depends"}; + @packs = $remotetlpdb->expand_dependencies($localtlpdb, @packs) unless $opts{"no-depends"}; } # # installation order of packages: @@ -3013,7 +3013,7 @@ sub action_install { my @todo; for my $pkg (@inst_packs, @inst_colls, @inst_schemes) { my $pkgrev = 0; - my $mediatlp = $tlmediatlpdb->get_package($pkg); + my $mediatlp = $remotetlpdb->get_package($pkg); if (!defined($mediatlp)) { tlwarn("package $pkg not present in package repository.\n"); next; @@ -3036,7 +3036,7 @@ sub action_install { return if (!@todo); my $currnr = 1; - my %sizes = %{$tlmediatlpdb->sizes_of_packages( + my %sizes = %{$remotetlpdb->sizes_of_packages( $localtlpdb->option("install_srcfiles"), $localtlpdb->option("install_docfiles"), @todo)}; defined($sizes{'__TOTAL__'}) || ($sizes{'__TOTAL__'} = 0); @@ -3067,7 +3067,7 @@ sub action_install { info("[$currnr/$totalnr, $estrem/$esttot] ${re}install: $pkg [${kb}k]\n"); } if (!$opts{"dry-run"}) { - $tlmediasrc->install_package($pkg, $localtlpdb); + $remotetlpdb->install_package($pkg, $localtlpdb); logpackage("${re}install: $pkg"); } $donesize += $sizes{$pkg}; @@ -3098,18 +3098,18 @@ sub action_list { } my $tlm; if ($opts{"only-installed"}) { - $tlm = $localtlmedia; + $tlm = $localtlpdb; } else { init_tlmedia(); - $tlm = $tlmediasrc; + $tlm = $remotetlpdb; } my @whattolist; if ($what =~ m/^collection/i) { - @whattolist = $tlm->tlpdb->collections; + @whattolist = $tlm->collections; } elsif ($what =~ m/^scheme/i) { - @whattolist = $tlm->tlpdb->schemes; + @whattolist = $tlm->schemes; } else { - @whattolist = $tlm->tlpdb->list_packages; + @whattolist = $tlm->list_packages; } foreach (@whattolist) { next if ($_ =~ m/^00texlive/); @@ -3118,7 +3118,7 @@ sub action_list { } else { print " "; } - my $foo = $tlm->tlpdb->get_package($_)->shortdesc; + my $foo = $tlm->get_package($_)->shortdesc; print "$_: ", defined($foo) ? $foo : "(shortdesc missing)" , "\n"; } return; @@ -3311,12 +3311,11 @@ sub action_platform { $what || ($what = "list"); if ($what =~ m/^list$/i) { # list the available platforms - # initialize the TLMedia from $location + # initialize the TLPDB from $location init_tlmedia(); - my $mediatlpdb = $tlmediasrc->tlpdb; my @already_installed_arch = $localtlpdb->available_architectures; print "Available platforms:\n"; - foreach my $a ($mediatlpdb->available_architectures) { + foreach my $a ($remotetlpdb->available_architectures) { if (member($a,@already_installed_arch)) { print "(i) $a\n"; } else { @@ -3329,9 +3328,8 @@ sub action_platform { } elsif ($what =~ m/^add$/i) { return if !check_on_writable(); init_tlmedia(); - my $mediatlpdb = $tlmediasrc->tlpdb; my @already_installed_arch = $localtlpdb->available_architectures; - my @available_arch = $mediatlpdb->available_architectures; + my @available_arch = $remotetlpdb->available_architectures; my @todoarchs; foreach my $a (@ARGV) { if (TeXLive::TLUtils::member($a, @already_installed_arch)) { @@ -3351,9 +3349,9 @@ sub action_platform { if ($dep =~ m/^(.*)\.ARCH$/) { # we have to install something foreach my $a (@todoarchs) { - if ($tlmediatlpdb->get_package("$pkg.$a")) { + if ($remotetlpdb->get_package("$pkg.$a")) { info("install: $pkg.$a\n"); - $tlmediasrc->install_package("$pkg.$a", $localtlpdb) + $remotetlpdb->install_package("$pkg.$a", $localtlpdb) if (!$opts{"dry-run"}); } } @@ -3364,7 +3362,7 @@ sub action_platform { # install the necessary w32 stuff for my $p (@extra_w32_packs) { info("install: $p\n"); - $tlmediasrc->install_package($p, $localtlpdb) if (!$opts{"dry-run"}); + $remotetlpdb->install_package($p, $localtlpdb) if (!$opts{"dry-run"}); } } # update the option("available_architectures") list of installed archs @@ -3378,7 +3376,7 @@ sub action_platform { return if !check_on_writable(); my @already_installed_arch = $localtlpdb->available_architectures; my @todoarchs; - my $currentarch = $localtlmedia->platform(); + my $currentarch = $localtlpdb->platform(); foreach my $a (@ARGV) { if (!TeXLive::TLUtils::member($a, @already_installed_arch)) { print "Platform $a not installed, use 'tlmgr platform list'!\n"; @@ -3404,7 +3402,7 @@ sub action_platform { foreach my $a (@todoarchs) { if ($localtlpdb->get_package("$pkg.$a")) { info("remove: $pkg.$a\n"); - $localtlmedia->remove_package("$pkg.$a") if (!$opts{"dry-run"}); + $localtlpdb->remove_package("$pkg.$a") if (!$opts{"dry-run"}); } } } @@ -3413,7 +3411,7 @@ sub action_platform { if (TeXLive::TLUtils::member('win32', @todoarchs)) { for my $p (@extra_w32_packs) { info("remove: $p\n"); - $localtlmedia->remove_package($p) if (!$opts{"dry-run"}); + $localtlpdb->remove_package($p) if (!$opts{"dry-run"}); } } if (!$opts{"dry-run"}) { @@ -3629,11 +3627,11 @@ sub action_uninstall { } print ("Ok, removing the whole installation:\n"); init_local_db(); - TeXLive::TLUtils::remove_symlinks($localtlmedia->tlpdb->root, - $localtlmedia->platform(), - $localtlmedia->tlpdb->option("sys_bin"), - $localtlmedia->tlpdb->option("sys_man"), - $localtlmedia->tlpdb->option("sys_info")); + TeXLive::TLUtils::remove_symlinks($localtlpdb->root, + $localtlpdb->platform(), + $localtlpdb->option("sys_bin"), + $localtlpdb->option("sys_man"), + $localtlpdb->option("sys_info")); # now do remove the rest system("rm", "-rf", "$Master/texmf-dist"); system("rm", "-rf", "$Master/texmf-doc"); @@ -3845,7 +3843,7 @@ sub check_files { # if we are on W32, return (no find). We need -use-svn only for # checking the live repository on tug, which is not w32. - my $arch = $localtlmedia->platform(); + my $arch = $localtlpdb->platform(); return $ret if $arch eq "win32"; # check that all files in the trees are covered. @@ -4427,15 +4425,12 @@ sub init_local_db { # if the localtlpdb is already defined do simply return here already # to make sure that the settings in the local tlpdb do not overwrite # stuff changed via the GUI - return if defined $localtlmedia; return if defined $localtlpdb; - $localtlmedia = TeXLive::TLMedia->new ( $Master ); - die("cannot setup TLMedia in $Master") unless (defined($localtlmedia)); - $localtlpdb = $localtlmedia->tlpdb; - die("cannot find tlpdb in $Master") unless (defined($localtlpdb)); + $localtlpdb = TeXLive::TLPDB->new ( root => $Master ); + die("cannot setup TLPDB in $Master") unless (defined($localtlpdb)); # setup the programs, for w32 we need the shipped wget/xz etc, so we # pass the location of these files to setup_programs. - if (!setup_programs("$Master/tlpkg/installer", $localtlmedia->platform)) { + if (!setup_programs("$Master/tlpkg/installer", $localtlpdb->platform)) { tlwarn("Couldn't set up the necessary programs.\nInstallation of packages is not supported.\nPlease report to texlive\@tug.org.\n"); if (defined($should_i_die) && $should_i_die) { finish(1); @@ -4471,12 +4466,12 @@ sub init_local_db { } -# initialize the global $tlmediasrc object, or die. +# initialize the global $remotetlpdb object, or die. # uses the global $location. # sub init_tlmedia { - if (defined($tlmediatlpdb) && ($tlmediatlpdb->root eq $location)) { + if (defined($remotetlpdb) && ($remotetlpdb->root eq $location)) { # nothing to be done return; } @@ -4531,8 +4526,8 @@ http://tug.org/texlive/doc/install-tl.html END_NO_INTERNET # above text duplicated in install-tl - $tlmediasrc = TeXLive::TLMedia->new(-location => $location, - -tlpdbfile => $loc_copy_of_remote_tlpdb); + $remotetlpdb = TeXLive::TLPDB->new(root => $location, + tlpdbfile => $loc_copy_of_remote_tlpdb); $local_copy_tlpdb_used = 1; } else { ddebug("found remote digest: $rem_digest\n"); @@ -4540,33 +4535,31 @@ END_NO_INTERNET ddebug("rem_copy_digest = $rem_copy_digest\n"); if ($rem_copy_digest eq $rem_digest) { debug("md5 of local copy identical with remote hash\n"); - $tlmediasrc = TeXLive::TLMedia->new(-location => $location, - -tlpdbfile => $loc_copy_of_remote_tlpdb); + $remotetlpdb = TeXLive::TLPDB->new(root => $location, + tlpdbfile => $loc_copy_of_remote_tlpdb); $local_copy_tlpdb_used = 1; } } } } if (!$local_copy_tlpdb_used) { - # $tlmediasrc is a global variable - $tlmediasrc = TeXLive::TLMedia->new(-location => $location); + $remotetlpdb = TeXLive::TLPDB->new(root => $location); } - die($loadmediasrcerror . $location) unless defined($tlmediasrc); - $tlmediatlpdb = $tlmediasrc->tlpdb; + die($loadmediasrcerror . $location) unless defined($remotetlpdb); # we allow a range of years to be specified by the remote tlpdb # for which it might work. - # the lower limit is TLPDB->config_release - # the upper limit is TLPDB->config_maxrelease + # the lower limit is TLPDB->config_minrelease + # the upper limit is TLPDB->config_release # if the later is not present only the year in config_release is accepted # checks are done on the first 4 digits only # Why only the first four places: some optional network distributions # might use # release/2009-foobar # If it should work for 2009 and 2010, please use - # release/2009-foobar - # maxrelease/2010-foobar - my $texlive_release = $tlmediatlpdb->config_release; - my $texlive_maxrelease = $tlmediatlpdb->config_maxrelease; + # minrelease/2009-foobar + # release/2010-foobar + my $texlive_release = $remotetlpdb->config_release; + my $texlive_minrelease = $remotetlpdb->config_minrelease; if (!defined($texlive_release)) { tldie "The installation repository does not specify a release year for which it was prepared, bailing out.\n"; } @@ -4577,25 +4570,25 @@ END_NO_INTERNET tldie "The installation repository does not specify a release year: $texlive_release, bailing out.\n"; } # so $texlive_release_year is numeric, good - if (defined($texlive_maxrelease)) { + if (defined($texlive_minrelease)) { # we specify a range of years! - my $texlive_maxrelease_year = $texlive_maxrelease; - $texlive_maxrelease_year =~ s/^(....).*$/$1/; - if ($texlive_maxrelease_year !~ m/^[1-9][0-9][0-9][0-9]$/) { - tldie "The installation repository does not specify a valid maximal release year: $texlive_maxrelease, bailing out.\n"; + my $texlive_minrelease_year = $texlive_minrelease; + $texlive_minrelease_year =~ s/^(....).*$/$1/; + if ($texlive_minrelease_year !~ m/^[1-9][0-9][0-9][0-9]$/) { + tldie "The installation repository does not specify a valid minimal release year: $texlive_minrelease, bailing out.\n"; } # ok, all numeric and fine, check for range - if ($TeXLive::TLConfig::ReleaseYear < $texlive_release_year - || $TeXLive::TLConfig::ReleaseYear > $texlive_maxrelease_year) { + if ($TeXLive::TLConfig::ReleaseYear < $texlive_minrelease_year + || $TeXLive::TLConfig::ReleaseYear > $texlive_release_year) { tldie <<END_BADRANGE $0: The TeX Live versions supported by the repository - ($texlive_release_year--$texlive_maxrelease_year) + ($texlive_minrelease_year--$texlive_release_year) do not include the version of the local installation ($TeXLive::TLConfig::ReleaseYear). Goodbye. END_BADRANGE } } else { - # $texlive_maxrelease not defined, so only one year is valid + # $texlive_minrelease not defined, so only one year is valid if ($texlive_release_year != $TeXLive::TLConfig::ReleaseYear) { tldie <<END_BADYEAR $0: The TeX Live versions of the local installation @@ -4608,7 +4601,7 @@ END_BADYEAR } # check for being frozen - if ($tlmediatlpdb->option("frozen")) { + if ($remotetlpdb->option("frozen")) { my $frozen_msg = <<FROZEN; TeX Live $TeXLive::TLConfig::ReleaseYear is frozen forever and will no longer be updated. This happens in preparation for a new release. @@ -4636,7 +4629,7 @@ FROZEN &debug("Cannot save remote TeX Live database to $loc_copy_of_remote_tlpdb: $!\n"); } else { &debug("writing out tlpdb to $loc_copy_of_remote_tlpdb\n"); - $tlmediatlpdb->writeout($tlfh); + $remotetlpdb->writeout($tlfh); close($tlfh); } } @@ -4686,6 +4679,9 @@ sub load_config_file # the default for gui-expertmode is 1 since that is what we # have shipped till now $config{"gui-expertmode"} = 1; + # + # by default we remove packages + $config{"auto-remove"} = 1; chomp (my $TEXMFCONFIG = `kpsewhich -var-value=TEXMFCONFIG`); my $fn = "$TEXMFCONFIG/tlmgr/config"; @@ -4711,6 +4707,14 @@ sub load_config_file } } elsif ($key eq "gui-lang") { $config{'gui-lang'} = $val; + } elsif ($key eq "auto-remove") { + if ($val eq "0") { + $config{"auto-remove"} = 0; + } elsif ($val eq "1") { + $config{"auto-remove"} = 1; + } else { + tlwarn("Unknown value >$val< for auto-remove in $fn\n"); + } } else { tlwarn("Unknown key $key in $fn\n"); } @@ -5599,17 +5603,17 @@ C<--print-arch> is a synonym. =head2 search [I<options>] I<what> -=head2 search [I<options>] --file I<what> +=head3 search [I<options>] --file I<what> -=head2 search [I<options>] --taxonomy I<what> +=head3 search [I<options>] --taxonomy I<what> -=head2 search [I<options>] --keyword I<what> +=head3 search [I<options>] --keyword I<what> -=head2 search [I<options>] --functionality I<what> +=head3 search [I<options>] --functionality I<what> -=head2 search [I<options>] --characterization I<what> +=head3 search [I<options>] --characterization I<what> -=head2 search [I<options>] --all I<what> +=head3 search [I<options>] --all I<what> By default, search the names, short descriptions, and long descriptions of all locally installed packages for the argument I<what>, interpreted @@ -5761,11 +5765,13 @@ checking the TL development repository. =head2 path [--w32mode=user|admin] [add|remove] -On Unix adds or removes symlinks for binaries, man pages, and info pages -in the directories specified by the respective options (see above). +On Unix, merely adds or removes symlinks for binaries, man pages, and +info pages in the system directories specified by the respective options +(see the L<option> description above). Does not change any +initialization files, either system or personal. -On Windows, the registry part where the binary directory is -added or removed is determined in the following way: +On Windows, the registry part where the binary directory is added or +removed is determined in the following way: If the user has admin rights, and the option C<--w32mode> is not given, the setting I<w32_multi_user> determines the location (i.e., if it is @@ -5784,6 +5790,7 @@ is given, it must be B<user> and the user path will be adjusted. If a user without admin rights uses the option C<--w32mode admin> a warning is issued that the caller does not have enough provileges. + =cut # keep the following on *ONE* line otherwise Windows perldoc does @@ -6049,6 +6056,7 @@ addition to these three on the top right there is some text showing the currently loaded repository (this text also acts as button and will load the default repository). + =head2 Menu bar The following entries can be found in the menu bar: @@ -6091,6 +6099,7 @@ installed version, authors, license. =back + =head2 Main display The main display lists all packages, installed and, if a repository is diff --git a/Master/texmf-dist/scripts/tex4ht/mk4ht.pl b/Master/texmf-dist/scripts/tex4ht/mk4ht.pl index 67e2070bf7d..cf068ed1fd1 100755 --- a/Master/texmf-dist/scripts/tex4ht/mk4ht.pl +++ b/Master/texmf-dist/scripts/tex4ht/mk4ht.pl @@ -1,8 +1,8 @@ #!/usr/bin/env perl #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -# mk4ht 2008-06-28-19:09 % -# Copyright (C) 2003--2008 Eitan M. Gurari % -# % +# mk4ht Version 1.1 % +# Copyright (C) 2003--2009 Eitan M. Gurari % +# Copyright 2009 TeX Users Group % # % # This work may be distributed and/or modified under the % # conditions of the LaTeX Project Public License, either % @@ -15,11 +15,11 @@ # % # This work has the LPPL maintenance status "maintained".% # % -# This Current Maintainer of this work % -# is Eitan M. Gurari. % +# The Current Maintainer of this work % +# is the TeX4ht Project. % # % -# gurari@cse.ohio-state.edu % -# http://www.cse.ohio-state.edu/~gurari % +# tex4ht@tug.org % +# http://www.tug.org/tex4ht % #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% use strict; @@ -216,7 +216,7 @@ print " clean.htlatex lg tmp\n"; } -print "mk4ht (2008-06-28-19:09)\n"; +print "mk4ht (Version 1.1)\n"; if( !@ARGV ){ print "improper command\n"; showInstrucions(); exit(1); diff --git a/Master/texmf/scripts/tetex/updmap-sys.sh b/Master/texmf/scripts/tetex/updmap-sys.sh new file mode 100755 index 00000000000..6f3c8365658 --- /dev/null +++ b/Master/texmf/scripts/tetex/updmap-sys.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# updmap-sys: Thomas Esser, public domain. + +# wrapper script for updmap with TEXMFVAR and TEXMFCONFIG set to +# TEXMFSYSVAR / TEXMFSYSCONFIG + +test -f /bin/ksh && test -z "$RUNNING_KSH" \ + && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \ + && { RUNNING_KSH=true; export RUNNING_KSH; exec /bin/ksh $0 ${1+"$@"}; } +unset RUNNING_KSH + +test -f /bin/bsh && test -z "$RUNNING_BSH" \ + && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \ + && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; } +unset RUNNING_BSH + +export PATH + +# hack around a bug in zsh: +test -n "${ZSH_VERSION+set}" && alias -g '${1+"$@"}'='"$@"' + +v=`kpsewhich -var-value TEXMFSYSVAR` +c=`kpsewhich -var-value TEXMFSYSCONFIG` + +TEXMFVAR="$v" +TEXMFCONFIG="$c" +export TEXMFVAR TEXMFCONFIG + +exec updmap ${1+"$@"} diff --git a/Master/texmf/scripts/tetex/updmap.pl b/Master/texmf/scripts/tetex/updmap.pl index 3b8a8a9e7c9..407bac9e082 100644..100755 --- a/Master/texmf/scripts/tetex/updmap.pl +++ b/Master/texmf/scripts/tetex/updmap.pl @@ -1,58 +1,49 @@ -#!/usr/bin/env perl +#! /usr/bin/env perl ############################################################################### # updmap: utility to maintain map files for outline fonts. # -# Thomas Esser, (C) 2002. Public domain. +# Thomas Esser, (C) 2002. # Fabrice Popineau, for the Perl version. -# -# Commands: -# --edit edit config file -# --help show help message -# -# Options: -# --cnffile file specify configuration file -# --dvipsoutputdir directory specify output directory (dvips syntax) -# --pdftexoutputdir directory specify output directory (pdftex syntax) -# --dvipdfmoutputdir directory specify output directory (dvipdfm syntax) -# --outputdir directory specify output directory (for all files) -# --quiet reduce verbosity -############################################################################### -#$^W=1; - -require "newgetopt.pl"; -use strict; - -# my $IsWin32 = ($^O =~ /MSWin32/i); +# Anyone may freely use, modify, and/or distribute this file, without +# limitation. +############################################################################### +# $Id: updmap.pl 21946 2011-04-04 00:16:58Z karl $ +BEGIN { + $^W=1; + chomp($TEXMFROOT = `kpsewhich -var-value=TEXMFROOT`); + unshift (@INC, "$TEXMFROOT/tlpkg"); +} -# if ($IsWin32) { -# use Win32::Registry; -# use Win32::API; -# } +my $version = '$Id: updmap.pl 21946 2011-04-04 00:16:58Z karl $'; +use strict; +use TeXLive::TLUtils qw(mkdirhier mktexupd win32); +use Getopt::Long; +$Getopt::Long::autoabbrev=0; +Getopt::Long::Configure ("bundling"); -my $progname; +my $progname='updmap'; my $cnfFile; my $cnfFileShort; my $outputdir; my $dvipsoutputdir; my $pdftexoutputdir; -my $dvipdfmoutputdir; my $quiet; -my $texhashEnabled; -my $mkmapEnabled; +my $nohash; +my $nomkmap; -my %enableItem = (); +my $enableItem; my %setOption = (); my @showoptions = (); my @disableItem = (); my $listmaps; -my $needsCleanup; +my $listavailablemaps; +my $syncwithtrees; my $verbose; -my $debug; my $opt_edit; my $opt_help; - +my $dry_run; my $TEXMFMAIN; my $TEXMFVAR; @@ -60,14 +51,25 @@ my $mode; my $dvipsPreferOutline; my $dvipsDownloadBase35; my $pdftexDownloadBase14; -my $dvipdfmDownloadBase14; my $dvips35; my $pdftex35; -my $dvipdfm35; my $ps2pk35; -my @cfg = ( ); +my $newcnf; +my %link; +my %maps; +my @missing; +my $writelog = 0; +my $cache = 0; # don't change! +my $copy; +my $pdftexStripEnc=1; + +# initialize mktexupd +my $updLSR=&mktexupd(); +$updLSR->{mustexist}(0); + +my @cfg = (); my @psADOBE = ( 's/ URWGothicL-Demi / AvantGarde-Demi /x', @@ -190,7 +192,7 @@ my @fileADOBE = ( 's/\buagko8a.pfb\b/agwo____.pfb/x', 's/\bubkd8a.pfb\b/bkd_____.pfb/x', 's/\bubkdi8a.pfb\b/bkdi____.pfb/x', - 's/\bubkl8a.pfb\b/bkl_____.pfb/x', + 's/\bubkl8a.pfb\b/bkl_____.pfb/x', 's/\bubkli8a.pfb\b/bkli____.pfb/x', 's/\bucrb8a.pfb\b/cob_____.pfb/x', 's/\bucrbo8a.pfb\b/cobo____.pfb/x', @@ -222,61 +224,26 @@ my @fileADOBE = ( ); &main; - exit 0; -# if ($IsWin32) { - -# sub GetTempPath { -# my $GetTempPath = new Win32::API('kernel32', 'GetTempPath', 'NP', 'N'); -# if(not defined $GetTempPath) { -# die "Can't import API GetTempPath: $!\n"; -# } -# my $lpBuffer = " " x 260; - -# $GetTempPath->Call(80, $lpBuffer); -# } - -# sub ShellExecute { -# my ($command, $file) = @_; -# my $ShellExecute = new Win32::API('shell32', 'ShellExecute', 'NPPPPN', 'N'); -# if(not defined $ShellExecute) { -# die "Can't import API ShellExecute: $!\n"; -# } -# $ShellExecute->Call(0, $command, $file, '', '', 0); -# } - -# sub GetHomeDir { -# my $home = $ENV{'HOME'}; -# # Should check for CSIDL_... -# return $home; -# } -# } - - ############################################################################### -# mkdirhier(directory) -# create a directory and parent directories as needed +# progname() +# return the name of the program. Needed if invoked by a wrapper. ############################################################################### -sub mkdirhier { - my $tree=shift; - my $mode=shift; - my $subdir; - - return if (-d $tree); - my @dirs=split /\//, $tree; - foreach my $dir (@dirs) { - $subdir .= ("$dir" . "/"); - unless (-d $subdir) { - if (defined $mode) { - mkdir ("$subdir", $mode) or die "Can't mkdir '$subdir': $!.\n"; - } else { - mkdir "$subdir" or die "Can't mkdir '$subdir': $!.\n"; - } - } +sub progname { + if (`kpsewhich --var-value=TEXMFVAR` eq `kpsewhich --var-value=TEXMFSYSVAR`) { + return 'updmap-sys'; + } else { + return 'updmap'; } } +# return program name + version string. +sub version { + my $ret = sprintf "%s version %s", &progname(), $version; + return $ret; +} + ############################################################################### # equalize_file(filename[, comment_char]) # read a file and return its processed content as a string. @@ -301,7 +268,6 @@ sub equalize_file { return join('X', sort(@temp)); } - ############################################################################### # files_are_different(file_A, file_B[, comment_char]) # compare two equalized files. @@ -318,7 +284,6 @@ sub files_are_different { return $retval; } - ############################################################################### # files_are_equal(file_A, file_B[, comment_char]) # compare two equalized files. Same as files_are_different() with @@ -328,6 +293,25 @@ sub files_are_equal { return (&files_are_different (@_))? 0:1; } +############################################################################### +# files_are_identical(file_A, file_B) +# compare two files. Same as cmp(1). +############################################################################### +sub files_are_identical { + my $file_A=shift; + my $file_B=shift; + my $retval=0; + + open IN, "$file_A"; + my $A=(<IN>); + close IN; + open IN, "$file_B"; + my $B=(<IN>); + close IN; + + $retval=1 if ($A eq $B); + return $retval; +} ############################################################################### # getLines() @@ -337,9 +321,26 @@ sub getLines { my @lines = (); foreach my $fname (@_) { next if (! $fname); - open FILE, "<$fname" or die "can't get lines from $fname: $!"; - push @lines, <FILE>; - close FILE; + if (! exists $maps{"$fname"}) { + open FILE, "<$fname" or die "can't get lines from $fname: $!"; + my @file=<FILE>; + close FILE; + if ($writelog) { + print LOG ("\n$fname:\n"); + foreach my $line (@file) { + next if $line =~ /^\s*%/; # comment + next if $line =~ /^\s*#/; # comment + next if $line =~ /^\s*$/; # empty line + my $tfm; + ($tfm)=split ' ', $line; + print LOG "$tfm\n"; + } + } + $maps{"$fname"} = [ @file ] if ($cache); + push @lines, @file; + } else { + push @lines, @{$maps{"$fname"}}; + } } chomp @lines; return @lines; @@ -363,6 +364,9 @@ sub writeLines { ############################################################################### sub copyFile { my ($src, $dst) = @_; + my $dir; + ($dir=$dst)=~s/(.*)\/.*/$1/; + mkdirhier $dir; $src eq $dst && return "can't copy $src to itself!\n"; @@ -379,74 +383,74 @@ sub copyFile { } ############################################################################### -# start_redirection(), stop_redirection() -# redirects stdout and stderr to log file (possibly "nul") -############################################################################### -sub start_redirection { - my ($log) = @_; - - # start redirection if asked - if ($log) { - open(SO, ">&STDOUT"); - open(SE, ">&STDERR"); - - close(STDOUT); - close(STDERR); - - open(STDOUT, ">$log"); - open(STDERR,">&STDOUT"); - - select(STDERR); $| = 1; - select(STDOUT); $| = 1; - } -} - -sub stop_redirection { - close(STDOUT); - close(STDERR); - open(STDOUT, ">&SO"); - open(STDERR, ">&SE"); -} - -############################################################################### # help() # display help message and exit ############################################################################### sub help { - print "Usage: $0 [option] ... [command]\n"; - print "\n"; - print "Valid options:\n"; - print " --cnffile file specify configuration file\n"; - print " --dvipsoutputdir directory specify output directory (dvips syntax)\n"; - print " --pdftexoutputdir directory specify output directory (pdftex syntax)\n"; - print " --dvipdfmoutputdir directory specify output directory (dvipdfm syntax)\n"; - print " --outputdir directory specify output directory (for all files)\n"; - print " --nohash do not run texhash\n"; - print " --nomkmap do not recreate map files\n"; - print " --quiet reduce verbosity\n"; - print "\n"; - print "Valid commands:\n"; - print " --edit edit updmap.cfg file\n"; - print " --help show this message\n"; - print " --showoptions item show alternatives for options\n"; - print " --setoption option=value set option where option is one\n"; - print " of dvipsPreferOutline, LW35, dvipsDownloadBase35\n"; - print " or pdftexDownloadBase14\n"; - print " --enable maptype=mapfile add or enable a Map or MixedMap\n"; - print " --disable mapfile disable Map or MixedMap for mapfile\n"; - print " --listmaps list all active and inactive maps\n"; + my $progname=&progname(); + my $usage= <<"EOF"; +Usage: $progname [option] ... [command] + +Update the default font map files used by pdftex, dvips, and dvipdfm, as +determined by updmap.cfg (the one returned by running "kpsewhich +updmap.cfg"). + +Among other things, these font map files are used to determine which +fonts should be used as bitmaps and which as outlines, and to determine +which fonts are included in the output. + +By default, the TeX filename database is also rebuilt (with mktexlsr). + +Valid options: + --cnffile FILE read FILE for the updmap configuration + --dvipsoutputdir DIR specify output directory (dvips syntax) + --pdftexoutputdir DIR specify output directory (pdftex syntax) + --outputdir DIR specify output directory (for all files) + --copy cp generic files rather than using symlinks + --nomkmap do not recreate map files + --nohash do not run texhash + -n, --dry-run only show the configuration, no output + --quiet reduce verbosity + +Valid commands: + --help show this message + --edit edit updmap.cfg file + --showoptions ITEM show alternatives for options + --setoption OPTION VALUE set option, where OPTION is one of: + dvipsPreferOutline, LW35, dvipsDownloadBase35, + or pdftexDownloadBase14 + --setoption OPTION=VALUE see above, just different syntax + --enable MAPTYPE MAPFILE add "MAPTYPE MAPFILE" to updmap.cfg, + where MAPTYPE is either Map or MixedMap + --enable Map=MAPFILE add \"Map MAPFILE\" to updmap.cfg + --enable MixedMap=MAPFILE add \"MixedMap MAPFILE\" to updmap.cfg + --disable MAPFILE disable MAPFILE, whether Map or MixedMap + --syncwithtrees entries with unavailable map files will be + disabled in the config file + --listmaps list all active and inactive maps + --listavailablemaps same as --listmaps, but without + unavailable map files + +Explanation of the map types: the (only) difference between Map and +MixedMap is that MixedMap entries are not added to psfonts_pk.map. The +purpose is to help users with printers that render Type 1 outline fonts +worse than mode-tuned Type 1 bitmap fonts. So MixedMap is used for +fonts that are available as both Type 1 and Metafont. + +To see the precise locations of the various files that will be read and +written, run updmap -n. + +For step-by-step instructions on making new fonts known to TeX, see +http://tug.org/fonts/fontinstall.html. + +Report bugs to: tex-k\@tug.org +TeX Live home page: <http://tug.org/texlive/> +EOF +; + print $usage; exit 0; } -############################################################################### -# abort(errmsg) -# print `errmsg' to stderr and exit with error code 1 -############################################################################### -sub abort { - my ($msg) = @_; - print STDERR "$progname: $msg\n"; - exit 1; -} ############################################################################### # cfgval(variable) @@ -464,12 +468,11 @@ sub cfgval { for my $line (@cfg) { if ($line =~ m/^\s*${variable}[\s=]+(.*)\s*$/) { $value = $1; - print "$variable => " . $value . "\n"; if ($value =~ m/^(true|yes|t|y|1)$/) { - $value = 1; + $value = 1; } elsif ($value =~ m/^(false|no|f|n|0)$/) { - $value = 0; + $value = 0; } last; } @@ -478,19 +481,35 @@ sub cfgval { } ############################################################################### +# SymlinkOrCopy(dir, src, dest) +# create symlinks if possible, otherwise copy files +############################################################################### +sub SymlinkOrCopy { + my ($dir, $src, $dest) = @_; + if (&win32 || $copy) { # always copy + ©File("$dir/$src", "$dir/$dest"); + } else { # symlink if supported by fs, copy otherwise + system("cd \"$dir\" && ln -s $src $dest 2>/dev/null || " + . "cp -p \"$dir/$src\" \"$dir/$dest\""); + } + # remember for "Files generated" in &mkMaps. + $link{"$dest"}="$src"; +} + +############################################################################### # setupSymlinks() # set symlink for psfonts.map according to dvipsPreferOutline variable ############################################################################### sub setupSymlinks { my $src; - if ($dvipsPreferOutline ) { + if ($dvipsPreferOutline) { $src = "psfonts_t1.map"; } else { $src = "psfonts_pk.map"; } unlink "$dvipsoutputdir/psfonts.map"; - ©File("$dvipsoutputdir/$src", "$dvipsoutputdir/psfonts.map"); + &SymlinkOrCopy("$dvipsoutputdir", "$src", "psfonts.map"); if ($pdftexDownloadBase14) { $src = "pdftex_dl14.map"; @@ -498,15 +517,7 @@ sub setupSymlinks { $src = "pdftex_ndl14.map"; } unlink "$pdftexoutputdir/pdftex.map"; - ©File("$pdftexoutputdir/$src", "$pdftexoutputdir/pdftex.map"); - - if ($dvipdfmDownloadBase14) { - $src = "dvipdfm_dl14.map"; - } else { - $src = "dvipdfm_ndl14.map"; - } - unlink "$dvipdfmoutputdir/dvipdfm.map"; - ©File("$dvipdfmoutputdir/$src", "$dvipdfmoutputdir/dvipdfm.map"); + &SymlinkOrCopy("$pdftexoutputdir", "$src", "pdftex.map"); } ############################################################################### @@ -542,13 +553,10 @@ sub transLW35 { # apply kpsewhich with format 'web2c files' ############################################################################### sub locateWeb2c { - my @files = @_; - return @files if ($#files < 0); @files = split (/\n/, `kpsewhich --format="web2c files" @files`); - if (wantarray) { return @files; } @@ -562,13 +570,18 @@ sub locateWeb2c { # apply kpsewhich with format 'dvips config' ############################################################################### sub locateMap { - my @files = @_; + my @maps = @_; + my @files; - chomp @files; - return @files if ($#files < 0); + chomp @maps; + return @maps if ($#maps < 0); - @files = `kpsewhich --format=map @files`; + @files = `kpsewhich --format=map @maps`; chomp @files; + + foreach my $map (@maps) { + push @missing, $map if (! grep /\/$map$/, @files); + } if (wantarray) { return @files; } @@ -589,7 +602,7 @@ sub catMaps { my @maps = grep { $_ =~ m/$map/ } @cfg; map{ $_ =~ s/\#.*//; - $_ =~ s/\s*([^\s]*)\s*([^\s]*)/\2/; + $_ =~ s/\s*([^\s]*)\s*([^\s]*)/$2/; } @maps; @maps = sort(@maps); @maps = grep { ++$count{$_} < 2; } @maps; @@ -627,22 +640,19 @@ sub setOption { my ($opt, $val) = @_; if ($opt eq "LW35") { - if ($val !~ m/^(URWkb|URW|ADOBE|ADOBEkb)$/) { - printf STDERR "invalid value $val for option $opt\n"; - exit 1; - } + if ($val !~ m/^(URWkb|URW|ADOBE|ADOBEkb)$/) { + die "Invalid value $val for option $opt.\n"; + } } - elsif ($opt =~ m/^(dvipsPreferOutline|dvipsDownloadBase35|pdftexDownloadBase14|dvipdfmDownloadBase14)$/) { + elsif ($opt =~ + m/^(dvipsPreferOutline|dvipsDownloadBase35|pdftexDownloadBase14)$/) { if ($val !~ m/^(true|false)$/) { - printf STDERR "invalid value $val for option $opt\n"; - exit 1; + die "invalid value $val for option $opt.\n"; } } else { - printf STDERR "unsupported option $opt\n"; - exit 1; + die "Unsupported option $opt.\n"; } - &configReplace("$cnfFile", "^" . "$opt" . "\\s", "$opt $val"); } @@ -654,8 +664,7 @@ sub enableMap { my ($type, $map) = @_; if ($type !~ m/^(Map|MixedMap)$/) { - printf STDERR "invalid mapType $type\n"; - exit 1; + die "updmap: Invalid mapType $type\n"; } # a map can only have one type, so we carefully disable everything # about map here: @@ -671,14 +680,13 @@ sub enableMap { ############################################################################### sub disableMap { my ($map) = @_; - my %count = ( ); + my %count = (); my $type; my @mapType = grep { my @fields = split; - if ($fields[0] =~ /^(MixedMap|Map)$/ - and $fields[1] eq $map - and ++$count{$fields[0]}) { + if ($fields[0] and $fields[0] =~ /^(MixedMap|Map)$/ + and $fields[1] eq $map and ++$count{$fields[0]}) { $_ = $fields[0]; } else { @@ -697,30 +705,14 @@ sub disableMap { ############################################################################### sub initVars { $progname="updmap"; - $quiet = 0; - $texhashEnabled = 1; - $mkmapEnabled = 1; + $nohash = 0; + $nomkmap = 0; $verbose = 1; - $needsCleanup = 0; - $cnfFile = ""; $cnfFileShort = "updmap.cfg"; $outputdir = ""; - $TEXMFMAIN =`kpsewhich --expand-var="\$TEXMFMAIN"`; - chomp($TEXMFMAIN); - # tmpdir=${TMP-/tmp}/$progname.$$ - # tmp1=$tmpdir/a - # tmp2=$tmpdir/b - # tmp3=$tmpdir/c -} - -############################################################################### -# setupTmpDir() -# set up a temp directory and a trap to remove it -############################################################################### -sub setupTmpDir { - + chomp($TEXMFMAIN =`kpsewhich --var-value=TEXMFMAIN`); } ############################################################################### @@ -728,20 +720,19 @@ sub setupTmpDir { # show Options for an item ############################################################################### sub showOptions { - foreach my $item (@_) { if ($item eq "LW35") { print "URWkb URW ADOBE ADOBEkb\n"; } - elsif ($item =~ m/(dvipsPreferOutline|pdftexDownloadBase14|dvipdfmDownloadBase14|dvipsDownloadBase35)/) { + elsif ($item =~ + m/(dvipsPreferOutline|pdftexDownloadBase14|dvipsDownloadBase35)/) { print "true false\n"; } else { - print "Unknown item \"$item\". Choose one of LW35, dvipsPreferOutline, dvipsDownloadBase35, pdftexDownloadBase14 or dvipdfmDownloadBase14\n"; -# exit 1; + print "Unknown item \"$item\". Choose one of LW35, dvipsPreferOutline,\n" + . " dvipsDownloadBase35, or pdftexDownloadBase14\n"; } } - exit 0 } @@ -758,53 +749,24 @@ sub setupOutputDir { my $rel = "fonts/map/$driver/updmap"; my $tf; # Try TEXMFVAR tree. Use it if variable is set and $rel can - # be written. Copy config file if it does not exist there. - if ($^O=~/^MSWin(32|64)$/) { - $tf = `kpsewhich --expand-var="\$TEXMFVAR"`; - } else { - $tf = `kpsewhich --expand-var="\\\$TEXMFVAR"`; - } - chomp($tf); + # be written. + chomp($tf = `kpsewhich --var-value=TEXMFVAR`); if ($tf) { &mkdirhier("$tf/$rel"); - # system("$TEXMFMAIN/web2c/mktexdir \"$tf/$rel\""); - if (! -d "$tf/$rel" || ! -w "$tf/$rel") { - # forget about TEXMFVAR tree... - $tf = ""; + if (! -w "$tf/$rel") { + die "Directory \"$tf/$rel\" isn't writable.\n"; } } - - # Try something relative to config file, fall back to $TEXMFMAIN. - if (! $tf) { - $tf = $cnfFile; - if ($tf =~ m@/web2c/[^/]*$@) { - $tf =~ s@/web2c/[^/]*$@@; - } - else { - $tf = ""; - } - $tf = $TEXMFMAIN if (! $tf); - } - $od = "$tf/$rel"; } - - # No need to call mktexdir ! - # system("$TEXMFMAIN/bin/win32/mktexdir \"$od\""); &mkdirhier($od); - &abort("output directory `$od' does not exist\n") if (! -d $od); - &abort("output directory `$od' is not writable\n") if (! -w $od); - print "using $driver output directory `$od'\n"; - + print "$driver output dir: \"$od\"\n" if (! $quiet); return $od; } sub setupDestDir { - $dvipsoutputdir = &setupOutputDir($dvipsoutputdir, "dvips"); $pdftexoutputdir = &setupOutputDir($pdftexoutputdir, "pdftex"); - $dvipdfmoutputdir = &setupOutputDir($dvipdfmoutputdir, "dvipdfm"); - } ############################################################################### @@ -812,81 +774,74 @@ sub setupDestDir { # find config file if none specified on cmd line. ############################################################################### sub setupCfgFile { - if (! $cnfFile) { - my $tf = `kpsewhich -expand-var="\$TEXMFVAR"`; + my $tf = `kpsewhich --var-value=TEXMFCONFIG`; chomp($tf); if ($tf && ! -f "$tf/web2c/$cnfFileShort") { &mkdirhier("$tf/web2c") if (! -d "$tf/web2c"); -# &start_redirection("nul"); -# system("mktexdir $tf/web2c"); -# &stop_redirection; if (-d "$tf/web2c" && -w "$tf/web2c") { - unlink "$tf/web2c/$cnfFileShort"; - ©File("$TEXMFMAIN/web2c/$cnfFileShort", "$tf/web2c/$cnfFileShort"); - &start_redirection("nul"); - system("mktexupd $tf/web2c $cnfFileShort"); - &stop_redirection; + unlink "$tf/web2c/$cnfFileShort"; + my $original_cfg=`kpsewhich updmap.cfg`; + chomp($original_cfg); + print("copy $original_cfg => $tf/web2c/$cnfFileShort\n") if (! $quiet); + $newcnf="$tf/web2c/$cnfFileShort"; + ©File("$original_cfg", "$tf/web2c/$cnfFileShort"); + $updLSR->{add}("$tf/web2c/$cnfFileShort"); } } - - $cnfFile = &locateWeb2c("updmap.cfg"); + $cnfFile = "$tf/web2c/updmap.cfg"; if ($cnfFile) { - print "using config file $cnfFile\n" if (! $quiet); + print "Config file: \"$cnfFile\"\n" if (! $quiet); } else { - &abort("config file updmap.cfg not found"); + die "Config file updmap.cfg not found.\n"; } } } - ############################################################################### # processOptions() # process cmd line options ############################################################################### sub processOptions { - - unless (&NGetOpt ("quiet" => \$quiet, - "cnffile=s" => \$cnfFile, - "outputdir=s" => \$outputdir, - "dvipsoutputdir=s" => \$dvipsoutputdir, - "pdftexoutputdir=s" => \$pdftexoutputdir, - "dvipdfmoutputdir=s" => \$dvipdfmoutputdir, - "setoption=s" => \%setOption, - "enable=s" => \%enableItem, - "disable=s" => \@disableItem, - "edit" => \$opt_edit, - "listmaps" => \$listmaps, - "showoptions=s" => \@showoptions, - "hash!" => \$texhashEnabled, - "mkmap!" => \$mkmapEnabled, - "verbose" => \$verbose, - "debug" => \$debug, - "help" => \$opt_help)) { - print STDERR "Try `$0 --help'"; - exit 1; + unless (&GetOptions ( + "q|quiet" => \$quiet, + "cnffile=s" => \$cnfFile, + "outputdir=s" => \$outputdir, + "dvipsoutputdir=s" => \$dvipsoutputdir, + "pdftexoutputdir=s" => \$pdftexoutputdir, + "setoption=s" => \%setOption, + "enable=s" => \$enableItem, + "disable=s" => \@disableItem, + "e|edit" => \$opt_edit, + "l|listmaps" => \$listmaps, + "listavailablemaps" => \$listavailablemaps, + "syncwithtrees" => \$syncwithtrees, + "showoptions=s" => \@showoptions, + "nohash" => \$nohash, + "nomkmap" => \$nomkmap, + "version" => sub { print &version() . "\n"; exit(0) }, + + "n|dry-run" => \$dry_run, + "copy" => \$copy, + "h|help" => \$opt_help)) { + my $progname=&progname(); + die "Try \"$progname --help\".\n"; } if ($outputdir) { $dvipsoutputdir = $outputdir if (! $dvipsoutputdir); $pdftexoutputdir = $outputdir if (! $pdftexoutputdir); - $dvipdfmoutputdir = $outputdir if (! $dvipdfmoutputdir); } if ($cnfFile && ! -f $cnfFile) { - &abort("config file `$cnfFile' not found"); + die "Config file \"$cnfFile\" not found.\n"; } - if ($dvipsoutputdir && ! -d $dvipsoutputdir) { - &abort("dvips output directory `$dvipsoutputdir' not found"); + &mkdirhier ($dvipsoutputdir); } if ($pdftexoutputdir && ! -d $pdftexoutputdir) { - &abort("pdftex output directory `$pdftexoutputdir' not found"); - } - if ($dvipdfmoutputdir && ! -d $dvipdfmoutputdir) { - &abort("dvipdfm output directory `$dvipdfmoutputdir' not found"); + &mkdirhier ($pdftexoutputdir); } - } ############################################################################### @@ -894,11 +849,42 @@ sub processOptions { # list all maps mentioned in the config file ############################################################################### sub listMaps { + my $what=shift; + my @mapfiles; + my @paths; + my @lines = grep { - $_ =~ m/^(\#! *)?(Mixed)?Map/ + if ($what eq 'sync') { + $_ =~ m/^(Mixed)?Map/ + } else { + $_ =~ m/^(\#! *)?(Mixed)?Map/ + } } &getLines($cnfFile); - map { print "$_\n"; } @lines; -# &writeLines("con", @lines); + + if ($what eq 'list') { + # --listmaps + map { print "$_\n"; } @lines; + } else { + @mapfiles=grep { $_ =~ s/^(\#! *)?(Mixed)?Map\s+// } @lines; + @paths=&locateMap(@mapfiles); + + if ($what eq 'avail') { + # --listavailablemaps + map { + my $entry="$_"; + # print "$entry\n" if (grep { $_ =~ m/\/$entry/ } @paths); + } @lines; + } elsif ($what eq 'sync') { + # --syncwithtrees + map { + my $entry="$_"; + unless (grep { $_ =~ m/$entry/ } @paths) { + &disableMap($entry); + print " $entry disabled\n" if (! $quiet); + } + } @lines; + } + } } ############################################################################### @@ -915,7 +901,7 @@ sub normalizeLines { @lines = grep { $_ !~ m/^\s*$/x } @lines; map { $_ =~ s/\s$//x ; $_ =~ s/\s*\"\s*/ \" /gx; - $_ =~ s/\" ([^\"]*) \"/\"\1\"/gx; + $_ =~ s/\" ([^\"]*) \"/\"$1\"/gx; } @lines; @lines = grep {++$count{$_} < 2 } (sort @lines); @@ -924,43 +910,22 @@ sub normalizeLines { } ############################################################################### -# dvips2dvipdfm() -# reads from stdin, writes to stdout. It transforms "dvips"-like syntax into -# "dvipdfm"-like syntax. It is a very ugly hack. +# to_pdftex() +# strip "PS_Encoding_Name ReEncodeFont" from map entries because +# they are ignored by pdftex anyway. ############################################################################### -sub dvips2dvipdfm { - my @lines = @_; - - map { - $_ =~ s@$@ %@; - $_ =~ s@^(([^ ]*).*)@\1\2@; - $_ =~ s@(.*<\[* *([^ ]*)\.enc(.*))@\1 \2@; - $_ = (m/%[^ ]*$/x ? "$_ default" : $_) ; - $_ =~ s@(.*<<* *([^ ]*)\.pf[ab].*)@\1 \2@; - if (m/%[^ ]* [^ ]*$/x) { $_ =~ s@( ([^ ]*).*)$@\1 \2@; } - $_ =~ s@(.* ([\.0-9-][\.0-9-]*) *ExtendFont.*)@\1 -e \2@; - $_ =~ s@(.* ([\.0-9-][\.0-9-]*) *SlantFont.*)@\1 -s \2@; - $_ =~ s@.*%@@ ; - } @lines; - - map { - my @elts = split (' ', $_); - if ($elts[0] eq $elts[2] - && $elts[1] eq "default") { - $elts[1] = ''; - $elts[2] = ''; - }; - $_ = join ' ',@elts; - } @lines; - - map { - if (/^(cm|eu|la|lc|line|msam|xy)/) { - $_ .= " -r" ; - $_ =~ s/(fmex[789]) -r/\1/; +sub to_pdftex { + return unless $pdftexStripEnc; + my @in = @_; + my @out; + foreach my $line (@in) { + if ($line =~ /^(.*\s+)(\S+\s+ReEncodeFont\s)(.*)/) { + $line = "$1$3"; + $line =~ s/\s+\"\s+\"\s+/ /; } - } @lines; - - return @lines; + push @out, $line; + } + return @out; } ############################################################################### @@ -969,6 +934,38 @@ sub dvips2dvipdfm { ############################################################################### sub mkMaps { my @lines; + my $logfile; + + $cache=1; + + if (! $dry_run) { + my $TEXMFVAR=`kpsewhich --var-value=TEXMFVAR`; + chomp($TEXMFVAR); + $logfile="$TEXMFVAR/web2c/updmap.log"; + mkdirhier "$TEXMFVAR/web2c"; + open LOG, ">$logfile" + or die "Can't open \"$logfile\""; + $writelog=1; + print LOG &version() . "\n"; + printf LOG "%s\n\n", scalar localtime(); + print LOG "Using config file \"$cnfFile\".\n"; + } + sub wlog () { + my $str=shift; + if ($dry_run) { + print $str; + } else { + print $str if (! $quiet); + print LOG $str; + } + } + sub newline() { + if ($dry_run) { + print "\n"; + } else { + print LOG "\n"; + } + } $mode = &cfgval("LW35"); $mode = "URWkb" unless (defined $mode); @@ -977,37 +974,75 @@ sub mkMaps { $dvipsPreferOutline = 1 unless (defined $dvipsPreferOutline); $dvipsDownloadBase35 = &cfgval("dvipsDownloadBase35"); - $dvipsDownloadBase35 = 0 unless (defined $dvipsDownloadBase35); + $dvipsDownloadBase35 = 1 unless (defined $dvipsDownloadBase35); $pdftexDownloadBase14 = &cfgval("pdftexDownloadBase14"); - $pdftexDownloadBase14 = 0 unless (defined $pdftexDownloadBase14); - - $dvipdfmDownloadBase14 = &cfgval("dvipdfmDownloadBase14"); - $dvipdfmDownloadBase14 = 0 unless (defined $dvipdfmDownloadBase14); - - if (! $quiet) { - print "\ -updmap is creating new map files using the following configuration:\ -\ - config file : " . ($cnfFile ? "true" : "false") ."\ - prefer outlines : " . ($dvipsPreferOutline ? "true" : "false") ."\ - texhash enabled : " . ($texhashEnabled ? "true" : "false") ."\ - download standard fonts (dvips) : " . ($dvipsDownloadBase35 ? "true" : "false") ."\ - download standard fonts (pdftex) : " . ($pdftexDownloadBase14 ? "true" : "false") . "\ - download standard fonts (dvipdfm): " . ($dvipdfmDownloadBase14 ? "true" : "false") . "\ -" - }; - - print "Scanning for LW35 support files\n" if (! $quiet); + $pdftexDownloadBase14 = 1 unless (defined $pdftexDownloadBase14); + + &wlog ("\nupdmap is creating new map files " . + "using the following configuration:" . + "\n LW35 font names : " . + $mode . + "\n prefer outlines : " . + ($dvipsPreferOutline ? "true" : "false") . + "\n texhash enabled : " . + ($nohash ? "false" : "true") . + "\n download standard fonts (dvips) : " . + ($dvipsDownloadBase35 ? "true" : "false") . + "\n download standard fonts (pdftex) : " . + ($pdftexDownloadBase14 ? "true" : "false") . + "\n\n"); + + &wlog ("Scanning for LW35 support files"); $dvips35 = &locateMap("dvips35.map"); $pdftex35 = &locateMap("pdftex35.map"); - $dvipdfm35 = &locateMap("dvipdfm35.map"); $ps2pk35 = &locateMap("ps2pk35.map"); + my $LW35="\n$dvips35\n$pdftex35\n$ps2pk35\n\n"; + if ($dry_run) { + print $LW35; + } else { + print LOG $LW35; + } + printf " [%3d files]\n", 3 unless ($quiet || $dry_run); - print "Scanning for MixedMap entries\n" if (! $quiet); + &wlog ("Scanning for MixedMap entries"); + &newline; my @tmp1 = &catMaps('^MixedMap'); - print "Scanning for Map entries\n" if (! $quiet); + foreach my $line (@tmp1) { + if ($dry_run) { + print "$line\n"; + } else { + print LOG "$line\n"; + } + } + &newline; + printf " [%3d files]\n", scalar @tmp1 + unless ($quiet || $dry_run); + + &wlog ("Scanning for Map entries"); + &newline(); my @tmp2 = &catMaps('^Map'); + foreach my $line (@tmp2) { + if ($dry_run) { + print "$line\n"; + } else { + print LOG "$line\n"; + } + } + &newline; + printf " [%3d files]\n\n", scalar @tmp2 + unless ($quiet || $dry_run); + + if (@missing > 0) { + print STDERR "\nERROR: The following map file(s) couldn't be found:\n\t"; + print STDERR join(' ', @missing); + my $progname=&progname(); + print STDERR "\n\n\tDid you run mktexlsr?\n\n" . + "\tYou can delete non-existent map entries using the command\n". + "\n\t $progname --syncwithtrees\n\n"; + exit (1); + } + exit(0) if $dry_run; # Create psfonts_t1.map, psfonts_pk.map, ps2pk.map and pdftex.map: for my $file ("$dvipsoutputdir/download35.map", @@ -1016,51 +1051,54 @@ updmap is creating new map files using the following configuration:\ "$dvipsoutputdir/psfonts_pk.map", "$pdftexoutputdir/pdftex_dl14.map", "$pdftexoutputdir/pdftex_ndl14.map", - "$dvipdfmoutputdir/dvipdfm_dl14.map", - "$dvipdfmoutputdir/dvipdfm_ndl14.map", "$dvipsoutputdir/ps2pk.map") { open FILE, ">$file"; - print FILE "% $file: maintained by the script updmap.\ -% Don't change this file directly. Edit texmf/web2c/$cnfFileShort\ -% and run updmap to recreate this file.\ + print FILE "% $file:\ +% maintained by updmap[-sys].\ +% Don't change this file directly. Use updmap[-sys] instead.\ +% See texmf/web2c/$cnfFileShort and the updmap documentation.\ +% A log of the run that created this file is available here:\ +% $logfile\ "; close FILE; } -# print "$dvips35 $pdftex35 $dvipdfm35 $ps2pk35 @tmp1 @tmp2\n"; - + print "Generating output for ps2pk...\n" if (! $quiet); my @ps2pk_map = &transLW35($ps2pk35); push @ps2pk_map, &getLines(@tmp1); push @ps2pk_map, &getLines(@tmp2); - &writeLines(">$dvipsoutputdir/ps2pk.map", &normalizeLines(@ps2pk_map)); + &writeLines(">$dvipsoutputdir/ps2pk.map", + &normalizeLines(@ps2pk_map)); + print "Generating output for dvips...\n" if (! $quiet); my @download35_map = &transLW35($ps2pk35); - &writeLines(">$dvipsoutputdir/download35.map", &normalizeLines(@download35_map)); + &writeLines(">$dvipsoutputdir/download35.map", + &normalizeLines(@download35_map)); + my @builtin35_map = &transLW35($dvips35); - &writeLines(">$dvipsoutputdir/builtin35.map", &normalizeLines(@builtin35_map)); + &writeLines(">$dvipsoutputdir/builtin35.map", + &normalizeLines(@builtin35_map)); my $dftdvips = ($dvipsDownloadBase35 ? $ps2pk35 : $dvips35); my @psfonts_t1_map = &transLW35($dftdvips); push @psfonts_t1_map, &getLines(@tmp1); push @psfonts_t1_map, &getLines(@tmp2); - &writeLines(">$dvipsoutputdir/psfonts_t1.map", &normalizeLines(@psfonts_t1_map)); + &writeLines(">$dvipsoutputdir/psfonts_t1.map", + &normalizeLines(@psfonts_t1_map)); my @psfonts_pk_map = &transLW35($dftdvips); push @psfonts_pk_map, &getLines(@tmp2); - &writeLines(">$dvipsoutputdir/psfonts_pk.map", &normalizeLines(@psfonts_pk_map)); + &writeLines(">$dvipsoutputdir/psfonts_pk.map", + &normalizeLines(@psfonts_pk_map)); + print "Generating output for pdftex...\n" if (! $quiet); # remove PaintType due to Sebastian's request my @tmp3 = &transLW35($pdftex35); push @tmp3, &getLines(@tmp1); push @tmp3, &getLines(@tmp2); @tmp3 = grep { $_ !~ m/(^%|PaintType)/ } @tmp3; - my @tmp6 = &transLW35($dvipdfm35); - push @tmp6, &getLines(@tmp1); - push @tmp6, &getLines(@tmp2); - @tmp6 = grep { $_ !~ m/(^%|PaintType)/ } @tmp6; - my @tmp7 = &transLW35($ps2pk35); push @tmp7, &getLines(@tmp1); push @tmp7, &getLines(@tmp2); @@ -1068,48 +1106,58 @@ updmap is creating new map files using the following configuration:\ my @pdftex_ndl14_map = @tmp3; @pdftex_ndl14_map = &normalizeLines(@pdftex_ndl14_map); + @pdftex_ndl14_map = &to_pdftex(@pdftex_ndl14_map); &writeLines(">$pdftexoutputdir/pdftex_ndl14.map", @pdftex_ndl14_map); my @pdftex_dl14_map = @tmp7; @pdftex_dl14_map = &normalizeLines(@pdftex_dl14_map); + @pdftex_dl14_map = &to_pdftex(@pdftex_dl14_map); &writeLines(">$pdftexoutputdir/pdftex_dl14.map", @pdftex_dl14_map); - my @dvipdfm_dl14_map = @tmp7; - @dvipdfm_dl14_map = &normalizeLines(&dvips2dvipdfm(&normalizeLines(@dvipdfm_dl14_map))); - &writeLines(">$dvipdfmoutputdir/dvipdfm_dl14.map", @dvipdfm_dl14_map); - - my @dvipdfm_ndl14_map = @tmp6; - @dvipdfm_ndl14_map = &normalizeLines(&dvips2dvipdfm(&normalizeLines(@dvipdfm_ndl14_map))); - &writeLines(">$dvipdfmoutputdir/dvipdfm_ndl14.map", @dvipdfm_ndl14_map); - &setupSymlinks; - if ($texhashEnabled) { - my $cmd = "mktexlsr"; - &start_redirection("nul") if ($quiet); - system($cmd); - &stop_redirection if ($quiet); - } - - if (! $quiet) { - print STDOUT "Files generated:\n"; - for my $f ("$dvipsoutputdir/download35.map", - "$dvipsoutputdir/builtin35.map", - "$dvipsoutputdir/psfonts_t1.map", - "$dvipsoutputdir/psfonts_pk.map", - "$pdftexoutputdir/pdftex_dl14.map", - "$pdftexoutputdir/pdftex_ndl14.map", - "$dvipdfmoutputdir/dvipdfm_dl14.map", - "$dvipdfmoutputdir/dvipdfm_ndl14.map", - "$dvipsoutputdir/ps2pk.map") { - if (-e $f) { - my @stat=stat($f); - printf "%7d %s %s\n", $stat[7], scalar (localtime $stat[9]), $f; + &wlog ("\nFiles generated:\n"); + sub dir { + my ($d, $f, $target)=@_; + if (-e "$d/$f") { + my @stat=lstat("$d/$f"); + my ($s,$m,$h,$D,$M,$Y)=localtime($stat[9]); + my $timestamp=sprintf ("%04d-%02d-%02d %02d:%02d:%02d", + $Y+1900, $M+1, $D, $h, $m, $s); + my $date=sprintf "%12d %s %s", $stat[7], $timestamp, $f; + &wlog ($date); + + if (-l "$d/$f") { + my $lnk=sprintf " -> %s\n", readlink ("$d/$f"); + &wlog ($lnk); + } elsif ($f eq $target) { + if (&files_are_identical("$d/$f", "$d/$link{$target}")) { + &wlog (" = $link{$target}\n"); + } else { + &wlog (" = ?????\n"); # This shouldn't happen. + } } else { - print STDERR "Warning: File $f doesn't exist.\n"; - } + &wlog ("\n"); + } + } else { + print STDERR "Warning: File $d/$f doesn't exist.\n"; + print LOG "Warning: File $d/$f doesn't exist.\n"; } } + my $d; + $d="$dvipsoutputdir"; &wlog (" $d:\n"); + foreach my $f ('builtin35.map', 'download35.map', 'psfonts_pk.map', + 'psfonts_t1.map', 'ps2pk.map', 'psfonts.map') { + dir ($d, $f, 'psfonts.map'); + $updLSR->{add}("$d/$f"); + } + $d="$pdftexoutputdir"; &wlog (" $d:\n"); + foreach my $f ('pdftex_dl14.map', 'pdftex_ndl14.map', 'pdftex.map') { + dir ($d, $f, 'pdftex.map'); + $updLSR->{add}("$d/$f"); + } + close LOG; + print "\nTranscript written on \"$logfile\".\n" if (! $quiet); } ############################################################################### @@ -1117,7 +1165,6 @@ updmap is creating new map files using the following configuration:\ # execution starts here ############################################################################### sub main { - &initVars; &processOptions; @@ -1131,7 +1178,15 @@ sub main { &setupCfgFile; if ($listmaps) { - &listMaps; + &listMaps ('list'); + exit 0; + } + if ($listavailablemaps) { + &listMaps ('avail'); + exit 0; + } + if ($syncwithtrees) { + &listMaps ('sync'); exit 0; } @@ -1142,24 +1197,29 @@ sub main { my $cmd = ''; if ($opt_edit) { - my $editor = `kpsewhich --expand-var \$TEXEDIT`; - chomp($editor); - $editor = "notepad" if ($editor eq ""); + my $editor = undef; + $editor ||= $ENV{'EDITOR'}; + $editor ||= $ENV{'VISUAL'}; + if (&win32) { + $editor ||= "notepad"; + } else { + $editor ||= "vi"; + } $cmd = 'edit'; system("$editor $cnfFile"); } - elsif (keys %setOption) { $cmd = 'setOption'; foreach my $m (keys %setOption) { &setOption ($m, $setOption{$m}); } } - - elsif (keys %enableItem) { + elsif ($enableItem) { $cmd = 'enableMap'; - foreach my $m (keys %enableItem) { - &enableMap($m, $enableItem{$m}); + if ($enableItem=~/=/) { + &enableMap(split('=', $enableItem)); + } else { + &enableMap($enableItem, shift @ARGV); } } elsif (@disableItem) { @@ -1168,19 +1228,17 @@ sub main { &disableMap($m); } } - if ($cmd and &files_are_equal($bakFile, $cnfFile)) { print "$cnfFile unchanged. Map files not recreated.\n" unless ($quiet); } else { - if ($mkmapEnabled) { + if (! $nomkmap) { &setupDestDir; &mkMaps; } - # &cleanup; unlink ($bakFile); } - + $updLSR->{exec}() unless $nohash; } __END__ |